summaryrefslogtreecommitdiffstats
path: root/ipv6nd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-09-27 10:17:39 +0000
committerRoy Marples <roy@marples.name>2016-09-27 10:17:39 +0000
commit6a765a4ffd2229ccca9d5b9972c618a72ead9eaf (patch)
tree7d591e6c4387d3bd1d6a58a9147c48a0f13518a2 /ipv6nd.c
parent44d5340730cedaa4d1901c2e4ea9669cdedea945 (diff)
downloaddhcpcd-6a765a4ffd2229ccca9d5b9972c618a72ead9eaf.tar.xz
Allow DHCPv6 support to be compiled out.
Diffstat (limited to 'ipv6nd.c')
-rw-r--r--ipv6nd.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/ipv6nd.c b/ipv6nd.c
index 11415c1f..103b332f 100644
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -712,6 +712,19 @@ try_script:
}
}
+#ifndef DHCP6
+/* If DHCPv6 is compiled out, supply a shim to provide an error message
+ * if IPv6RA requests DHCPv6. */
+#undef dhcp6_start
+static int
+dhcp6_start(__unused struct interface *ifp, __unused enum DH6S init_state)
+{
+
+ errno = ENOTSUP;
+ return -1;
+}
+#endif
+
static void
ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp,
struct icmp6_hdr *icp, size_t len, int hoplimit)
@@ -1102,13 +1115,19 @@ ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp,
handle_flag:
if (!(ifp->options->options & DHCPCD_DHCP6))
goto nodhcp6;
+/* Only log a DHCPv6 start error if compiled in or debugging is enabled. */
+#ifdef DHCP6
+#define LOG_DHCP6 LOG_ERR
+#else
+#define LOG_DHCP6 LOG_DEBUG
+#endif
if (rap->flags & ND_RA_FLAG_MANAGED) {
if (new_data && dhcp6_start(ifp, DH6S_INIT) == -1)
- logger(ifp->ctx, LOG_ERR,
+ logger(ifp->ctx, LOG_DHCP6,
"dhcp6_start: %s: %m", ifp->name);
} else if (rap->flags & ND_RA_FLAG_OTHER) {
if (new_data && dhcp6_start(ifp, DH6S_INFORM) == -1)
- logger(ifp->ctx, LOG_ERR,
+ logger(ifp->ctx, LOG_DHCP6,
"dhcp6_start: %s: %m", ifp->name);
} else {
if (new_data)