Re: netdevice.7 SIOCGIFFLAGS/SIOCSIFFLAGS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[CC += Fredrik, John, David S., Steven, Oliver, Urs]

Hi,

On 3/17/21 3:12 PM, Erik Flodin wrote:
> 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
> 

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=b00055aacdb172c05067612278ba27265fcd05ce>
<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>

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/
http://www.alejandro-colomar.es/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux