Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| net_device_attributes [2018/08/01 14:44] – rpjday | net_device_attributes [2018/08/01 15:05] (current) – rpjday | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Overview ===== | ===== Overview ===== | ||
| - | Discussion about how net cable connect and disconnect are reflected in SYSFS. | + | Discussion about how net cable connect and disconnect are reflected in ''/ |
| - | ===== / | + | ===== / |
| < | < | ||
| Line 41: | Line 41: | ||
| -r--r--r--. 1 root root 4096 Aug 1 10:41 type | -r--r--r--. 1 root root 4096 Aug 1 10:41 type | ||
| -rw-r--r--. 1 root root 4096 Aug 1 10:41 uevent | -rw-r--r--. 1 root root 4096 Aug 1 10:41 uevent | ||
| + | </ | ||
| + | |||
| + | In particular, we care about the attributes that reflect physical connection (note how '' | ||
| + | |||
| + | < | ||
| + | -rw-r--r--. 1 root root 4096 Aug 1 10:41 carrier | ||
| + | -r--r--r--. 1 root root 4096 Aug 1 10:41 operstate | ||
| + | -rw-r--r--. 1 root root 4096 Aug 1 10:41 flags | ||
| + | </ | ||
| + | |||
| + | ===== flags ===== | ||
| + | |||
| + | ==== include/ | ||
| + | |||
| + | < | ||
| + | /** | ||
| + | * enum net_device_flags - &struct net_device flags | ||
| + | * | ||
| + | * These are the &struct net_device flags, they can be set by drivers, the | ||
| + | * kernel and some can be triggered by userspace. Userspace can query and | ||
| + | * set these flags using userspace utilities but there is also a sysfs | ||
| + | * entry available for all dev flags which can be queried and set. These flags | ||
| + | * are shared for all types of net_devices. The sysfs entries are available | ||
| + | * via / | ||
| + | * are annotated below, note that only a few flags can be toggled and some | ||
| + | * other flags are always always preserved from the original net_device flags | ||
| + | * even if you try to set them via sysfs. Flags which are always preserved | ||
| + | * are kept under the flag grouping @IFF_VOLATILE. Flags which are volatile | ||
| + | * are annotated below as such. | ||
| + | * | ||
| + | * You should have a pretty good reason to be extending these flags. | ||
| + | * | ||
| + | * @IFF_UP: interface is up. Can be toggled through sysfs. | ||
| + | * @IFF_BROADCAST: | ||
| + | * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. | ||
| + | * @IFF_LOOPBACK: | ||
| + | * @IFF_POINTOPOINT: | ||
| + | * @IFF_NOTRAILERS: | ||
| + | | ||
| + | * @IFF_RUNNING: | ||
| + | * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. | ||
| + | * @IFF_PROMISC: | ||
| + | * @IFF_ALLMULTI: | ||
| + | | ||
| + | * @IFF_MASTER: | ||
| + | * @IFF_SLAVE: slave of a load balancer. Volatile. | ||
| + | * @IFF_MULTICAST: | ||
| + | * @IFF_PORTSEL: | ||
| + | * @IFF_AUTOMEDIA: | ||
| + | * @IFF_DYNAMIC: | ||
| + | | ||
| + | * @IFF_LOWER_UP: | ||
| + | * @IFF_DORMANT: | ||
| + | * @IFF_ECHO: echo sent packets. Volatile. | ||
| + | */ | ||
| + | enum net_device_flags { | ||
| + | IFF_UP | ||
| + | IFF_BROADCAST | ||
| + | IFF_DEBUG | ||
| + | IFF_LOOPBACK | ||
| + | IFF_POINTOPOINT | ||
| + | IFF_NOTRAILERS | ||
| + | IFF_RUNNING | ||
| + | IFF_NOARP | ||
| + | IFF_PROMISC | ||
| + | IFF_ALLMULTI | ||
| + | IFF_MASTER | ||
| + | IFF_SLAVE | ||
| + | IFF_MULTICAST | ||
| + | IFF_PORTSEL | ||
| + | IFF_AUTOMEDIA | ||
| + | IFF_DYNAMIC | ||
| + | IFF_LOWER_UP | ||
| + | IFF_DORMANT | ||
| + | IFF_ECHO | ||
| + | }; | ||
| + | |||
| + | #define IFF_UP | ||
| + | #define IFF_BROADCAST | ||
| + | #define IFF_DEBUG | ||
| + | #define IFF_LOOPBACK | ||
| + | #define IFF_POINTOPOINT | ||
| + | #define IFF_NOTRAILERS | ||
| + | #define IFF_RUNNING | ||
| + | #define IFF_NOARP | ||
| + | #define IFF_PROMISC | ||
| + | #define IFF_ALLMULTI | ||
| + | #define IFF_MASTER | ||
| + | #define IFF_SLAVE | ||
| + | #define IFF_MULTICAST | ||
| + | #define IFF_PORTSEL | ||
| + | #define IFF_AUTOMEDIA | ||
| + | #define IFF_DYNAMIC | ||
| + | #define IFF_LOWER_UP | ||
| + | #define IFF_DORMANT | ||
| + | #define IFF_ECHO | ||
| + | |||
| + | #define IFF_VOLATILE | ||
| + | IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) | ||
| </ | </ | ||