Thanks to Sebastian Huber for the initial patch and testing.
return;
}
if (state->new->cookie != htonl(MAGIC_COOKIE)) {
+ /* Check if doing DHCP */
+ if (!(ifp->options->options & DHCPCD_DHCP))
+ return;
/* We should pretend to be at the end
* of the DHCP negotation cycle unless we rebooted */
if (state->interval != 0)
return;
}
- if (dhcp_open(ifp) == -1)
+ if (ifo->options & DHCPCD_DHCP && dhcp_open(ifp) == -1)
return;
if (ifo->options & DHCPCD_INFORM) {
}
}
}
+
+ if (!(ifo->options & DHCPCD_DHCP)) {
+ if (ifo->options & DHCPCD_IPV4LL) {
+ if (state->offer && state->offer->cookie != 0) {
+ free(state->offer);
+ state->offer = NULL;
+ }
+ ipv4ll_start(ifp);
+ }
+ return;
+ }
+
if (state->offer == NULL)
dhcp_discover(ifp);
- else if (state->offer->cookie == 0 &&
- ifp->options->options & DHCPCD_IPV4LL)
+ else if (state->offer->cookie == 0 && ifo->options & DHCPCD_IPV4LL)
ipv4ll_start(ifp);
else
dhcp_reboot(ifp);
return 0;
}
+ if (!(ifp->options->options & DHCPCD_DHCP6))
+ return 0;
+
if (sock == -1 && dhcp6_open() == -1)
return -1;
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 24, 2014
+.Dd January 29, 2014
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
Don't load
.Pa /dev
management modules.
+.It Ic nodhcp
+Don't start DHCP or listen to DHCP messages.
+This is only useful when allowing IPv4LL.
+.It Ic nodhcp6
+Don't start DHCPv6 or listen to DHCPv6 messages.
+Normally DHCPv6 is started by a RA instruction or configuration.
.It Ic nogateway
Don't install any default routes.
.It Ic nohook Ar script
#define O_AUTHPROTOCOL O_BASE + 25
#define O_AUTHTOKEN O_BASE + 26
#define O_AUTHNOTREQUIRED O_BASE + 27
+#define O_NODHCP O_BASE + 28
+#define O_NODHCP6 O_BASE + 29
char *dev_load;
{"authprotocol", required_argument, NULL, O_AUTHPROTOCOL},
{"authtoken", required_argument, NULL, O_AUTHTOKEN},
{"noauthrequired", no_argument, NULL, O_AUTHNOTREQUIRED},
+ {"nodhcp", no_argument, NULL, O_NODHCP},
+ {"nodhcp6", no_argument, NULL, O_NODHCP6},
{NULL, 0, NULL, '\0'}
};
case O_AUTHNOTREQUIRED:
ifo->auth.options &= ~DHCPCD_AUTH_REQUIRE;
break;
+ case O_NODHCP:
+ ifo->options &= ~DHCPCD_DHCP;
+ break;
+ case O_NODHCP6:
+ ifo->options &= ~DHCPCD_DHCP6;
+ break;
default:
return 0;
}
ifo->options |= DHCPCD_DEV;
#endif
#ifdef INET
- ifo->options |= DHCPCD_IPV4 | DHCPCD_IPV4LL;
+ ifo->options |= DHCPCD_IPV4 | DHCPCD_DHCP | DHCPCD_IPV4LL;
ifo->options |= DHCPCD_GATEWAY | DHCPCD_ARP;
#endif
#ifdef INET6
ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS | DHCPCD_IPV6RA_REQRDNSS;
+ ifo->options |= DHCPCD_DHCP6;
ifo->dadtransmits = ipv6_dadtransmits(ifname);
#endif
ifo->timeout = DEFAULT_TIMEOUT;
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2013 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2014 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
#define DHCPCD_WAITIP6 (1ULL << 46)
#define DHCPCD_DEV (1ULL << 47)
#define DHCPCD_IAID (1ULL << 48)
+#define DHCPCD_DHCP (1ULL << 49)
+#define DHCPCD_DHCP6 (1ULL << 50)
extern const struct option cf_options[];
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2013 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2014 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
if (++state->conflicts > MAX_CONFLICTS) {
syslog(LOG_ERR, "%s: failed to acquire an IPv4LL address",
ifp->name);
- state->interval = RATE_LIMIT_INTERVAL / 2;
- dhcp_discover(ifp);
+ if (ifp->options->options & DHCPCD_DHCP) {
+ state->interval = RATE_LIMIT_INTERVAL / 2;
+ dhcp_discover(ifp);
+ } else
+ eloop_add_timeout_sec(RATE_LIMIT_INTERVAL,
+ ipv4ll_start, ifp);
} else {
eloop_timeout_add_sec(PROBE_WAIT, ipv4ll_start, ifp);
}