[PATCH] ifupdown: remove interface from state_list if iface_up fails
Lauri Hintsala
lauri.hintsala at bluegiga.com
Wed Dec 14 14:49:58 UTC 2011
Fix the issue where interface is set to the configured state even if
configuration has been failed. Add error check to state setting logic.
Signed-off-by: Lauri Hintsala <lauri.hintsala at bluegiga.com>
---
Tested with following command line sequence.
Wihtout patch:
$ ifup eth0
udhcpc (v1.18.5) started
Sending discover...
Sending discover...
Sending discover...
No lease, failing
$ ifup eth0
ifup: interface eth0 already configured
With patch:
$ ifup eth0
udhcpc (v1.18.5) started
Sending discover...
Sending discover...
Sending discover...
No lease, failing
$ ifup eth0
udhcpc (v1.18.5) started
Sending discover...
Sending discover...
Sending discover...
No lease, failing
$ ifup eth0
udhcpc (v1.18.5) started
Sending discover...
Sending select for 10.0.0.2...
Lease of 10.0.0.2 obtained, lease time 3600
adding dns 10.0.0.1
$ ifup eth0
ifup: interface eth0 already configured
$ ifdown eth0
$ ifup eth0
udhcpc (v1.18.5) started
Sending discover...
Sending discover...
Sending select for 10.0.0.2...
Lease of 10.0.0.2 obtained, lease time 3600
adding dns 10.0.0.1
---
networking/ifupdown.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 5946323..9c2cad2 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1311,7 +1311,7 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
llist_t *state_list = read_iface_state();
llist_t *iface_state = find_iface_state(state_list, iface);
- if (cmds == iface_up) {
+ if (cmds == iface_up && !any_failures) {
char * const newiface = xasprintf("%s=%s", iface, liface);
if (iface_state == NULL) {
llist_add_to_end(&state_list, newiface);
--
1.7.4.1
More information about the busybox
mailing list