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>
This commit is contained in:
parent
75a76269ba
commit
6ca03f2dd8
@ -1239,6 +1239,7 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
char *pch;
|
char *pch;
|
||||||
bool okay = 0;
|
bool okay = 0;
|
||||||
int cmds_ret;
|
int cmds_ret;
|
||||||
|
bool curr_failure = 0;
|
||||||
|
|
||||||
iface = xstrdup(target_list->data);
|
iface = xstrdup(target_list->data);
|
||||||
target_list = target_list->link;
|
target_list = target_list->link;
|
||||||
@ -1306,9 +1307,9 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (cmds_ret == -1) {
|
if (cmds_ret == -1) {
|
||||||
bb_error_msg("don't seem to have all the variables for %s/%s",
|
bb_error_msg("don't seem to have all the variables for %s/%s",
|
||||||
liface, currif->address_family->name);
|
liface, currif->address_family->name);
|
||||||
any_failures = 1;
|
any_failures = curr_failure = 1;
|
||||||
} else if (cmds_ret == 0) {
|
} else if (cmds_ret == 0) {
|
||||||
any_failures = 1;
|
any_failures = curr_failure = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
currif->iface = oldiface;
|
currif->iface = oldiface;
|
||||||
@ -1329,7 +1330,7 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
llist_t *state_list = read_iface_state();
|
llist_t *state_list = read_iface_state();
|
||||||
llist_t *iface_state = find_iface_state(state_list, iface);
|
llist_t *iface_state = find_iface_state(state_list, iface);
|
||||||
|
|
||||||
if (cmds == iface_up && !any_failures) {
|
if (cmds == iface_up && !curr_failure) {
|
||||||
char *newiface = xasprintf("%s=%s", iface, liface);
|
char *newiface = xasprintf("%s=%s", iface, liface);
|
||||||
if (!iface_state) {
|
if (!iface_state) {
|
||||||
llist_add_to_end(&state_list, newiface);
|
llist_add_to_end(&state_list, newiface);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user