Open VenkateswaranJ opened 3 years ago
excuse me, unplug and replug the network cable is same as eth interface up/down?
The RTM_NEWLINK
is telling you that the link was updated (there is no explicit "updated" message type), and it lost its carrier (or gained it). You will see this is you check the contents of the IFLA_CARRIER
field in the messages.
RTM_DELLINK
will only be sent out if a network interface is removed completely, e.g. when deleting a vlan interface via ip link del ...
.
I have a small test code that checks for eth interface up/down events from the RTNLGRP_LINKmulticast group, but unfortunately, I'm always getting the RTM_NEWLINK event even when I unplug and replug the network cable. I expect RTM_DELLINK when I unplug the cable and RTM_NEWLINK when the cable is connected. I'm using libnl-3.4.0 library.
can anyone point out what I'm doing wrong?
CMakeLists.txt to compile the above code: