]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When releasing, we need to de-configure the interface as well.
authorRoy Marples <roy@marples.name>
Wed, 20 Nov 2013 11:37:25 +0000 (11:37 +0000)
committerRoy Marples <roy@marples.name>
Wed, 20 Nov 2013 11:37:25 +0000 (11:37 +0000)
dhcpcd.c

index 6e5bc03b304a0acc54926daf0b1f1b20f3d875d4..6ea8f1def65d1772048ead123afff70a596d0043 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -325,6 +325,11 @@ configure_interface1(struct interface *ifp)
        /* Do any platform specific configuration */
        if_conf(ifp);
 
+       /* If we want to release a lease, we can't really persist the
+        * address either. */
+       if (ifo->options & DHCPCD_RELEASE)
+               ifo->options &= ~DHCPCD_PERSISTENT;
+
        if (ifp->flags & IFF_POINTOPOINT && !(ifo->options & DHCPCD_INFORM))
                ifo->options |= DHCPCD_STATIC;
        if (ifp->flags & IFF_NOARP ||
@@ -889,8 +894,10 @@ handle_signal(int sig, siginfo_t *siginfo, __unused void *context)
                ifp = TAILQ_LAST(ifaces, if_head);
                if (ifp == NULL)
                        break;
-               if (do_release)
+               if (do_release) {
                        ifp->options->options |= DHCPCD_RELEASE;
+                       ifp->options->options &= ~DHCPCD_PERSISTENT;
+               }
                ifp->options->options |= DHCPCD_EXITING;
                stop_interface(ifp);
        }
@@ -1027,8 +1034,10 @@ handle_args(struct fd_list *fd, int argc, char **argv)
                for (oi = optind; oi < argc; oi++) {
                        if ((ifp = find_interface(argv[oi])) == NULL)
                                continue;
-                       if (do_release)
+                       if (do_release) {
                                ifp->options->options |= DHCPCD_RELEASE;
+                               ifp->options->options &= ~DHCPCD_PERSISTENT;
+                       }
                        ifp->options->options |= DHCPCD_EXITING;
                        stop_interface(ifp);
                }