diff options
author | Frank Bergmann <frank.frajasalo@googlemail.com> | 2015-03-13 10:05:08 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-03-22 17:04:27 +0100 |
commit | 6ca03f2dd82ee2a09f257fad7c2bf6898310c438 (patch) | |
tree | b2430893e999ab9157a4f29899734081227a0bb4 | |
parent | 75a76269ba2549cb5392d7d720a4c393de01b934 (diff) | |
download | busybox-w32-6ca03f2dd82ee2a09f257fad7c2bf6898310c438.tar.gz busybox-w32-6ca03f2dd82ee2a09f257fad7c2bf6898310c438.tar.bz2 busybox-w32-6ca03f2dd82ee2a09f257fad7c2bf6898310c438.zip |
ifupdown: correct ifstate update during 'ifup -a'. Closes 6212
When 'if -a' runs into an failure on an interface all further
interfaces won't be correctly updated in ifstate. This patch
inserts a new variable that only tracks the current interfaces
failure so that the write to ifstate can rely on this and not
the one for the functions return value.
Fixes https://bugs.busybox.net/show_bug.cgi?id=6212
Signed-off-by: Frank Bergmann <frank.frajasalo@googlemail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/ifupdown.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index daabeec0c..9f2500331 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -1239,6 +1239,7 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv) | |||
1239 | char *pch; | 1239 | char *pch; |
1240 | bool okay = 0; | 1240 | bool okay = 0; |
1241 | int cmds_ret; | 1241 | int cmds_ret; |
1242 | bool curr_failure = 0; | ||
1242 | 1243 | ||
1243 | iface = xstrdup(target_list->data); | 1244 | iface = xstrdup(target_list->data); |
1244 | target_list = target_list->link; | 1245 | target_list = target_list->link; |
@@ -1306,9 +1307,9 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv) | |||
1306 | if (cmds_ret == -1) { | 1307 | if (cmds_ret == -1) { |
1307 | bb_error_msg("don't seem to have all the variables for %s/%s", | 1308 | bb_error_msg("don't seem to have all the variables for %s/%s", |
1308 | liface, currif->address_family->name); | 1309 | liface, currif->address_family->name); |
1309 | any_failures = 1; | 1310 | any_failures = curr_failure = 1; |
1310 | } else if (cmds_ret == 0) { | 1311 | } else if (cmds_ret == 0) { |
1311 | any_failures = 1; | 1312 | any_failures = curr_failure = 1; |
1312 | } | 1313 | } |
1313 | 1314 | ||
1314 | currif->iface = oldiface; | 1315 | currif->iface = oldiface; |
@@ -1329,7 +1330,7 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv) | |||
1329 | llist_t *state_list = read_iface_state(); | 1330 | llist_t *state_list = read_iface_state(); |
1330 | llist_t *iface_state = find_iface_state(state_list, iface); | 1331 | llist_t *iface_state = find_iface_state(state_list, iface); |
1331 | 1332 | ||
1332 | if (cmds == iface_up && !any_failures) { | 1333 | if (cmds == iface_up && !curr_failure) { |
1333 | char *newiface = xasprintf("%s=%s", iface, liface); | 1334 | char *newiface = xasprintf("%s=%s", iface, liface); |
1334 | if (!iface_state) { | 1335 | if (!iface_state) { |
1335 | llist_add_to_end(&state_list, newiface); | 1336 | llist_add_to_end(&state_list, newiface); |