// Flags
unsigned int flags;
+ uint8_t operstate;
};
int nw_link_create(nw_link** link, nw_daemon* daemon, int ifindex) {
static int nw_link_update_flags(nw_link* link, sd_netlink_message* message) {
unsigned int flags = 0;
+ uint8_t operstate = 0;
int r;
// Fetch flags
return 1;
}
+ // Fetch operstate
+ r = sd_netlink_message_read_u8(message, IFLA_OPERSTATE, &operstate);
+ if (r < 1) {
+ ERROR("Could not read operstate: %m\n");
+ return 1;
+ }
+
// End here if there have been no changes
- if (link->flags == flags)
+ if (link->flags == flags && link->operstate == operstate)
return 0;
// XXX We should log any changes here
- // Store the new flags
+ // Store the new flags & operstate
link->flags = flags;
+ link->operstate = operstate;
+
return 0;
}