On 06/18/2011 04:48 AM, Denys Vlasenko wrote:
On Thursday 16 June 2011 19:25, David Henderson wrote:
Hello everyone! I'm working some more with the 'if*' commands and come
across an issue and wanted to ask about it here. I have a script that
calls 'ifdown' for an adapter like: ifdown -f lan01&& echo success ||
echo failure. I noticed that it wasn't executing correctly so I
performed the step manually from the command line like:
# ifdown lan01&& echo success || echo failure
ifdown: interface lan01 not configured
success
"ifdown lan01; echo $?" would be more informative here
# ifconfig
lan01 Link encap:Ethernet HWaddr 00:27:0E:17:99:35
inet addr:192.168.0.198 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:340 errors:0 dropped:0 overruns:0 frame:0
TX packets:109 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:34257 (33.4 KiB) TX bytes:15911 (15.5 KiB)
Memory:d0d00000-d0d20000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
I see two issues right off the top. First, as you can see, the lan01
interface does exist but isn't seen by 'ifdown'
ifdown checks iface state by looking into /var/run/ifstate.
If you configured iface, say, by hand, ifdown will see nothing there
and will think that "interface lan01 not configured".
Whta is in your /var/run/ifstate and /etc/network/interfaces files?
and second, it's exit
status doesn't appear to be correct as it should have shown 'failure'
instead of 'success'.
This is a bug _if_ standard ifdown does report failure in this case.
Can you test standard tool behavior?
Thanks for the reply Denys. I think I see where the problem lies - I
don't have a /var/run/ifstate file! What binary creates this file? I'm
not configuring the iface by hand, but with utilities such as ifplugd,
udhcp, and if* binaries. Also, the /etc/network/interfaces file does
get created in a script, but matches all the naming conventions and
works just fine. Thoughts?
Thanks,
Dave
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox