* this.
*/
if (ifp->options &&
- ifp->options->options & (DHCPCD_STOPPING | DHCPCD_RELEASE))
+ ifp->options->options & (DHCPCD_STOPPING | DHCPCD_RELEASE) &&
+ (ifp->options->options & (DHCPCD_EXITING | DHCPCD_PERSISTENT)) !=
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT))
dhcp6_delete_delegates(ifp);
state = D6_STATE(ifp);
unlink(state->leasefile);
}
dhcp6_freedrop_addrs(ifp, drop, NULL);
- if (drop && state->new) {
+ if (drop && state->new &&
+ (ifp->options->options &
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT)) !=
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT))
+ {
if (reason == NULL)
reason = "STOP6";
script_runreason(ifp, reason);
break;
if (do_release)
ifp->options->options |= DHCPCD_RELEASE;
+ ifp->options->options |= DHCPCD_EXITING;
stop_interface(ifp);
}
exit(EXIT_FAILURE);
continue;
if (do_release)
ifp->options->options |= DHCPCD_RELEASE;
+ ifp->options->options |= DHCPCD_EXITING;
stop_interface(ifp);
}
return 0;
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 25, 2013
+.Dd August 25, 2013
.Dt DHCPCD.CONF 5 SMM
.Os
.Sh NAME
The DUID-LLT generated will be held in
.Pa @SYSCONFDIR@/dhcpcd.duid
and should not be copied to other hosts.
+.It Ic persistent
+.Nm dhcpcd
+normally de-configures the interface and configuration when it exits.
+Sometimes, this isn't desirable if, for example, you have root mounted over
+NFS.
+You can use this option to stop this from happening.
.It Ic fallback Ar profile
Fallback to using this profile if DHCP fails.
This allows you to configure a static profile instead of using ZeroConf.
#define DHCPCD_STOPPING (1ULL << 41)
#define DHCPCD_DEPARTED (1ULL << 42)
#define DHCPCD_HOSTNAME_SHORT (1ULL << 43)
+#define DHCPCD_EXITING (1ULL << 44)
extern const struct option cf_options[];
lease = &state->lease;
if (dhcp == NULL) {
- if (!(ifo->options & DHCPCD_PERSISTENT)) {
+ if ((ifo->options & (DHCPCD_EXITING | DHCPCD_PERSISTENT)) !=
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT))
+ {
ipv4_buildroutes();
if (state->addr.s_addr != 0)
delete_address(ifp);
* This is safe because the RA is removed from the list
* before we are called. */
if (drop && ap->flags & IPV6_AF_ADDED &&
- !ipv6nd_addrexists(ap) && !dhcp6_addrexists(ap))
+ !ipv6nd_addrexists(ap) && !dhcp6_addrexists(ap) &&
+ (ap->iface->options->options &
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT)) !=
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT))
{
syslog(LOG_INFO, "%s: deleting address %s",
ap->iface->name, ap->saddr);
/* no need to add it back to our routing table
* as we delete an exiting route when we add
* a new one */
- else
+ else if ((rt->iface->options->options &
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT)) !=
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT))
d_route(rt);
}
free(rt);
ipv6nd_drop_ra(rap);
}
ipv6_buildroutes();
- script_runreason(ifp, "ROUTERADVERT");
+ if ((ifp->options->options &
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT)) !=
+ (DHCPCD_EXITING | DHCPCD_PERSISTENT))
+ script_runreason(ifp, "ROUTERADVERT");
}
}
static void