dhcpcd can also be made smaller by removing the IPv4 or IPv6 stack:
* --disable-inet
* --disable-inet6
-Or by removing the following features
+Or by removing the following features:
* --disable-auth
* --disable-ipv4ll
+ * --disable-dhcp6
You can also move the embedded extended configuration from the dhcpcd binary
to an external file (LIBEXECDIR/dhcpcd-definitions.conf)
--enable-ipv4ll) IPV4LL=yes; INET=yes;;
--disable-ipv6) INET6=no;;
--enable-ipv6) INET6=yes;;
+ --disable-dhcp6) DHCP6=no;;
+ --enable-dhcp6) DHCP6=yes;;
--disable-embedded) EMBEDDED=no;;
--enable-embedded) EMBEDDED=yes;;
--disable-auth) AUTH=no;;
esac
if [ -z "$INET" -o "$INET" = yes ]; then
+ echo "Enabling INET support"
echo "CPPFLAGS+= -DINET" >>$CONFIG_MK
echo "DHCPCD_SRCS+= arp.c dhcp.c ipv4.c" >>$CONFIG_MK
fi
if [ -z "$IPV4LL" -o "$IPV4LL" = yes ]; then
+ echo "Enabling IPv4LL support"
echo "CPPFLAGS+= -DIPV4LL" >>$CONFIG_MK
echo "DHCPCD_SRCS+= ipv4ll.c" >>$CONFIG_MK
fi
if [ -z "$INET6" -o "$INET6" = yes ]; then
+ echo "Enabling INET6 support"
echo "CPPFLAGS+= -DINET6" >>$CONFIG_MK
- echo "DHCPCD_SRCS+= ipv6.c ipv6nd.c dhcp6.c" >>$CONFIG_MK
+ echo "DHCPCD_SRCS+= ipv6.c ipv6nd.c" >>$CONFIG_MK
+fi
+if [ -z "$DHCP6" -o "$DHCP6" = yes ]; then
+ echo "Enabling DHCPv6 support"
+ echo "CPPFLAGS+= -DDHCP6" >>$CONFIG_MK
+ echo "DHCPCD_SRCS+= dhcp6.c" >>$CONFIG_MK
+fi
+if [ -z "$AUTH" -o "$AUTH" = yes ]; then
+ echo "Enabling Authentiaction"
+ echo "CPPFLAGS+= -DAUTH" >>$CONFIG_MK
+ echo "AUTH_SRCS= auth.c crypt/hmac_md5.c" >>$CONFIG_MK
+ echo "AUTH_SRCS+= \${MD5_SRC} \${SHA256_SRC}" >>$CONFIG_MK
fi
echo "Using compiler .. $CC"
echo "EMBEDDEDINSTALL= _embeddedinstall" >>$CONFIG_MK
fi
-if [ -z "$AUTH" -o "$AUTH" = yes ]; then
- echo "Enabling Authentiaction"
- echo "CPPFLAGS+= -DAUTH" >>$CONFIG_MK
- echo "AUTH_SRCS= auth.c crypt/hmac_md5.c" >>$CONFIG_MK
- echo "AUTH_SRCS+= \${MD5_SRC} \${SHA256_SRC}" >>$CONFIG_MK
-fi
-
if [ "$OS" = linux ]; then
printf "Testing for nl80211 ... "
cat <<EOF >_nl80211.c
#define IPV6_RECVPKTINFO IPV6_PKTINFO
#endif
+#ifdef DHCP6
struct dhcp6_op {
uint16_t type;
const char *name;
state->reason = "DUMP6";
return script_runreason(ifp, state->reason);
}
+#endif
#define D6_COPTION_DATA(o) \
((const uint8_t *)(o) + sizeof(struct dhcp6_option))
-#ifdef INET6
+#ifdef DHCP6
void dhcp6_printoptions(const struct dhcpcd_ctx *,
const struct dhcp_opt *, size_t);
const struct ipv6_addr *dhcp6_iffindaddr(const struct interface *ifp,
void dhcp6_dropnondelegates(struct interface *ifp);
int dhcp6_dump(struct interface *);
#else
+#define dhcp6_printoptions(a, b, c) {}
+#define dhcp6_iffindaddr(a, b, c) (NULL)
+#define dhcp6_findaddr(a, b, c) (NULL)
#define dhcp6_find_delegates(a) {}
#define dhcp6_start(a, b) (0)
#define dhcp6_reboot(a) {}
#define dhcp6_renew(a) {}
-#define dhcp6_env(a, b, c, d, e) {}
+#define dhcp6_env(a, b, c, d, e) (0)
#define dhcp6_free(a) {}
+#define dhcp6_handleifa(a, b) {}
#define dhcp6_dadcompleted(a) (0)
#define dhcp6_drop(a, b) {}
+#define dhcp6_dropnondelegates(a) {}
#define dhcp6_dump(a) (-1)
#endif
}
}
+#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)
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)