I have been using this code as a sample to receive interface up/down events on a Linux machine. I am able to receive the events correctly but when an interface comes up from a previous down state, I receive multiple netlink events like this:
Event received >> NETLINK::Down
Event received >> NETLINK::Down
Event received >> NETLINK::Up
edit: I have modified a line in this code from:
addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;
to:
addr.nl_groups = RTMGRP_LINK;
But still I receive multiple events. Can anybody suggest if it is possible to suppress these events to receive a unique event for each state? If so how?