Re: [Toybox] Regarding ifconfig
On 02/25/2015 04:15 AM, 김혜진 wrote: > Hi. > I have a question about ifconfig. > Nov 30 on 2013, Rob deleted "trailers" and "dynamic" options because > they are dead fields unused by linux kernel. > > But, "NOTRAILERS" and "DYNAMIC" string still exist in the code, line > from 212 to 214 in ifconfig.c > I think these also should be removed if really dead fields. The "flags" field is set by a call to an ioctl, SIOCGIFFLAGS. The table is the set of labels for the bit positions from /usr/include/linux/if.h: /* Standard interface flags (netdevice->flags). */ #define IFF_UP 0x1 /* interface is up */ #define IFF_BROADCAST 0x2 /* broadcast address valid */ #define IFF_DEBUG 0x4 /* turn on debugging*/ #define IFF_LOOPBACK0x8 /* is a loopback net*/ #define IFF_POINTOPOINT 0x10/* interface is has p-p link*/ #define IFF_NOTRAILERS 0x20/* avoid use of trailers*/ #define IFF_RUNNING 0x40/* interface RFC2863 OPER_UP*/ #define IFF_NOARP 0x80/* no ARP protocol */ #define IFF_PROMISC 0x100 /* receive all packets */ #define IFF_ALLMULTI0x200 /* receive all multicast packets*/ #define IFF_MASTER 0x400 /* master of a load balancer*/ #define IFF_SLAVE 0x800 /* slave of a load balancer */ #define IFF_MULTICAST 0x1000 /* Supports multicast */ #define IFF_PORTSEL 0x2000 /* can set media type */ #define IFF_AUTOMEDIA 0x4000 /* auto media select active */ #define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ Even though a modern kernel should never set the NOTRAILERS or DYNAMIC bits, those are the labels for those bit positions. (I could replace each with "" but the space savings is trivial. We need something there in each slot to get the spacing right.) Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
[Toybox] Regarding ifconfig
Hi. I have a question about ifconfig. Nov 30 on 2013, Rob deleted "trailers" and "dynamic" options because they are dead fields unused by linux kernel. But, "NOTRAILERS" and "DYNAMIC" string still exist in the code, line from 212 to 214 in ifconfig.c I think these also should be removed if really dead fields. Thanks. ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Regarding ifconfig
On 02/05/2015 04:41 AM, 김혜진 wrote: > Hello. > > Today I found an issue of ifconfig on testing board. > > > Example) ifconfig *eth0:0* 10.0.0.100 > ifconfig: ioctl 8914: Cannot assign requested address > > As seeing the example, error occurs when we set virtual address on eth0 > using _:_ > > > At line 488 of ifconfig.c, I found a doubtful point. > > *else if (t->name || !strchr(ifre.ifr_name, ':')) {* > > _:_ has been checked here. and there is no other else if for _:_ next of it. > > I tried to change it like : *else if (t->name || ifre.ifr_name)* That's a structure array member, which becomes a pointer to the start of the array, which is never going to be null so the second test becomes a NOP. I'm not sure why that test was there, to be honest. The test is saying "if we're have a command verb" (I.E. any command but "ifconfig eth0 1.2.3.4", such as "ifconfig eth0 netmask 1.2.3.4"), or if we have an actual non-aliased interface name, then proceed. So it's specifically _excluding_ setting an address on an alias. Which is odd. I've just removed it and made it "else {", if we hit a reason it was there... it obviously wasn't performing its intended purpose. Sigh, presumably somewhere in the cleanup description I explained what I _thought_ it was doing... Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
[Toybox] Regarding ifconfig
Hello. Today I found an issue of ifconfig on testing board. Example) ifconfig *eth0:0* 10.0.0.100 ifconfig: ioctl 8914: Cannot assign requested address As seeing the example, error occurs when we set virtual address on eth0 using _:_ At line 488 of ifconfig.c, I found a doubtful point. *else if (t->name || !strchr(ifre.ifr_name, ':')) {* _:_ has been checked here. and there is no other else if for _:_ next of it. I tried to change it like : *else if (t->name || ifre.ifr_name)* It satisfied my issue example. But I cannot ensure other side effects, besides ifconfig code is hard to handle. If anyone have a good idea, plz help. ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net