Re: Fwd: netdevice.7 SIOCGIFFLAGS/SIOCSIFFLAGS
From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: 2021-03-20 17:23:47
Hi Alejandro, we added IFF_ECHO these days on suggestion of Dave Miller - and the IFF_LOWER_UP/IFF_DORMANT were already there at that time. I don't know if there ioctls are still used for retrieving these flags as I assume this is done via netlink interface today. At least there is enough space (in the union) in the ioctl structure for longer data structures: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/if.h#L265 https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/if.h#L247 https://elixir.bootlin.com/linux/latest/source/net/core/dev_ioctl.c#L114 If you continue discussing about this topic, please remove the Volkswagen mail addresses from Urs and me. I'm still maintaining the CAN subsystem in the Linux kernel - but with a private mail address. And you should better add the netdev ML to your recipients netdev@vger.kernel.org where all the netdev guys (including Dave Miller) hang out. Best, Oliver
------------------------------------------------------------------------ *Von:* Alejandro Colomar (man-pages) [off-list ref] *Gesendet:* Freitag, März 19, 2021 9:00 PM *An:* Erik Flodin; mtk.manpages@gmail.com *Cc:* linux-man@vger.kernel.org; Stefan Rompf; David S. Miller; Fredrik Arnerup; John Dykstra; David S. Miller; Hartkopp, Oliver, Dr. (EESC/3); Thuermann, Urs, Dr. (K-AERD/M) *Betreff:* Re: netdevice.7 SIOCGIFFLAGS/SIOCSIFFLAGS [CC += Fredrik, John, David S., Steven, Oliver, Urs] Hi, On 3/17/21 3:12 PM, Erik Flodin wrote:quoted
Hi, The documentation for SIOCGIFFLAGS/SIOCSIFFLAGS in netdevice.7 lists IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO, but those can't be set in ifr_flags as it is only a short and the flags start at 1<<16. See also https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=746e6ad23cd6fec2edce056e014a0eabeffa838c<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=746e6ad23cd6fec2edce056e014a0eabeffa838c>quoted
I don't know what's the history of that. I researched a bit, and while the struct member is indeed a 'short' [1], the flags were added to the kernel for some reason. I added a few people to the thread that may know better what to do.Let's see if they can comment. Links to relevant commits: <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=746e6ad23cd6fec2edce056e014a0eabeffa838c <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=746e6ad23cd6fec2edce056e014a0eabeffa838c>> <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b00055aacdb172c05067612278ba27265fcd05ce <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b00055aacdb172c05067612278ba27265fcd05ce>> <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cd05acfe65ed2cf2db683fa9a6adb8d35635263b <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cd05acfe65ed2cf2db683fa9a6adb8d35635263b>> <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=6ecda4d14604d250d385346f4fe9de707f281759 <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=6ecda4d14604d250d385346f4fe9de707f281759>> Thanks, Alex [1]: .../linux$ sed -n '/struct ifreq {/,/};/p' include/uapi/linux/if.h struct ifreq { #define IFHWADDRLEN 6 union { char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; void __user * ifru_data; struct if_settings ifru_settings; } ifr_ifru; }; .../linux$ grep 'define\sifr_flags' include/uapi/linux/if.h #define ifr_flags ifr_ifru.ifru_flags /* flags */ .../linux$ -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ <https://www.kernel.org/doc/man-pages/> http://www.alejandro-colomar.es/ <http://www.alejandro-colomar.es/>