cinterfaceipv6polling

Is there a notification mechanism for when getifaddrs() results change?


On startup, my program calls getifaddrs() to find out what network interfaces are available for link-local IPv6 multicasting. This works as far as it goes, but it doesn't handle the case where the set of available network interfaces changes after getifaddrs() has returned.

Is there some way for the OS to notify my program when the network interfaces have changed, so I can call getifaddrs() again and update my list? Or am I doomed to poll getifaddrs() every few seconds, forever?

(Note: on Windows, I call GetAdaptersAddresses() instead of getifaddrs(), but the same issue exists there)


Solution

  • You probably want to have a look at the NotifyAddrChange and NotifyIpInterfaceChange functions.