On 06/22/2011 04:01 PM, Denys Vlasenko wrote:
On Wednesday 22 June 2011 17:29, David Henderson wrote:
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?
ifup and ifdown. (Although on some systmes they aren't binaries,
they are scripts).
I'm assuming that since I don't call ifup, that might be why the file
isn't being created... Perhaps this could be created manually so ifdown
can work?
I'm
not configuring the iface by hand, but with utilities such as ifplugd,
udhcp, and if* binaries.
If you dont use ifup to up the iface, why do you use ifdown
to deconfigure it?
Because the script takes into account disconnected interfaces and
assigns a 169.254.x.x address, thus a call to ifdown. With the problems
experienced with the ifdown binary, a temporary (or permanent) work
around is to use the ifconfig binary (which has no problems).
Also, the /etc/network/interfaces file does
get created in a script, but matches all the naming conventions and
works just fine. Thoughts?
You seem to be confused. /etc/network/interfaces should be edited by
admin, not created by scripts.
Nope, no confusion. /etc/network/interfaces is created dynamically by
scripts which has actually produced less headache if NIC's are switched
or configuration changes need to occur. Sure beats the "by hand" way of
doing it! :)
I guess at this point, we've realized that this doesn't appear to really
be a bug since it's just a matter of a missing file. And since none of
the scripts call if the ifup command (which I guess is what creates the
/var/run/ifstate file), I'll just have to continue to use the ifconfig
work around. Thanks for everyone's help!
Dave
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox