summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-08-18 11:28:16 +0000
committerRoy Marples <roy@marples.name>2016-08-18 11:28:16 +0000
commit47c18997b8475d24e2ef3b6a9d31f8d7ab2834f7 (patch)
tree61b873732413e87ae2b51a179f0d2046d175d4b3 /dhcpcd.c
parent0d95c0162cd5a69db8a36bae6bd9a90810328667 (diff)
downloaddhcpcd-47c18997b8475d24e2ef3b6a9d31f8d7ab2834f7.tar.xz
Only stop_interface() if it's active instead of checking if options exist.
Thanks to Koichi Okamoto.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 1f3a9711..2bb94f53 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -379,9 +379,6 @@ stop_interface(struct interface *ifp)
struct dhcpcd_ctx *ctx;
ctx = ifp->ctx;
- if (!ifp->active)
- goto stop;
-
logger(ctx, LOG_INFO, "%s: removing interface", ifp->name);
ifp->options->options |= DHCPCD_STOPPING;
@@ -400,7 +397,6 @@ stop_interface(struct interface *ifp)
/* Set the link state to unknown as we're no longer tracking it. */
ifp->carrier = LINK_UNKNOWN;
-stop:
if (!(ctx->options & (DHCPCD_MASTER | DHCPCD_TEST)))
eloop_exit(ctx->eloop, EXIT_FAILURE);
}
@@ -1185,13 +1181,13 @@ stop_all_interfaces(struct dhcpcd_ctx *ctx, unsigned long long opts)
ctx->options |= DHCPCD_EXITING;
/* Drop the last interface first */
TAILQ_FOREACH_REVERSE(ifp, ctx->ifaces, if_head, next) {
- if (ifp->options) {
+ if (ifp->active) {
ifp->options->options |= opts;
if (ifp->options->options & DHCPCD_RELEASE)
ifp->options->options &= ~DHCPCD_PERSISTENT;
ifp->options->options |= DHCPCD_EXITING;
+ stop_interface(ifp);
}
- stop_interface(ifp);
}
}
@@ -1404,6 +1400,8 @@ dhcpcd_handleargs(struct dhcpcd_ctx *ctx, struct fd_list *fd,
for (oi = optind; oi < argc; oi++) {
if ((ifp = if_find(ctx->ifaces, argv[oi])) == NULL)
continue;
+ if (!ifp->active)
+ continue;
ifp->options->options |= opts;
if (opts & DHCPCD_RELEASE)
ifp->options->options &= ~DHCPCD_PERSISTENT;