What is the difference between IFF_UP and IFF_RUNNING? What is the difference between IFF_UP and IFF_RUNNING? linux linux

What is the difference between IFF_UP and IFF_RUNNING?


From Linux Device Drivers 3:

IFF_UP This flag is read-only for the driver. The kernel turns it on when the interface is active and ready to transfer packets.

...

IFF_RUNNING

This flag indicates that the interface is up and running. It is mostly present for BSD compatibility; the kernel makes little use of it. Most network drivers need not worry about IFF_RUNNING.

Digging a bit deeper, it seems that there is one significant difference:

IFF_RUNNING is supposed to reflect the operational status on a network interface, rather than its administrative one. To provide an example, an Ethernet interface may be brought UP by the administrator (e.g. ifconfig eth0 up), but it will not be considered operational (i.e. RUNNING as per RFC2863) if the cable is not plugged in.


To check if the ethernet cable is really connected to the network You should check IFF_RUNNIG. IFF_UP means that the system allocated the resources for the interface.

Please find detailed code how "ip link show" and "ethtool eth0" checks for link is up here.