summaryrefslogtreecommitdiff
path: root/net-misc/dhcp/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-misc/dhcp/files
reinit the tree, so we can have metadata
Diffstat (limited to 'net-misc/dhcp/files')
-rw-r--r--net-misc/dhcp/files/dhcp-3.0-fix-perms.patch15
-rw-r--r--net-misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch70
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch14
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch14
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch113
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch46
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.4-always-accept-4.patch29
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.4-quieter-ping.patch72
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.5-bindtodevice-inet6.patch19
-rw-r--r--net-misc/dhcp/files/dhcp-4.2.5-iproute2-path.patch15
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.1-dhclient-resolvconf.patch411
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.3-ldap-ipv6-client-id.patch81
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.4-bind-disable.patch38
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.4-dhclient-ntp.patch209
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.6-dhclient-ntp.patch210
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.6-dhclient-resolvconf.patch422
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.6-iproute2-path.patch11
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.6-lmdb-removal.patch12
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.6-nogateway.patch66
-rw-r--r--net-misc/dhcp/files/dhcp-4.3.6-quieter-ping.patch66
-rw-r--r--net-misc/dhcp/files/dhcpd.conf228
-rw-r--r--net-misc/dhcp/files/dhcpd.init5119
-rw-r--r--net-misc/dhcp/files/dhcpd.tmpfiles2
-rw-r--r--net-misc/dhcp/files/dhcpd4.service11
-rw-r--r--net-misc/dhcp/files/dhcpd6.service11
-rw-r--r--net-misc/dhcp/files/dhcrelay.conf16
-rw-r--r--net-misc/dhcp/files/dhcrelay.init333
-rw-r--r--net-misc/dhcp/files/dhcrelay4.service10
-rw-r--r--net-misc/dhcp/files/dhcrelay4.service.conf3
-rw-r--r--net-misc/dhcp/files/dhcrelay6.conf8
-rw-r--r--net-misc/dhcp/files/dhcrelay6.service10
-rw-r--r--net-misc/dhcp/files/dhcrelay6.service.conf6
32 files changed, 2190 insertions, 0 deletions
diff --git a/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch b/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch
new file mode 100644
index 000000000000..f4b3fd18e167
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch
@@ -0,0 +1,15 @@
+--- a/server/dhcpd.c
++++ b/server/dhcpd.c
+@@ -602,6 +602,12 @@
+ if (lftest)
+ exit (0);
+
++#if defined (PARANOIA)
++ /* Set proper permissions... */
++ if (lchown (path_dhcpd_db, set_uid, set_gid))
++ log_fatal ("lchown(%s, %d, %d): %m", path_dhcpd_db, (int) set_uid, (int) set_gid);
++#endif /* PARANOIA */
++
+ /* Discover all the network interfaces and initialize them. */
+ discover_interfaces (DISCOVER_SERVER);
+
diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch
new file mode 100644
index 000000000000..3a3b956e3616
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch
@@ -0,0 +1,70 @@
+--- a/client/scripts/linux
++++ b/client/scripts/linux
+@@ -118,9 +118,9 @@
+ if [ x$reason = xPREINIT ]; then
+ if [ x$alias_ip_address != x ]; then
+ # Bring down alias interface. Its routes will disappear too.
+- ifconfig $interface:0- inet 0
++ ifconfig $interface:0- inet 0.0.0.0
+ fi
+- ifconfig $interface 0 up
++ ifconfig $interface 0.0.0.0 up
+
+ # We need to give the kernel some time to get the interface up.
+ sleep 1
+@@ -145,12 +145,12 @@
+ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
+ [ x$alias_ip_address != x$old_ip_address ]; then
+ # Possible new alias. Remove old alias.
+- ifconfig $interface:0- inet 0
++ ifconfig $interface:0- inet 0.0.0.0
+ fi
+ if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
+ # IP address changed. Bringing down the interface will delete all routes,
+ # and clear the ARP cache.
+- ifconfig $interface inet 0 down
++ ifconfig $interface inet 0.0.0.0
+
+ fi
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+@@ -171,7 +171,7 @@
+ fi
+ if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
+ then
+- ifconfig $interface:0- inet 0
++ ifconfig $interface:0- inet 0.0.0.0
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+ route add -host $alias_ip_address $interface:0
+ fi
+@@ -183,11 +183,11 @@
+ || [ x$reason = xSTOP ]; then
+ if [ x$alias_ip_address != x ]; then
+ # Turn off alias interface.
+- ifconfig $interface:0- inet 0
++ ifconfig $interface:0- inet 0.0.0.0
+ fi
+ if [ x$old_ip_address != x ]; then
+ # Shut down interface, which will delete routes and clear arp cache.
+- ifconfig $interface inet 0 down
++ ifconfig $interface inet 0.0.0.0
+ fi
+ if [ x$alias_ip_address != x ]; then
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+@@ -198,7 +198,7 @@
+
+ if [ x$reason = xTIMEOUT ]; then
+ if [ x$alias_ip_address != x ]; then
+- ifconfig $interface:0- inet 0
++ ifconfig $interface:0- inet 0.0.0.0
+ fi
+ ifconfig $interface inet $new_ip_address $new_subnet_arg \
+ $new_broadcast_arg $mtu_arg
+@@ -223,7 +223,7 @@
+ make_resolv_conf
+ exit_with_hooks 0
+ fi
+- ifconfig $interface inet 0 down
++ ifconfig $interface inet 0.0.0.0
+ exit_with_hooks 1
+ fi
+
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch
new file mode 100644
index 000000000000..ae33638284b8
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch
@@ -0,0 +1,14 @@
+bind sets up BUILD_XXX vars for building native tools, but then
+doesn't use them for the "gen" tool
+
+--- a/bind/lib/export/dns/Makefile.in
++++ b/bind/lib/export/dns/Makefile.in
+@@ -166,7 +166,7 @@
+ ./gen -s ${srcdir} > code.h
+
+ gen: ${srcdir}/gen.c
+- ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS}
++ ${BUILD_CC} ${BUILD_CFLAGS} ${CINCLUDES} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c ${BUILD_LIBS}
+
+ #We don't need rbtdb64 for this library
+ #rbtdb64.@O@: rbtdb.c
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch
new file mode 100644
index 000000000000..6136154f65a0
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch
@@ -0,0 +1,14 @@
+fix the bind subdir parallel builds
+
+https://bugs.gentoo.org/380717
+
+--- a/bind/lib/export/isc/Makefile.in
++++ b/bind/lib/export/isc/Makefile.in
+@@ -114,6 +114,7 @@
+ -DLIBAGE=${LIBAGE} \
+ -c ${srcdir}/version.c
+
++${OBJS}: | subdirs
+ libisc.@SA@: ${OBJS}
+ ${AR} ${ARFLAGS} $@ ${OBJS}
+ ${RANLIB} $@
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
new file mode 100644
index 000000000000..bf5a54c32153
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
@@ -0,0 +1,113 @@
+--- dhcp-4.2.2/client/clparse.c
++++ dhcp-4.2.2/client/clparse.c
+@@ -182,6 +182,10 @@ isc_result_t read_client_conf ()
+ #endif
+ }
+
++ /* Read any extra configuration from stdin */
++ extern int read_client_conf_stdin (struct interface_info *ip, struct client_config *client);
++ read_client_conf_stdin (NULL, &top_level_config);
++
+ /* Set up state and config structures for clients that don't
+ have per-interface configuration statements. */
+ config = (struct client_config *)0;
+@@ -211,23 +215,13 @@ isc_result_t read_client_conf ()
+ return status;
+ }
+
+-int read_client_conf_file (const char *name, struct interface_info *ip,
++int read_client_conf_actual (struct parse *cfile, struct interface_info *ip,
+ struct client_config *client)
+ {
+- int file;
+- struct parse *cfile;
+ const char *val;
+ int token;
+ isc_result_t status;
+
+- if ((file = open (name, O_RDONLY)) < 0)
+- return uerr2isc (errno);
+-
+- cfile = NULL;
+- status = new_parse(&cfile, file, NULL, 0, path_dhclient_conf, 0);
+- if (status != ISC_R_SUCCESS || cfile == NULL)
+- return status;
+-
+ do {
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == END_OF_FILE)
+@@ -238,10 +232,74 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
+ status = (cfile -> warnings_occurred
+ ? DHCP_R_BADPARSE
+ : ISC_R_SUCCESS);
++ return status;
++}
++
++int read_client_conf_file (const char *name, struct interface_info *ip,
++ struct client_config *client)
++{
++ int file;
++ struct parse *cfile;
++ isc_result_t status;
++
++ if ((file = open (name, O_RDONLY)) < 0)
++ return uerr2isc (errno);
++
++ cfile = (struct parse *)0;
++ new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
++ status = read_client_conf_actual(cfile, ip, client);
+ end_parse (&cfile);
+ return status;
+ }
+
++int read_client_conf_stdin (struct interface_info *ip,
++ struct client_config *client)
++{
++ int file;
++ char *buffer = NULL, *p;
++ unsigned buflen, len = 0;
++ struct parse *cfile;
++ size_t bytes;
++ isc_result_t status;
++
++ file = fileno(stdin);
++ if (isatty (file))
++ return ISC_R_NOTFOUND;
++ if (fcntl (file, F_SETFL, O_NONBLOCK) < 0)
++ log_fatal ("could not set stdin to non blocking!");
++
++ buflen = BUFSIZ;
++ buffer = malloc (BUFSIZ + 1);
++ p = buffer;
++ do {
++ bytes = read (file, p, BUFSIZ);
++ if (bytes == 0)
++ break;
++ if (bytes == -1)
++ log_fatal ("failed to read stdin!");
++ if (bytes >= BUFSIZ) {
++ buflen += BUFSIZ;
++ len += BUFSIZ;
++ buffer = realloc (buffer, buflen + 1);
++ if (!buffer)
++ log_fatal ("not enough buffer to read stdin!");
++ p = buffer + len;
++ } else {
++ len += bytes;
++ break;
++ }
++ } while(1);
++ buffer[len] = '\0';
++
++ cfile = (struct parse *)0;
++ status = new_parse (&cfile, -1, buffer, len, "stdin", 0);
++ if (status == ISC_R_SUCCESS) {
++ status = read_client_conf_actual (cfile, ip, client);
++ end_parse (&cfile);
++ }
++ free(buffer);
++ return status;
++}
+
+ /* lease-file :== client-lease-statements END_OF_FILE
+ client-lease-statements :== <nil>
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch b/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch
new file mode 100644
index 000000000000..27fb2b0e6025
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch
@@ -0,0 +1,46 @@
+http://bugs.gentoo.org/265531
+
+--- dhcp-4.2.2/client/scripts/linux
++++ dhcp-4.2.2/client/scripts/linux
+@@ -193,12 +193,14 @@
+ ifconfig $interface inet $new_ip_address $new_subnet_arg \
+ $new_broadcast_arg $mtu_arg
+ # Add a network route to the computed network address.
+- for router in $new_routers; do
+- if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+- route add -host $router dev $interface
+- fi
+- route add default gw $router $metric_arg dev $interface
+- done
++ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
++ for router in $new_routers; do
++ if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
++ route add -host $router dev $interface
++ fi
++ route add default gw $router $metric_arg dev $interface
++ done
++ fi
+ else
+ # we haven't changed the address, have we changed other options
+ # that we wish to update?
+@@ -244,12 +246,14 @@
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+ route add -host $alias_ip_address dev $interface:0
+ fi
+- for router in $new_routers; do
+- if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+- route add -host $router dev $interface
+- fi
+- route add default gw $router $metric_arg dev $interface
+- done
++ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
++ for router in $new_routers; do
++ if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
++ route add -host $router dev $interface
++ fi
++ route add default gw $router $metric_arg dev $interface
++ done
++ fi
+ make_resolv_conf
+ exit_with_hooks 0
+ fi
diff --git a/net-misc/dhcp/files/dhcp-4.2.4-always-accept-4.patch b/net-misc/dhcp/files/dhcp-4.2.4-always-accept-4.patch
new file mode 100644
index 000000000000..6cec86c9d9c4
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.4-always-accept-4.patch
@@ -0,0 +1,29 @@
+https://bugs.gentoo.org/437108
+
+always accept the -4 option even if we don't have IPv6 support enabled.
+the relay code does this already.
+
+--- a/client/dhclient.c
++++ b/client/dhclient.c
+@@ -170,8 +170,8 @@ main(int argc, char **argv) {
+ if (!strcmp(argv[i], "-r")) {
+ release_mode = 1;
+ no_daemon = 1;
+-#ifdef DHCPv6
+ } else if (!strcmp(argv[i], "-4")) {
++#ifdef DHCPv6
+ if (local_family_set && local_family != AF_INET)
+ log_fatal("Client can only do v4 or v6, not "
+ "both.");
+--- a/server/dhcpd.c
++++ b/server/dhcpd.c
+@@ -373,8 +373,8 @@ main(int argc, char **argv) {
+ } else if (!strcmp (argv [i], "-q")) {
+ quiet = 1;
+ quiet_interface_discovery = 1;
+-#ifdef DHCPv6
+ } else if (!strcmp(argv[i], "-4")) {
++#ifdef DHCPv6
+ if (local_family_set && (local_family != AF_INET)) {
+ log_fatal("Server cannot run in both IPv4 and "
+ "IPv6 mode at the same time.");
diff --git a/net-misc/dhcp/files/dhcp-4.2.4-quieter-ping.patch b/net-misc/dhcp/files/dhcp-4.2.4-quieter-ping.patch
new file mode 100644
index 000000000000..66a1fcd79461
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.4-quieter-ping.patch
@@ -0,0 +1,72 @@
+https://bugs.gentoo.org/296921
+
+`ping -q` will still print out summary information. send that to /dev/null.
+
+patch by Martin Mokrejš
+
+--- a/client/scripts/bsdos
++++ b/client/scripts/bsdos
+@@ -251,7 +251,7 @@ if [ x$reason = xTIMEOUT ]; then
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+- if ping -q -c 1 -w 1 $1; then
++ if ping -q -c 1 -w 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- a/client/scripts/freebsd
++++ b/client/scripts/freebsd
+@@ -284,7 +284,7 @@ if [ x$reason = xTIMEOUT ]; then
+ if [ -n "$new_routers" ]; then
+ $LOGGER "New Routers: $new_routers"
+ set -- $new_routers
+- if ping -q -c 1 $1; then
++ if ping -q -c 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- a/client/scripts/linux
++++ b/client/scripts/linux
+@@ -253,7 +253,7 @@ if [ x$reason = xTIMEOUT ]; then
+ ifconfig $interface inet $new_ip_address $new_subnet_arg \
+ $new_broadcast_arg $mtu_arg
+ set $new_routers
+- if ping -q -c 1 $1; then
++ if ping -q -c 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+--- a/client/scripts/netbsd
++++ b/client/scripts/netbsd
+@@ -251,7 +251,7 @@ if [ x$reason = xTIMEOUT ]; then
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+- if ping -q -c 1 -w 1 $1; then
++ if ping -q -c 1 -w 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- a/client/scripts/openbsd
++++ b/client/scripts/openbsd
+@@ -245,7 +245,7 @@ if [ x$reason = xTIMEOUT ]; then
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+- if ping -q -c 1 -w 1 $1; then
++ if ping -q -c 1 -w 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- a/client/scripts/openwrt
++++ b/client/scripts/openwrt
+@@ -186,7 +186,7 @@ if [ x$reason = xTIMEOUT ]; then
+ ifconfig $interface $new_ip_address $new_subnet_arg \
+ $new_broadcast_arg $mtu_arg $metric_arg
+ set $new_routers
+- if ping -q -c 1 $1; then
++ if ping -q -c 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface:0 $alias_ip_address $alias_subnet_arg
diff --git a/net-misc/dhcp/files/dhcp-4.2.5-bindtodevice-inet6.patch b/net-misc/dhcp/files/dhcp-4.2.5-bindtodevice-inet6.patch
new file mode 100644
index 000000000000..77254c32e2b0
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.5-bindtodevice-inet6.patch
@@ -0,0 +1,19 @@
+https://bugs.gentoo.org/471142
+
+snipped from fedora
+
+# dhclient -6: bind socket to interface (#1001742)
+# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #34784])
+
+diff -up dhcp-4.2.5/common/socket.c.bindtodevice_inet6 dhcp-4.2.5/common/socket.c
+--- dhcp-4.2.5/common/socket.c.bindtodevice_inet6 2013-09-17 16:47:05.000000000 +0200
++++ dhcp-4.2.5/common/socket.c 2013-09-17 16:48:18.975997842 +0200
+@@ -245,7 +245,7 @@ if_register_socket(struct interface_info
+
+ #if defined(SO_BINDTODEVICE)
+ /* Bind this socket to this interface. */
+- if ((local_family != AF_INET6) && (info->ifp != NULL) &&
++ if (((do_multicast == 0)||(*do_multicast == 0)) && (info->ifp != NULL) &&
+ setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE,
+ (char *)(info -> ifp), sizeof(*(info -> ifp))) < 0) {
+ log_fatal("setsockopt: SO_BINDTODEVICE: %m");
diff --git a/net-misc/dhcp/files/dhcp-4.2.5-iproute2-path.patch b/net-misc/dhcp/files/dhcp-4.2.5-iproute2-path.patch
new file mode 100644
index 000000000000..ea223ed38b6e
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.5-iproute2-path.patch
@@ -0,0 +1,15 @@
+find `ip` via $PATH and not hardcoded path
+
+https://bugs.gentoo.org/480636
+
+--- a/client/scripts/linux
++++ b/client/scripts/linux
+@@ -23,7 +23,7 @@
+ # of the $1 in its args.
+
+ # 'ip' just looks too weird. /sbin/ip looks less weird.
+-ip=/sbin/ip
++ip=ip
+
+ make_resolv_conf() {
+ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
diff --git a/net-misc/dhcp/files/dhcp-4.3.1-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-4.3.1-dhclient-resolvconf.patch
new file mode 100644
index 000000000000..71d3f2c69dc5
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.1-dhclient-resolvconf.patch
@@ -0,0 +1,411 @@
+resolvconf support in dhclient-script
+
+--- a/client/scripts/bsdos
++++ b/client/scripts/bsdos
+@@ -1,40 +1,46 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+ if [ "x$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_search}\n"
+ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >> /etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
+--- a/client/scripts/freebsd
++++ b/client/scripts/freebsd
+@@ -11,73 +11,45 @@
+ fi
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- ( cat /dev/null > /etc/resolv.conf.dhclient )
+- exit_status=$?
+- if [ $exit_status -ne 0 ]; then
+- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
+- else
+- if [ "x$new_domain_search" != x ]; then
+- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
+- exit_status=$?
+- elif [ "x$new_domain_name" != x ]; then
+- # Note that the DHCP 'Domain Name Option' is really just a domain
+- # name, and that this practice of using the domain name option as
+- # a search path is both nonstandard and deprecated.
+- ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
+- exit_status=$?
+- fi
+- for nameserver in $new_domain_name_servers; do
+- if [ $exit_status -ne 0 ]; then
+- break
+- fi
+- ( echo nameserver $nameserver >>/etc/resolv.conf.dhclient )
+- exit_status=$?
+- done
+-
+- # If there were no errors, attempt to mv the new file into place.
+- if [ $exit_status -eq 0 ]; then
+- ( mv /etc/resolv.conf.dhclient /etc/resolv.conf )
+- exit_status=$?
+- fi
+-
+- if [ $exit_status -ne 0 ]; then
+- $LOGGER "Error while writing new /etc/resolv.conf."
+- fi
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
++ # Note that the DHCP 'Domain Name Option' is really just a domain
++ # name, and that this practice of using the domain name option as
++ # a search path is both nonstandard and deprecated.
++ conf="${conf}search ${new_domain_name}\n"
+ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${conf}nameserver ${nameserver}\n"
++ done
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- ( cat /dev/null > /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- if [ $exit_status -ne 0 ] ; then
+- $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
+- else
+- if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- fi
+- for nameserver in ${new_dhcp6_name_servers} ; do
+- if [ $exit_status -ne 0 ] ; then
+- break
+- fi
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- ( echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- done
+-
+- if [ $exit_status -eq 0 ] ; then
+- ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
+- exit_status=$?
+- fi
++ if [ "x${new_dhcp6_domain_search}" != x ] ; then
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
++ fi
++ for nameserver in ${new_dhcp6_name_servers} ; do
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
++ done
++ fi
+
+- if [ $exit_status -ne 0 ] ; then
+- $LOGGER "Error while writing new /etc/resolv.conf."
+- fi
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
+ fi
+ fi
+ }
+--- a/client/scripts/linux
++++ b/client/scripts/linux
+@@ -26,44 +26,49 @@
+ ip=/sbin/ip
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- chmod 644 /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ shopt -s nocasematch
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ if [[ "$nameserver" =~ ^fe80:: ]]
+ then
+ zone_id="%$interface"
+ else
+ zone_id=
+ fi
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
+ shopt -u nocasematch
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
+--- a/client/scripts/netbsd
++++ b/client/scripts/netbsd
+@@ -1,40 +1,46 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
+- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ "x$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ "x$new_domain_name" != x ]; then
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
++ if [ x"$new_domain_name_servers" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
+--- a/client/scripts/openbsd
++++ b/client/scripts/openbsd
+@@ -1,40 +1,46 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
+- if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
++ if [ x"$new_domain_name_servers" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
+--- a/client/scripts/solaris
++++ b/client/scripts/solaris
+@@ -1,21 +1,39 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
++ done
++ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
++ if [ "x${new_dhcp6_domain_search}" != x ] ; then
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
++ fi
++ for nameserver in ${new_dhcp6_name_servers} ; do
++ conf="${conf}nameserver ${nameserver}\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
diff --git a/net-misc/dhcp/files/dhcp-4.3.3-ldap-ipv6-client-id.patch b/net-misc/dhcp/files/dhcp-4.3.3-ldap-ipv6-client-id.patch
new file mode 100644
index 000000000000..2a7f8183d4e0
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.3-ldap-ipv6-client-id.patch
@@ -0,0 +1,81 @@
+https://bugs.gentoo.org/559832
+
+the get_client_id func is used outside of IPv6 code, so don't store it in the
+IPv6-specific dhcpv6.c file. otherwise, building w/out IPv6 & w/ldap yields:
+dhcpd-ldap.o: In function 'find_client_in_ldap':
+ldap.c:(.text+0x4774): undefined reference to 'get_client_id'
+
+--- a/server/dhcpleasequery.c
++++ b/server/dhcpleasequery.c
+@@ -33,6 +33,34 @@
+ * DoS'ed by DHCPLEASEQUERY message.
+ */
+
++/*
++ * Get the client identifier from the packet.
++ */
++isc_result_t
++get_client_id(struct packet *packet, struct data_string *client_id) {
++ struct option_cache *oc;
++
++ /*
++ * Verify our client_id structure is empty.
++ */
++ if ((client_id->data != NULL) || (client_id->len != 0)) {
++ return DHCP_R_INVALIDARG;
++ }
++
++ oc = lookup_option(&dhcpv6_universe, packet->options, D6O_CLIENTID);
++ if (oc == NULL) {
++ return ISC_R_NOTFOUND;
++ }
++
++ if (!evaluate_option_cache(client_id, packet, NULL, NULL,
++ packet->options, NULL,
++ &global_scope, oc, MDL)) {
++ return ISC_R_FAILURE;
++ }
++
++ return ISC_R_SUCCESS;
++}
++
+ /*
+ * If you query by hardware address or by client ID, then you may have
+ * more than one IP address for your query argument. We need to do two
+--- a/server/dhcpv6.c
++++ b/server/dhcpv6.c
+@@ -392,34 +392,6 @@ generate_new_server_duid(void) {
+ }
+
+ /*
+- * Get the client identifier from the packet.
+- */
+-isc_result_t
+-get_client_id(struct packet *packet, struct data_string *client_id) {
+- struct option_cache *oc;
+-
+- /*
+- * Verify our client_id structure is empty.
+- */
+- if ((client_id->data != NULL) || (client_id->len != 0)) {
+- return DHCP_R_INVALIDARG;
+- }
+-
+- oc = lookup_option(&dhcpv6_universe, packet->options, D6O_CLIENTID);
+- if (oc == NULL) {
+- return ISC_R_NOTFOUND;
+- }
+-
+- if (!evaluate_option_cache(client_id, packet, NULL, NULL,
+- packet->options, NULL,
+- &global_scope, oc, MDL)) {
+- return ISC_R_FAILURE;
+- }
+-
+- return ISC_R_SUCCESS;
+-}
+-
+-/*
+ * Message validation, defined in RFC 3315, sections 15.2, 15.5, 15.7:
+ *
+ * Servers MUST discard any Solicit messages that do not include a
diff --git a/net-misc/dhcp/files/dhcp-4.3.4-bind-disable.patch b/net-misc/dhcp/files/dhcp-4.3.4-bind-disable.patch
new file mode 100644
index 000000000000..be0c032ae763
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.4-bind-disable.patch
@@ -0,0 +1,38 @@
+--- dhcp-4.3.4/bind/Makefile.in
++++ dhcp-4.3.4/bind/Makefile.in
+@@ -40,6 +40,7 @@
+ @BIND_ATF_TRUE@all: bind1 atf bind2
+
+ bind1:
++disable:
+ # Extract the source from the tarball, if it hasn't been already.
+ @if test -d ${bindsrcdir} ; then \
+ echo ${bindsrcdir} already unpacked... ; \
+@@ -68,6 +69,7 @@
+ fi
+
+ atf:
++disable:
+ # Build and copy the ATF support if not yet installed.
+ @if test -d ./atf ; then \
+ echo ATF support already installed ; \
+@@ -82,6 +84,7 @@
+ @CROSS_COMPILING_TRUE@bind2: bind2-hostgen
+
+ bind2-noguest:
++disable:
+ # Build and install the export libraries
+ # No need to do anything if we already have something installed.
+ @if test -d ${binddir}/lib ; then \
+@@ -98,6 +101,7 @@
+ fi
+
+ bind2-hostgen:
++disable:
+ # Build and install the export libraries
+ # No need to do anything if we already have something installed.
+ @if test -d ${binddir}/lib ; then \
+--- dhcp-4.3.4/bind/test
++++ dhcp-4.3.4/bind/test
+@@ -0,0 +1 @@
++--disable-kqueue --disable-epoll --disable-devpoll --without-openssl --without-libxml2 --enable-exportlib --with-gssapi=no --enable-threads=no @BINDCONFIG@ --with-export-includedir=${binddir}/include --with-export-libdir=${binddir}/lib
diff --git a/net-misc/dhcp/files/dhcp-4.3.4-dhclient-ntp.patch b/net-misc/dhcp/files/dhcp-4.3.4-dhclient-ntp.patch
new file mode 100644
index 000000000000..207631710e75
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.4-dhclient-ntp.patch
@@ -0,0 +1,209 @@
+--- dhcp-4.3.4/client/clparse.c
++++ dhcp-4.3.4/client/clparse.c
+@@ -31,7 +31,7 @@
+
+ struct client_config top_level_config;
+
+-#define NUM_DEFAULT_REQUESTED_OPTS 9
++#define NUM_DEFAULT_REQUESTED_OPTS 10
+ /* There can be 2 extra requested options for DHCPv4-over-DHCPv6. */
+ struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 2 + 1];
+
+@@ -107,15 +107,20 @@
+ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 8 */
+- code = D6O_NAME_SERVERS;
++ code = DHO_NTP_SERVERS;
+ option_code_hash_lookup(&default_requested_options[7],
+- dhcpv6_universe.code_hash, &code, 0, MDL);
++ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 9 */
+- code = D6O_DOMAIN_SEARCH;
++ code = D6O_NAME_SERVERS;
+ option_code_hash_lookup(&default_requested_options[8],
+ dhcpv6_universe.code_hash, &code, 0, MDL);
+
++ /* 10 */
++ code = D6O_DOMAIN_SEARCH;
++ option_code_hash_lookup(&default_requested_options[9],
++ dhcpv6_universe.code_hash, &code, 0, MDL);
++
+ for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
+ if (default_requested_options[code] == NULL)
+ log_fatal("Unable to find option definition for "
+--- dhcp-4.3.4/client/scripts/bsdos
++++ dhcp-4.3.4/client/scripts/bsdos
+@@ -36,6 +36,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ x$new_ntp_servers != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.4/client/scripts/freebsd
++++ dhcp-4.3.4/client/scripts/freebsd
+@@ -80,6 +80,26 @@
+ fi
+ fi
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.4/client/scripts/linux
++++ dhcp-4.3.4/client/scripts/linux
+@@ -65,6 +65,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.4/client/scripts/netbsd
++++ dhcp-4.3.4/client/scripts/netbsd
+@@ -36,6 +36,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.4/client/scripts/openbsd
++++ dhcp-4.3.4/client/scripts/openbsd
+@@ -36,6 +36,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.4/client/scripts/solaris
++++ dhcp-4.3.4/client/scripts/solaris
+@@ -17,6 +17,26 @@
+
+ mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
diff --git a/net-misc/dhcp/files/dhcp-4.3.6-dhclient-ntp.patch b/net-misc/dhcp/files/dhcp-4.3.6-dhclient-ntp.patch
new file mode 100644
index 000000000000..a504840dd5ab
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.6-dhclient-ntp.patch
@@ -0,0 +1,210 @@
+--- dhcp-4.3.6/client/clparse.c
++++ dhcp-4.3.6/client/clparse.c
+@@ -31,7 +31,7 @@
+
+ struct client_config top_level_config;
+
+-#define NUM_DEFAULT_REQUESTED_OPTS 9
++#define NUM_DEFAULT_REQUESTED_OPTS 10
+ /* There can be 2 extra requested options for DHCPv4-over-DHCPv6. */
+ struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 2 + 1];
+
+@@ -107,15 +107,20 @@
+ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 8 */
+- code = D6O_NAME_SERVERS;
++ code = DHO_NTP_SERVERS;
+ option_code_hash_lookup(&default_requested_options[7],
+- dhcpv6_universe.code_hash, &code, 0, MDL);
++ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 9 */
+- code = D6O_DOMAIN_SEARCH;
++ code = D6O_NAME_SERVERS;
+ option_code_hash_lookup(&default_requested_options[8],
+ dhcpv6_universe.code_hash, &code, 0, MDL);
+
++ /* 10 */
++ code = D6O_DOMAIN_SEARCH;
++ option_code_hash_lookup(&default_requested_options[9],
++ dhcpv6_universe.code_hash, &code, 0, MDL);
++
+ for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
+ if (default_requested_options[code] == NULL)
+ log_fatal("Unable to find option definition for "
+--- dhcp-4.3.6/client/scripts/bsdos
++++ dhcp-4.3.6/client/scripts/bsdos
+@@ -36,6 +36,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ x$new_ntp_servers != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.6/client/scripts/freebsd
++++ dhcp-4.3.6/client/scripts/freebsd
+@@ -80,6 +80,26 @@
+ fi
+ fi
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.6/client/scripts/linux
++++ dhcp-4.3.6/client/scripts/linux
+@@ -106,6 +106,27 @@
+ fi
+ mv -f $new_resolv_conf /etc/resolv.conf
+ fi
++
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # set host name
+--- dhcp-4.3.6/client/scripts/netbsd
++++ dhcp-4.3.6/client/scripts/netbsd
+@@ -36,6 +36,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.6/client/scripts/openbsd
++++ dhcp-4.3.6/client/scripts/openbsd
+@@ -36,6 +36,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- dhcp-4.3.6/client/scripts/solaris
++++ dhcp-4.3.6/client/scripts/solaris
+@@ -17,6 +17,26 @@
+
+ mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
diff --git a/net-misc/dhcp/files/dhcp-4.3.6-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-4.3.6-dhclient-resolvconf.patch
new file mode 100644
index 000000000000..ccfdbcf4a206
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.6-dhclient-resolvconf.patch
@@ -0,0 +1,422 @@
+--- dhcp-4.3.6/client/scripts/bsdos
++++ dhcp-4.3.6/client/scripts/bsdos
+@@ -1,27 +1,25 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+ if [ "x$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_search}\n"
+ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >> /etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ # If the nameserver has a link-local address
+@@ -31,10 +29,18 @@
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
+--- dhcp-4.3.6/client/scripts/freebsd
++++ dhcp-4.3.6/client/scripts/freebsd
+@@ -11,54 +11,23 @@
+ fi
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- ( cat /dev/null > /etc/resolv.conf.dhclient )
+- exit_status=$?
+- if [ $exit_status -ne 0 ]; then
+- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
+- else
+- if [ "x$new_domain_search" != x ]; then
+- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
+- exit_status=$?
+- elif [ "x$new_domain_name" != x ]; then
+- # Note that the DHCP 'Domain Name Option' is really just a domain
+- # name, and that this practice of using the domain name option as
+- # a search path is both nonstandard and deprecated.
+- ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
+- exit_status=$?
+- fi
+- for nameserver in $new_domain_name_servers; do
+- if [ $exit_status -ne 0 ]; then
+- break
+- fi
+- ( echo nameserver $nameserver >>/etc/resolv.conf.dhclient )
+- exit_status=$?
+- done
+-
+- # If there were no errors, attempt to mv the new file into place.
+- if [ $exit_status -eq 0 ]; then
+- ( mv /etc/resolv.conf.dhclient /etc/resolv.conf )
+- exit_status=$?
+- fi
+-
+- if [ $exit_status -ne 0 ]; then
+- $LOGGER "Error while writing new /etc/resolv.conf."
+- fi
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
++ # Note that the DHCP 'Domain Name Option' is really just a domain
++ # name, and that this practice of using the domain name option as
++ # a search path is both nonstandard and deprecated.
++ conf="${conf}search ${new_domain_name}\n"
+ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${conf}nameserver ${nameserver}\n"
++ done
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- ( cat /dev/null > /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- if [ $exit_status -ne 0 ] ; then
+- $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
+- else
+- if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- fi
+- for nameserver in ${new_dhcp6_name_servers} ; do
+- if [ $exit_status -ne 0 ] ; then
+- break
+- fi
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+@@ -66,18 +35,21 @@
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- ( echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- done
+-
+- if [ $exit_status -eq 0 ] ; then
+- ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
+- exit_status=$?
+- fi
++ if [ "x${new_dhcp6_domain_search}" != x ] ; then
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
++ fi
++ for nameserver in ${new_dhcp6_name_servers} ; do
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
++ done
++ fi
+
+- if [ $exit_status -ne 0 ] ; then
+- $LOGGER "Error while writing new /etc/resolv.conf."
+- fi
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
+ fi
+ fi
+ }
+--- dhcp-4.3.6/client/scripts/linux
++++ dhcp-4.3.6/client/scripts/linux
+@@ -35,16 +35,16 @@
+ # update /etc/resolv.conf based on received values
+ # This updated version mostly follows Debian script by Andrew Pollock et al.
+ make_resolv_conf() {
+- local new_resolv_conf
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf
+
+ # DHCPv4
+ if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
+ [ -n "$new_domain_name_servers" ]; then
+- new_resolv_conf=/etc/resolv.conf.dhclient-new
+- rm -f $new_resolv_conf
+-
+ if [ -n "$new_domain_name" ]; then
+- echo domain ${new_domain_name%% *} >>$new_resolv_conf
++ conf="${conf}domain ${new_domain_name%% *}\n"
+ fi
+
+ if [ -n "$new_domain_search" ]; then
+@@ -60,31 +60,23 @@
+ new_domain_search="$new_domain_name $new_domain_search"
+ fi
+ fi
+- echo "search ${new_domain_search}" >> $new_resolv_conf
++ conf="${conf}search ${new_domain_search}\n"
+ elif [ -n "$new_domain_name" ]; then
+- echo "search ${new_domain_name}" >> $new_resolv_conf
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+
+ if [ -n "$new_domain_name_servers" ]; then
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>$new_resolv_conf
++ conf="${conf}nameserver $nameserver\n"
+ done
+ else # keep 'old' nameservers
+- sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
++ conf="${conf}$(sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf)\n"
+ fi
+
+- if [ -f /etc/resolv.conf ]; then
+- chown --reference=/etc/resolv.conf $new_resolv_conf
+- chmod --reference=/etc/resolv.conf $new_resolv_conf
+- fi
+- mv -f $new_resolv_conf /etc/resolv.conf
+ # DHCPv6
+ elif [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
+- new_resolv_conf=/etc/resolv.conf.dhclient-new
+- rm -f $new_resolv_conf
+-
+ if [ -n "$new_dhcp6_domain_search" ]; then
+- echo "search ${new_dhcp6_domain_search}" >> $new_resolv_conf
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+
+ if [ -n "$new_dhcp6_name_servers" ]; then
+@@ -94,17 +86,21 @@
+ [ "${nameserver##FE80::}" != "$nameserver" ]; then
+ nameserver="${nameserver}%${interface}"
+ fi
+- echo nameserver $nameserver >>$new_resolv_conf
++ conf="${conf}nameserver $nameserver\n"
+ done
+ else # keep 'old' nameservers
+- sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
++ conf="${conf}$(sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf)\n"
+ fi
++ fi
+
+- if [ -f /etc/resolv.conf ]; then
+- chown --reference=/etc/resolv.conf $new_resolv_conf
+- chmod --reference=/etc/resolv.conf $new_resolv_conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
+ fi
+- mv -f $new_resolv_conf /etc/resolv.conf
+ fi
+ }
+
+--- dhcp-4.3.6/client/scripts/netbsd
++++ dhcp-4.3.6/client/scripts/netbsd
+@@ -1,27 +1,25 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
+- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
++ if [ x"$new_domain_name_servers" != x ]; then
+ if [ "x$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_search}\n"
+ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ # If the nameserver has a link-local address
+@@ -31,10 +29,18 @@
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
+--- dhcp-4.3.6/client/scripts/openbsd
++++ dhcp-4.3.6/client/scripts/openbsd
+@@ -1,27 +1,25 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ # If the nameserver has a link-local address
+@@ -31,10 +29,18 @@
+ FE80:*) zone_id="%$interface";;
+ *) zone_id="";;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
+--- dhcp-4.3.6/client/scripts/solaris
++++ dhcp-4.3.6/client/scripts/solaris
+@@ -1,21 +1,39 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
++ done
++ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
++ if [ "x${new_dhcp6_domain_search}" != x ] ; then
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
++ fi
++ for nameserver in ${new_dhcp6_name_servers} ; do
++ conf="${conf}nameserver ${nameserver}\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
+ }
+
diff --git a/net-misc/dhcp/files/dhcp-4.3.6-iproute2-path.patch b/net-misc/dhcp/files/dhcp-4.3.6-iproute2-path.patch
new file mode 100644
index 000000000000..18b04e620c14
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.6-iproute2-path.patch
@@ -0,0 +1,11 @@
+--- dhcp-4.3.6/client/scripts/linux
++++ dhcp-4.3.6/client/scripts/linux
+@@ -30,7 +30,7 @@
+ # 'ip' just looks too weird. Also, we now have unit-tests! Those unit-tests
+ # overwirte this line to use a fake ip-echo tool. It's also convenient
+ # if your system holds ip tool in a non-standard location.
+-ip=/sbin/ip
++ip=ip
+
+ # update /etc/resolv.conf based on received values
+ # This updated version mostly follows Debian script by Andrew Pollock et al.
diff --git a/net-misc/dhcp/files/dhcp-4.3.6-lmdb-removal.patch b/net-misc/dhcp/files/dhcp-4.3.6-lmdb-removal.patch
new file mode 100644
index 000000000000..6f80d7401f57
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.6-lmdb-removal.patch
@@ -0,0 +1,12 @@
+diff -uNr dhcp-4.3.6.ORIG/bind/Makefile.in dhcp-4.3.6/bind/Makefile.in
+--- dhcp-4.3.6.ORIG/bind/Makefile.in 2017-09-19 23:37:59.459485673 +0100
++++ dhcp-4.3.6/bind/Makefile.in 2017-09-19 23:38:19.970484566 +0100
+@@ -28,7 +28,7 @@
+
+ bindconfig = --disable-kqueue --disable-epoll --disable-devpoll \
+ --without-openssl --without-libxml2 --enable-exportlib \
+- --with-gssapi=no --enable-threads=no --without-lmdb @BINDCONFIG@ \
++ --with-gssapi=no --enable-threads=no @BINDCONFIG@ \
+ --with-export-includedir=${binddir}/include \
+ --with-export-libdir=${binddir}/lib
+
diff --git a/net-misc/dhcp/files/dhcp-4.3.6-nogateway.patch b/net-misc/dhcp/files/dhcp-4.3.6-nogateway.patch
new file mode 100644
index 000000000000..d299cc503f60
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.6-nogateway.patch
@@ -0,0 +1,66 @@
+--- dhcp-4.3.6/client/scripts/linux
++++ dhcp-4.3.6/client/scripts/linux
+@@ -242,20 +242,22 @@
+ if_metric=${if_metric:-1}
+ fi
+
+- for router in $new_routers; do
+- if [ "$new_subnet_mask" = "255.255.255.255" ]; then
+- # point-to-point connection => set explicit route
+- ${ip} -4 route add ${router} dev $interface >/dev/null 2>&1
+- fi
+-
+- # set default route
+- ${ip} -4 route add default via ${router} dev ${interface} \
+- ${if_metric:+metric $if_metric} >/dev/null 2>&1
+-
+- if [ -n "$if_metric" ]; then
+- if_metric=$((if_metric+1))
+- fi
+- done
++ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
++ for router in $new_routers; do
++ if [ "$new_subnet_mask" = "255.255.255.255" ]; then
++ # point-to-point connection => set explicit route
++ ${ip} -4 route add ${router} dev $interface >/dev/null 2>&1
++ fi
++
++ # set default route
++ ${ip} -4 route add default via ${router} dev ${interface} \
++ ${if_metric:+metric $if_metric} >/dev/null 2>&1
++
++ if [ -n "$if_metric" ]; then
++ if_metric=$((if_metric+1))
++ fi
++ done
++ fi
+ fi
+ fi
+
+@@ -330,15 +332,17 @@
+ if_metric=${if_metric:-1}
+ fi
+
+- # set default route
+- for router in $new_routers; do
+- ${ip} -4 route add default via ${router} dev ${interface} \
+- ${if_metric:+metric $if_metric} >/dev/null 2>&1
+-
+- if [ -n "$if_metric" ]; then
+- if_metric=$((if_metric+1))
+- fi
+- done
++ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
++ # set default route
++ for router in $new_routers; do
++ ${ip} -4 route add default via ${router} dev ${interface} \
++ ${if_metric:+metric $if_metric} >/dev/null 2>&1
++
++ if [ -n "$if_metric" ]; then
++ if_metric=$((if_metric+1))
++ fi
++ done
++ fi
+ fi
+
+ # update /etc/resolv.conf
diff --git a/net-misc/dhcp/files/dhcp-4.3.6-quieter-ping.patch b/net-misc/dhcp/files/dhcp-4.3.6-quieter-ping.patch
new file mode 100644
index 000000000000..3efb6459ebf9
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.6-quieter-ping.patch
@@ -0,0 +1,66 @@
+--- dhcp-4.3.6/client/scripts/bsdos
++++ dhcp-4.3.6/client/scripts/bsdos
+@@ -220,7 +220,7 @@
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+- if ping -q -c 1 -w 1 $1; then
++ if ping -q -c 1 -w 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- dhcp-4.3.6/client/scripts/freebsd
++++ dhcp-4.3.6/client/scripts/freebsd
+@@ -287,7 +287,7 @@
+ if [ -n "$new_routers" ]; then
+ $LOGGER "New Routers: $new_routers"
+ set -- $new_routers
+- if ping -q -c 1 $1; then
++ if ping -q -c 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- dhcp-4.3.6/client/scripts/linux
++++ dhcp-4.3.6/client/scripts/linux
+@@ -311,7 +311,7 @@
+ fi
+
+ # if there is no router recorded in the lease or the 1st router answers pings
+- if [ -z "$new_routers" ] || ping -q -c 1 "${new_routers%% *}"; then
++ if [ -z "$new_routers" ] || ping -q -c 1 "${new_routers%% *}" >/dev/null; then
+ # if we have $new_rfc3442_classless_static_routes then we have to
+ # ignore $new_routers entirely
+ if [ ! "$new_rfc3442_classless_static_routes" ]; then
+--- dhcp-4.3.6/client/scripts/netbsd
++++ dhcp-4.3.6/client/scripts/netbsd
+@@ -220,7 +220,7 @@
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+- if ping -q -c 1 -w 1 $1; then
++ if ping -q -c 1 -w 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- dhcp-4.3.6/client/scripts/openbsd
++++ dhcp-4.3.6/client/scripts/openbsd
+@@ -214,7 +214,7 @@
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+- if ping -q -c 1 -w 1 $1; then
++ if ping -q -c 1 -w 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+--- dhcp-4.3.6/client/scripts/openwrt
++++ dhcp-4.3.6/client/scripts/openwrt
+@@ -190,7 +190,7 @@
+ ifconfig $interface $new_ip_address $new_subnet_arg \
+ $new_broadcast_arg $mtu_arg
+ set $new_routers
+- if ping -q -c 1 $1; then
++ if ping -q -c 1 $1 >/dev/null; then
+ if [ x$new_ip_address != x$alias_ip_address ] && \
+ [ x$alias_ip_address != x ]; then
+ ifconfig $interface:0 $alias_ip_address $alias_subnet_arg
diff --git a/net-misc/dhcp/files/dhcpd.conf2 b/net-misc/dhcp/files/dhcpd.conf2
new file mode 100644
index 000000000000..5cd2eeca3f71
--- /dev/null
+++ b/net-misc/dhcp/files/dhcpd.conf2
@@ -0,0 +1,28 @@
+# /etc/conf.d/dhcpd: config file for /etc/init.d/dhcpd
+
+# If you require more than one instance of dhcpd you can create symbolic
+# links to dhcpd service like so
+# cd /etc/init.d
+# ln -s dhcpd dhcpd.foo
+# cd ../conf.d
+# cp dhcpd dhcpd.foo
+# Now you can edit dhcpd.foo and specify a different configuration file.
+# You'll also need to specify a pidfile in that dhcpd.conf file.
+# See the pid-file-name option in the dhcpd.conf man page for details.
+
+# If you wish to run dhcpd in a chroot, uncomment the following line
+# DHCPD_CHROOT="/var/lib/dhcp/chroot"
+
+# All file paths below are relative to the chroot.
+# You can specify a different chroot directory but MAKE SURE it's empty.
+
+# Specify a configuration file - the default is /etc/dhcp/dhcpd.conf
+# DHCPD_CONF="/etc/dhcp/dhcpd.conf"
+
+# Configure which interface or interfaces to for dhcpd to listen on.
+# List all interfaces space separated. If this is not specified then
+# we listen on all interfaces.
+# DHCPD_IFACE=""
+
+# Insert any other dhcpd options - see the man page for a full list.
+# DHCPD_OPTS=""
diff --git a/net-misc/dhcp/files/dhcpd.init5 b/net-misc/dhcp/files/dhcpd.init5
new file mode 100644
index 000000000000..f0ea9b0c7904
--- /dev/null
+++ b/net-misc/dhcp/files/dhcpd.init5
@@ -0,0 +1,119 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="configtest"
+
+: ${DHCPD_CONF:=/etc/dhcp/${SVCNAME}.conf}
+
+depend() {
+ need net
+ use logger dns #@slapd@
+}
+
+get_var() {
+ local var="$(sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' "${chroot}${DHCPD_CONF}")"
+ echo ${var:-$2}
+}
+
+setup_opts() {
+ DHCPD_CHROOT=${DHCPD_CHROOT%/}
+
+ # Work out our cffile if it's in our DHCPD_OPTS
+ case " ${DHCPD_OPTS} " in
+ *" -cf "*)
+ DHCPD_CONF=" ${DHCPD_OPTS} "
+ DHCPD_CONF="${DHCPD_CONF##* -cf }"
+ DHCPD_CONF="${DHCPD_CONF%% *}"
+ ;;
+ *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
+ ;;
+ esac
+}
+
+checkconfig() {
+ set -- ${DHCPD_OPTS} -chroot "${DHCPD_CHROOT:-/}" -t
+
+ dhcpd "$@" 1>/dev/null 2>&1
+ local ret=$?
+ if [ ${ret} -ne 0 ] ; then
+ eerror "${SVCNAME} has detected a syntax error in your configuration files:"
+ dhcpd "$@"
+ fi
+
+ return ${ret}
+}
+
+configtest() {
+ setup_opts
+
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+start() {
+ setup_opts
+ local chroot="${DHCPD_CHROOT}"
+
+ if [ -n "${chroot}" ] ; then
+ # the config test want's these to exist
+ mkdir -p \
+ "${chroot}"/var/run/dhcp \
+ "${chroot}"/var/lib/dhcp \
+ "${chroot}"/etc/dhcp
+ fi
+
+ # see comment in get_var() above
+ if [ ! -f "${chroot}${DHCPD_CONF}" ] ; then
+ eerror "${chroot}${DHCPD_CONF} does not exist"
+ return 1
+ fi
+
+ checkconfig || return 1
+
+ checkpath -d -o dhcp:dhcp "${chroot}"/var/run/dhcp "${chroot}"/var/lib/dhcp
+
+ local leasefile="$(get_var lease-file-name /var/lib/dhcp/${SVCNAME}.leases)"
+ checkpath -f -o dhcp:dhcp "${chroot}${leasefile}"
+
+ # Setup LD_PRELOAD so name resolution works in our chroot.
+ if [ -n "${chroot}" ] ; then
+ checkpath -d -o root:root -m 755 "${chroot}"/dev "${chroot}"/etc "${chroot}"/proc
+ cp -pP /etc/localtime /etc/resolv.conf "${chroot}"/etc/
+ export LD_PRELOAD="${LD_PRELOAD} libresolv.so libnss_dns.so"
+ if ! mountinfo -q "${chroot}/proc" ; then
+ mount --bind /proc "${chroot}/proc"
+ fi
+ fi
+
+ local pidfile="$(get_var pid-file-name /var/run/dhcp/${SVCNAME}.pid)"
+
+ ebegin "Starting ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/${pidfile}" \
+ -- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \
+ -user dhcp -group dhcp \
+ -chroot "${chroot:-/}" ${DHCPD_IFACE}
+ eend $? \
+ && save_options dhcpd_chroot "${chroot}" \
+ && save_options pidfile "${pidfile}"
+}
+
+stop() {
+ local chroot="$(get_options dhcpd_chroot)"
+ [ -z "${chroot}" ] && chroot="$(get_options chroot)"
+
+ ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --stop --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/$(get_options pidfile)"
+ res=$?
+
+ if [ ${res} -eq 0 ] && [ -n "${chroot}" ] ; then
+ if mountinfo -q "${chroot}/proc" ; then
+ umount "${chroot}/proc"
+ fi
+ fi
+
+ eend ${res}
+}
diff --git a/net-misc/dhcp/files/dhcpd.tmpfiles b/net-misc/dhcp/files/dhcpd.tmpfiles
new file mode 100644
index 000000000000..ee2f4deeaadf
--- /dev/null
+++ b/net-misc/dhcp/files/dhcpd.tmpfiles
@@ -0,0 +1,2 @@
+d /var/lib/dhcp/ 0755 dhcp dhcp
+f /var/lib/dhcp/dhcpd.leases 0644 dhcp dhcp \ No newline at end of file
diff --git a/net-misc/dhcp/files/dhcpd4.service b/net-misc/dhcp/files/dhcpd4.service
new file mode 100644
index 000000000000..b064bd9b57df
--- /dev/null
+++ b/net-misc/dhcp/files/dhcpd4.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=DHCPv4 Server Daemon
+Documentation=man:dhcpd(8) man:dhcpd.conf(5)
+After=network.target
+After=time-sync.target
+
+[Service]
+ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcp -group dhcp --no-pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-misc/dhcp/files/dhcpd6.service b/net-misc/dhcp/files/dhcpd6.service
new file mode 100644
index 000000000000..603cacd8eb89
--- /dev/null
+++ b/net-misc/dhcp/files/dhcpd6.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=DHCPv6 Server Daemon
+Documentation=man:dhcpd(8) man:dhcpd.conf(5)
+After=network.target
+After=time-sync.target
+
+[Service]
+ExecStart=/usr/sbin/dhcpd -f -s -6 -cf /etc/dhcp/dhcpd.conf -user dhcp -group dhcp --no-pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-misc/dhcp/files/dhcrelay.conf b/net-misc/dhcp/files/dhcrelay.conf
new file mode 100644
index 000000000000..44699682d42d
--- /dev/null
+++ b/net-misc/dhcp/files/dhcrelay.conf
@@ -0,0 +1,16 @@
+# /etc/conf.d/dhcrelay: config file for /etc/init.d/dhcrelay
+
+# Configure which interface or interfaces to for dhcrelay to listen on
+# and send to.
+# List all interfaces space separated. If this is not specified then
+# we use all interfaces.
+#IFACE=""
+# If you have split net interfaces, you might want to depend on them
+# explicitly here.
+#rc_need=$(printf 'net.%s ' ${IFACE})
+
+# Insert any other options needed. See dhcrelay(8) for details.
+#DHCRELAY_OPTS=""
+
+# Space separated list of IPs to forward BOOTP/DHCP packets to.
+DHCRELAY_SERVERS=""
diff --git a/net-misc/dhcp/files/dhcrelay.init3 b/net-misc/dhcp/files/dhcrelay.init3
new file mode 100644
index 000000000000..a08ba8850740
--- /dev/null
+++ b/net-misc/dhcp/files/dhcrelay.init3
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need net
+ use logger #@slapd@
+}
+
+start() {
+ if [ -z "${DHCRELAY_SERVERS}" ] ; then
+ eerror "No DHCRELAY_SERVERS specified in /etc/conf.d/${SVCNAME}"
+ return 1
+ fi
+
+ checkpath -d /var/run/dhcp
+
+ local iface_opts
+ if [ -n "${IFACE}" ] ; then
+ iface_opts=$(printf -- '-i %s ' ${IFACE})
+ fi
+
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/dhcrelay \
+ -- -q ${iface_opts} ${DHCRELAY_OPTS} ${DHCRELAY_SERVERS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --pidfile /var/run/dhcp/${SVCNAME}.pid
+ eend $?
+}
diff --git a/net-misc/dhcp/files/dhcrelay4.service b/net-misc/dhcp/files/dhcrelay4.service
new file mode 100644
index 000000000000..09e835d43357
--- /dev/null
+++ b/net-misc/dhcp/files/dhcrelay4.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=DHCP Relay Agent Daemon
+Documentation=man:dhcrelay(8)
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/dhcrelay -d --no-pid $DHCRELAY_SERVERS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-misc/dhcp/files/dhcrelay4.service.conf b/net-misc/dhcp/files/dhcrelay4.service.conf
new file mode 100644
index 000000000000..1a0465b767d6
--- /dev/null
+++ b/net-misc/dhcp/files/dhcrelay4.service.conf
@@ -0,0 +1,3 @@
+# Space separated list of IPs to forward BOOTP/DHCP packets to.
+[Service]
+Environment="DHCRELAY_SERVERS=" \ No newline at end of file
diff --git a/net-misc/dhcp/files/dhcrelay6.conf b/net-misc/dhcp/files/dhcrelay6.conf
new file mode 100644
index 000000000000..4e8b8c6fea39
--- /dev/null
+++ b/net-misc/dhcp/files/dhcrelay6.conf
@@ -0,0 +1,8 @@
+# /etc/conf.d/dhcrelay6: config file for /etc/init.d/dhcrelay6
+
+# Insert any other options needed. See dhcrelay(8) for details.
+# Make sure you specify the lower (-l)/upper (-u) interfaces.
+DHCRELAY_OPTS="-6 -l lower-iface -u upper-iface"
+
+# Space separated list of IPs to forward BOOTP/DHCP packets to.
+DHCRELAY_SERVERS=""
diff --git a/net-misc/dhcp/files/dhcrelay6.service b/net-misc/dhcp/files/dhcrelay6.service
new file mode 100644
index 000000000000..1e5e49888d61
--- /dev/null
+++ b/net-misc/dhcp/files/dhcrelay6.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=DHCP Relay Agent Daemon
+Documentation=man:dhcrelay(8)
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/dhcrelay -d --no-pid -6 -l $lower-iface -u $upper-iface $DHCRELAY_SERVERS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-misc/dhcp/files/dhcrelay6.service.conf b/net-misc/dhcp/files/dhcrelay6.service.conf
new file mode 100644
index 000000000000..ae293ab4ff28
--- /dev/null
+++ b/net-misc/dhcp/files/dhcrelay6.service.conf
@@ -0,0 +1,6 @@
+[Service]
+# Space separated list of IPs to forward BOOTP/DHCP packets to
+Environment="DHCRELAY_SERVERS="
+# Make sure you specify the lower (-l)/upper (-u) interfaces
+Environment="lower-iface="
+Environment="upper-iface="