changeset 2160:61f868a469f2 draft

When releasing, we need to de-configure the interface as well.
author Roy Marples <roy@marples.name>
date Wed, 20 Nov 2013 11:37:25 +0000
parents 240670669be0
children 52f705b19a29
files dhcpcd.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.c	Tue Nov 19 09:43:54 2013 +0000
+++ b/dhcpcd.c	Wed Nov 20 11:37:25 2013 +0000
@@ -325,6 +325,11 @@
 	/* 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 @@
 		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 @@
 		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);
 		}