Reputation: 6226
These two flags are often set together. What is the difference between them?
Upvotes: 25
Views: 25045
Reputation: 7610
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.
Upvotes: 7
Reputation: 86353
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.
Upvotes: 33