clinuxnetwork-programming

Verify Presence of network interface using C (Linux)


Is there a way to find out if a particular interface exits using C .


Solution

  • getifaddrs. There is an example program on the manpage. Basically you would have to just loop through the list looking for a match. Optionally you can look at if_nameindex if_indextoname and if_nametoindex