I have written a program using Netlink sockets. I am able to successfully detect the link status change (i.e., when the network cable is plugged/unplugged). But in both the cases I am getting a RTM_NEWLINK
event.
I thought I could query the SIOCGIFFLAGS
and get the IFF_UP
status to know the status using getifaddrs system call. To do that I would like to know what is the interface that caused the link event. Is there a way to know that? Currently I am not aware of any members in the struct nlmsghdr
or sockaddr_nl
that would give the interface that caused a link change.