Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between IFF_UP and IFF_RUNNING?

Tags:

These two flags are often set together. What is the difference between them?

like image 309
Kara Avatar asked Jul 26 '12 23:07

Kara


People also ask

What is a Netdevice?

The net device structure, defined in file linux/include/netdevice. h, is the data structure that defines an instance of a network interface. It tracks the state information of all the network interface devices attached to the TCP/IP stack.

What is Siocgifaddr?

SIOCGIFADDR. Get the interface address for the given interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_name field with the interface name, and upon return, the ifr_ifru. ifru_addr field is set with the interface address.


1 Answers

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.

like image 58
thkala Avatar answered Oct 04 '22 06:10

thkala