How can I monitor the NIC status(up/down) in a C program without polling the kernel?

Yes, open a netlink socket and listen to the RTMGRP_LINK (network interface create/delete/up/down events) multicast groups.

The netlink man page here has a specific example to do this.

Leave a Comment