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