diff options
author | Tony Vroon <chainsaw@gentoo.org> | 2008-09-04 12:39:45 +0000 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2008-09-04 12:39:45 +0000 |
commit | 144c59a25f34da40aaad9b04fe5e0d8eb6a1baf8 (patch) | |
tree | daf497a6b5db909e9ab1a8675ffd93b01cdb6d79 /net-misc/dhcp | |
parent | Unmasking and stabilizing latest version, adding warning, on behalf of agaffney (diff) | |
download | gentoo-2-144c59a25f34da40aaad9b04fe5e0d8eb6a1baf8.tar.gz gentoo-2-144c59a25f34da40aaad9b04fe5e0d8eb6a1baf8.tar.bz2 gentoo-2-144c59a25f34da40aaad9b04fe5e0d8eb6a1baf8.zip |
Version bump, closes bug #205214. Thanks to Roy "UberLord" Marples <roy@marples.name> for patching and patch porting.
(Portage version: 2.2_rc8/cvs/Linux 2.6.27-rc5-00131-g5f17cfc-dirty x86_64)
Diffstat (limited to 'net-misc/dhcp')
-rw-r--r-- | net-misc/dhcp/ChangeLog | 15 | ||||
-rw-r--r-- | net-misc/dhcp/dhcp-4.0.0.ebuild | 211 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch | 205 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch | 216 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch | 390 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch | 48 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch | 115 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch | 25 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch | 96 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.0-paranoia.patch | 189 |
10 files changed, 1509 insertions, 1 deletions
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog index d39574aa65d9..a0a357dff6a8 100644 --- a/net-misc/dhcp/ChangeLog +++ b/net-misc/dhcp/ChangeLog @@ -1,6 +1,19 @@ # ChangeLog for net-misc/dhcp # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.150 2008/06/29 11:13:40 klausman Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.151 2008/09/04 12:39:44 chainsaw Exp $ + +*dhcp-4.0.0 (04 Sep 2008) + + 04 Sep 2008; <chainsaw@gentoo.org> +files/dhcp-4.0-dhclient-metric.patch, + +files/dhcp-4.0-dhclient-ntp.patch, + +files/dhcp-4.0-dhclient-resolvconf.patch, + +files/dhcp-4.0-dhclient-script-correct-operators.patch, + +files/dhcp-4.0-dhclient-stdin-conf.patch, + +files/dhcp-4.0-linux-ipv6-header.patch, + +files/dhcp-4.0-no_isc_blurb.patch, +files/dhcp-4.0-paranoia.patch, + +dhcp-4.0.0.ebuild: + Version bump, closes bug #205214. Thanks to Roy "UberLord" Marples + <roy@marples.name> for patching and patch porting. 29 Jun 2008; Tobias Klausmann <klausman@gentoo.org> dhcp-3.1.1.ebuild: Stable on alpha, bug #227135 diff --git a/net-misc/dhcp/dhcp-4.0.0.ebuild b/net-misc/dhcp/dhcp-4.0.0.ebuild new file mode 100644 index 000000000000..76ea781a485e --- /dev/null +++ b/net-misc/dhcp/dhcp-4.0.0.ebuild @@ -0,0 +1,211 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-4.0.0.ebuild,v 1.1 2008/09/04 12:39:44 chainsaw Exp $ + +inherit eutils flag-o-matic autotools + +MY_PV="${PV//_alpha/a}" +MY_PV="${MY_PV//_beta/b}" +MY_PV="${MY_PV//_rc/rc}" +MY_P="${PN}-${MY_PV}" +DESCRIPTION="ISC Dynamic Host Configuration Protocol" +HOMEPAGE="http://www.isc.org/products/DHCP" +SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz" + +LICENSE="isc-dhcp" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE="ipv6 doc selinux kernel_linux" + +DEPEND="selinux? ( sec-policy/selinux-dhcp ) + kernel_linux? ( sys-apps/net-tools )" + +PROVIDE="virtual/dhcpc" + +S="${WORKDIR}/${MY_P}" + +src_unpack() { + unpack ${A} + cd "${S}" + + # Gentoo patches - these will probably never be accepted upstream + # Enable chroot support + epatch "${FILESDIR}/${PN}"-4.0-paranoia.patch + # Fix some permission issues + epatch "${FILESDIR}/${PN}"-3.0-fix-perms.patch + # Enable dhclient to equery NTP servers + epatch "${FILESDIR}/${PN}"-4.0-dhclient-ntp.patch + # resolvconf support in dhclient-script + epatch "${FILESDIR}/${PN}"-4.0-dhclient-resolvconf.patch + # Fix setting hostnames on Linux + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-hostname.patch + # Allow mtu settings + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-mtu.patch + # Allow dhclient to use IF_METRIC to set route metrics + epatch "${FILESDIR}/${PN}"-4.0-dhclient-metric.patch + # Stop downing the interface on Linux as that breaks link daemons + # such as wpa_supplicant and netplug + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-no-down.patch + # Quiet the isc blurb + epatch "${FILESDIR}/${PN}"-4.0-no_isc_blurb.patch + # Enable dhclient to get extra configuration from stdin + epatch "${FILESDIR}/${PN}"-4.0-dhclient-stdin-conf.patch + # Disable fallback interfaces when using BPF + # This allows more than one dhclient instance on the BSD's + epatch "${FILESDIR}/${PN}"-3.0.5-bpf-nofallback.patch + # This allows the software to actually compile on linux + epatch "${FILESDIR}/${PN}"-4.0-linux-ipv6-header.patch + # Consistent style for the if statements, also resolves + # unary operator expected warnings (new style is wrong). + epatch "${FILESDIR}/${PN}"-4.0-dhclient-script-correct-operators.patch + + # NetworkManager support patches + # If they fail to apply to future versions they will be dropped + # Add dbus support to dhclient + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch + + # Brand the version with Gentoo + # include revision if >0 + local newver="Gentoo" + [[ ${PR} != "r0" ]] && newver="${newver}-${PR}" + + sed -i "/AC_INIT/s/\(\[[0-9]\+\.[0-9]\+\.[0-9]\+\)/\1-${newver}/" \ + configure.ac || die + + # Change the hook script locations of the scripts + sed -i -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \ + -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \ + client/scripts/* || die + + # No need for the linux script to force bash, #158540. + sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die + + # Quiet the freebsd logger a little + sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die + + # Remove these options from the sample config + sed -i -e "/\(script\|host-name\|domain-name\) / d" \ + client/dhclient.conf || die + + # Only install different man pages if we don't have en + if [[ " ${LINGUAS} " != *" en "* ]]; then + # Install Japanese man pages + if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then + einfo "Installing Japanese documention" + cp doc/ja_JP.eucJP/dhclient* client + cp doc/ja_JP.eucJP/dhcp* common + fi + fi + + # Now remove the non-english docs so there are no errors later + [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP + + eautoreconf +} + +src_compile() { + econf \ + --enable-paranoia \ + --sysconfdir /etc/dhcp \ + --with-cli-pid-file=/var/run/dhcp/dhclient.pid \ + --with-cli-lease-file=/var/lib/dhcp/dhclient.leases \ + --with-srv-pid-file=/var/run/dhcp/dhcpd.pid \ + --with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \ + --with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \ + $(use_enable ipv6 dhcpv6) \ + || die + + emake || die "compile problem" +} + +src_install() { + for installdir in includes tests common minires dst omapip client dhcpctl relay server; do + cd "${S}/${installdir}" + if [ "${installdir}" == client ]; then + make install DESTDIR="${D}" exec_prefix="" || die + else + make install DESTDIR="${D}" exec_prefix="/usr" || die + fi + done + + cd "${S}" + + exeinto /sbin + if use kernel_linux; then + newexe "${S}"/client/scripts/linux dhclient-script + else + newexe "${S}"/client/scripts/freebsd dhclient-script + fi + + use doc && dodoc README RELNOTES doc/* + + insinto /etc/dhcp + newins client/dhclient.conf dhclient.conf.sample + keepdir /var/{lib,run}/dhcp + + # Install our server files + insinto /etc/dhcp + newins server/dhcpd.conf dhcpd.conf.sample + newinitd "${FILESDIR}"/dhcpd.init dhcpd + newinitd "${FILESDIR}"/dhcrelay.init dhcrelay + newconfd "${FILESDIR}"/dhcpd.conf dhcpd + newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay + + # We never want portage to own this file + rm -f "${D}"/var/lib/dhcp/dhcpd.leases +} + +pkg_preinst() { + enewgroup dhcp + enewuser dhcp -1 -1 /var/lib/dhcp dhcp +} + +pkg_postinst() { + chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp + + if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then + ewarn + ewarn "WARNING: The dhcp init script has been renamed to dhcpd" + ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and" + ewarn "and dhcp should be removed from the default runlevel" + ewarn + fi + + einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings." + einfo + einfo "If you would like to run dhcpd in a chroot, simply configure the" + einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:" + einfo " emerge --config =${PF}" +} + +pkg_config() { + local CHROOT="$( + sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \ + "${ROOT}"/etc/conf.d/dhcpd + )" + + if [[ -z ${CHROOT} ]]; then + eerror "CHROOT not defined in /etc/conf.d/dhcpd" + return 1 + fi + + CHROOT="${ROOT}/${CHROOT}" + + if [[ -d ${CHROOT} ]] ; then + ewarn "${CHROOT} already exists - aborting" + return 0 + fi + + ebegin "Setting up the chroot directory" + mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp} + cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc + cp -R /etc/dhcp "${CHROOT}"/etc + cp -R /var/lib/dhcp "${CHROOT}"/var/lib + ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib + chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp + eend 0 + + local logger="$(best_version virtual/logger)" + einfo "To enable logging from the dhcpd server, configure your" + einfo "logger (${logger}) to listen on ${CHROOT}/dev/log" +} diff --git a/net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch b/net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch new file mode 100644 index 000000000000..cca3e2b1d473 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch @@ -0,0 +1,205 @@ +diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos +--- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 13:22:40.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 13:23:24.000000000 +0100 +@@ -95,6 +95,9 @@ + if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC != x ]; then ++ metric_arg="metric $IF_METRIC" ++fi + + if [ x$reason = xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -156,7 +159,7 @@ + if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ + [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + route add $new_ip_address 127.1 >/dev/null 2>&1 + for router in $new_routers; do + route add default $router >/dev/null 2>&1 +@@ -213,7 +216,7 @@ + route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 + fi + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + sleep 1 + if [ "$new_routers" != "" ]; then + set $new_routers +diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd +--- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 13:22:40.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 13:23:24.000000000 +0100 +@@ -139,6 +139,9 @@ + if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC != x ]; then ++ metric_arg="metric $IF_METRIC" ++fi + + if [ x$reason = xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -200,7 +203,7 @@ + if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ + [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + $LOGGER "New IP Address ($interface): $new_ip_address" + $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" + $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" +@@ -264,7 +267,7 @@ + route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 + fi + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + $LOGGER "New IP Address ($interface): $new_ip_address" + $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" + $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" +diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux +--- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 13:22:40.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/linux 2008-09-01 13:26:19.000000000 +0100 +@@ -98,11 +98,6 @@ + fi + fi + +-release=`uname -r` +-release=`expr $release : '\(.*\)\..*'` +-relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'` +-relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'` +- + ### + ### DHCPv4 Handlers + ### +@@ -125,6 +120,9 @@ + if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC != x ]; then ++ metric_arg="metric $IF_METRIC" ++fi + + if [ x$reason = xMEDIUM ]; then + # Linux doesn't do mediums (ok, ok, media). +@@ -136,15 +134,7 @@ + # Bring down alias interface. Its routes will disappear too. + ifconfig $interface:0- inet 0 + fi +- if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ) +- then +- ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \ +- broadcast 255.255.255.255 up +- # Add route to make broadcast work. Do not omit netmask. +- route add default dev $interface netmask 0.0.0.0 +- else +- ifconfig $interface 0 up +- fi ++ ifconfig $interface 0 up + + # We need to give the kernel some time to get the interface up. + sleep 1 +@@ -186,12 +176,14 @@ + ifconfig $interface inet $new_ip_address $new_subnet_arg \ + $new_broadcast_arg $mtu_arg + # Add a network route to the computed network address. +- if [ $relmajor -lt 2 ] || \ +- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then +- route add -net $new_network_number $new_subnet_arg dev $interface ++ if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then ++ route del -net $new_network_number $new_subnet_arg \ ++ dev $interface ++ route add -net $new_network_number $new_subnet_arg $metric_arg \ ++ dev $interface + fi + for router in $new_routers; do +- route add default gw $router ++ route add default gw $router $metric_arg dev $interface + done + fi + if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; +@@ -234,12 +226,15 @@ + ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg + route add -host $alias_ip_address dev $interface:0 + fi +- if [ $relmajor -lt 2 ] || \ +- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then +- route add -net $new_network_number ++ # Add a network route to the computed network address. ++ if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then ++ route del -net $new_network_number $new_subnet_arg \ ++ dev $interface ++ route add -net $new_network_number $new_subnet_arg $metric_arg \ ++ dev $interface + fi + for router in $new_routers; do +- route add default gw $router ++ route add default gw $router $metric_arg dev $interface + done + make_resolv_conf + exit_with_hooks 0 +diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd +--- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 13:22:40.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 13:23:33.000000000 +0100 +@@ -95,6 +95,9 @@ + if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC != x ]; then ++ metric_arg="metric $IF_METRIC" ++fi + + if [ x$reason = xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -156,7 +159,7 @@ + if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ + [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + route add $new_ip_address 127.1 >/dev/null 2>&1 + for router in $new_routers; do + route add default $router >/dev/null 2>&1 +@@ -213,7 +216,7 @@ + route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 + fi + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + sleep 1 + if [ "$new_routers" != "" ]; then + set $new_routers +diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris +--- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 13:22:40.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 13:23:33.000000000 +0100 +@@ -78,6 +78,9 @@ + if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC != x ]; then ++ metric_arg="metric $IF_METRIC" ++fi + + ifconfig=/sbin/ifconfig + +@@ -140,7 +143,7 @@ + if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ + [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then + eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + route add $new_ip_address 127.1 1 >/dev/null 2>&1 + for router in $new_routers; do + route add default $router 1 >/dev/null 2>&1 +@@ -181,7 +184,7 @@ + route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 + fi + eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $mtu_arg $medium" ++ $new_broadcast_arg $mtu_arg $metric_arg $medium" + sleep 1 + set $new_routers + if ping -s -n -I 1 $1 64 1; then diff --git a/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch b/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch new file mode 100644 index 000000000000..d3f29714b021 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch @@ -0,0 +1,216 @@ +diff -uNr dhcp-4.0.0.ORIG/client/clparse.c dhcp-4.0.0/client/clparse.c +--- dhcp-4.0.0.ORIG/client/clparse.c 2008-09-01 11:38:51.000000000 +0100 ++++ dhcp-4.0.0/client/clparse.c 2008-09-01 11:48:17.000000000 +0100 +@@ -37,7 +37,7 @@ + + struct client_config top_level_config; + +-#define NUM_DEFAULT_REQUESTED_OPTS 9 ++#define NUM_DEFAULT_REQUESTED_OPTS 10 + struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1]; + + static void parse_client_default_duid(struct parse *cfile); +@@ -98,15 +98,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 " +diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos +--- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 11:38:51.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 11:39:30.000000000 +0100 +@@ -29,6 +29,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. +diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd +--- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 11:38:51.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 11:39:30.000000000 +0100 +@@ -73,6 +73,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. +diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux +--- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 11:38:51.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/linux 2008-09-01 11:39:30.000000000 +0100 +@@ -55,6 +55,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. +diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd +--- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 11:38:51.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 11:39:30.000000000 +0100 +@@ -29,6 +29,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. +diff -uNr dhcp-4.0.0.ORIG/client/scripts/openbsd dhcp-4.0.0/client/scripts/openbsd +--- dhcp-4.0.0.ORIG/client/scripts/openbsd 2008-09-01 11:38:51.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/openbsd 2008-09-01 11:39:30.000000000 +0100 +@@ -29,6 +29,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. +diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris +--- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 11:38:51.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 11:39:30.000000000 +0100 +@@ -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.0-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch new file mode 100644 index 000000000000..063b8e33e146 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch @@ -0,0 +1,390 @@ +diff -ur a/client/scripts/bsdos b/client/scripts/bsdos +--- a/client/scripts/bsdos 2008-09-01 14:41:00.000000000 +0100 ++++ b/client/scripts/bsdos 2008-09-01 14:57:33.000000000 +0100 +@@ -1,34 +1,41 @@ + #!/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 +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf="${conf}nameserver ${nameserver}\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 ++ + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf + } +diff -ur a/client/scripts/freebsd b/client/scripts/freebsd +--- a/client/scripts/freebsd 2008-09-01 14:41:00.000000000 +0100 ++++ b/client/scripts/freebsd 2008-09-01 15:00:18.000000000 +0100 +@@ -11,68 +11,41 @@ + 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 +- ( echo nameserver ${nameserver} >> /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}\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 ++ + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf + } +diff -ur a/client/scripts/linux b/client/scripts/linux +--- a/client/scripts/linux 2008-09-01 14:41:00.000000000 +0100 ++++ b/client/scripts/linux 2008-09-01 14:58:09.000000000 +0100 +@@ -26,35 +26,41 @@ + 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 + for nameserver in ${new_dhcp6_name_servers} ; do +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf="${conf}nameserver ${nameserver}\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 ++ + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf + } +diff -ur a/client/scripts/netbsd b/client/scripts/netbsd +--- a/client/scripts/netbsd 2008-09-01 14:41:00.000000000 +0100 ++++ b/client/scripts/netbsd 2008-09-01 14:58:40.000000000 +0100 +@@ -1,34 +1,41 @@ + #!/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 +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf="${conf}nameserver ${nameserver}\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 ++ + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf + } +diff -ur a/client/scripts/openbsd b/client/scripts/openbsd +--- a/client/scripts/openbsd 2008-09-01 14:41:00.000000000 +0100 ++++ b/client/scripts/openbsd 2008-09-01 14:59:12.000000000 +0100 +@@ -1,34 +1,41 @@ + #!/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/ersolv.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 +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf="${conf}nameserver ${nameserver}\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 ++ + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf + } +diff -ur a/client/scripts/solaris b/client/scripts/solaris +--- a/client/scripts/solaris 2008-09-01 14:41:00.000000000 +0100 ++++ b/client/scripts/solaris 2008-09-01 14:59:27.000000000 +0100 +@@ -1,22 +1,41 @@ + #!/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 ++ + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf + } diff --git a/net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch b/net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch new file mode 100644 index 000000000000..7cf0b241add3 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch @@ -0,0 +1,48 @@ +diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux +--- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-03 00:52:41.000000000 +0100 ++++ dhcp-4.0.0/client/scripts/linux 2008-09-03 00:53:16.000000000 +0100 +@@ -258,7 +232,7 @@ + ### DHCPv6 Handlers + ### + +-if [ ${reason} = PREINIT6 ] ; then ++if [ x$reason = xPREINIT6 ] ; then + # Ensure interface is up. + ${ip} link set ${interface} up + +@@ -268,7 +242,7 @@ + exit_with_hooks 0 + fi + +-if [ ${reason} = BOUND6 ] ; then ++if [ x$reason = xBOUND6 ] ; then + if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then + exit_with_hooks 2; + fi +@@ -282,7 +256,7 @@ + exit_with_hooks 0 + fi + +-if [ ${reason} = RENEW6 ] || [ ${reason} = REBIND6 ] ; then ++if [ x$reason = xRENEW6 ] || [ x$reason} = xREBIND6 ] ; then + # Make sure nothing has moved around on us. + + # Nameservers/domains/etc. +@@ -294,7 +268,7 @@ + exit_with_hooks 0 + fi + +-if [ ${reason} = DEPREF6 ] ; then ++if [ x$reason = xDEPREF6 ] ; then + if [ x${new_ip6_prefixlen} = x ] ; then + exit_with_hooks 2; + fi +@@ -307,7 +281,7 @@ + exit_with_hooks 0 + fi + +-if [ ${reason} = EXPIRE6 -o ${reason} = RELEASE6 -o ${reason} = STOP6 ] ; then ++if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then + if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then + exit_with_hooks 2; + fi diff --git a/net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch b/net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch new file mode 100644 index 000000000000..c5bfb150605c --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch @@ -0,0 +1,115 @@ +diff -ur a/client/clparse.c b/client/clparse.c +--- a/client/clparse.c 2008-09-03 21:39:30.000000000 +0100 ++++ b/client/clparse.c 2008-09-03 23:10:48.000000000 +0100 +@@ -172,6 +172,10 @@ + #endif + } + ++ /* Read any extra configuration from stdin */ ++ read_client_conf_stdin ((struct interface_info *)0, ++ &top_level_config); ++ + /* Set up state and config structures for clients that don't + have per-interface configuration statements. */ + config = (struct client_config *)0; +@@ -201,21 +205,13 @@ + return status; + } + +-int read_client_conf_file (const char *name, struct interface_info *ip, +- struct client_config *client) ++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 = (struct parse *)0; +- new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); +- + do { + token = peek_token (&val, (unsigned *)0, cfile); + if (token == END_OF_FILE) +@@ -226,10 +222,74 @@ + status = (cfile -> warnings_occurred + ? ISC_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> +Files a/client/clparse.o and b/client/clparse.o differ +Files a/client/dhclient and b/client/dhclient differ diff --git a/net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch b/net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch new file mode 100644 index 000000000000..948bd878ec15 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch @@ -0,0 +1,25 @@ +diff -uNr dhcp-4.0.0.ORIG/common/socket.c dhcp-4.0.0/common/socket.c +--- dhcp-4.0.0.ORIG/common/socket.c 2008-09-02 10:25:21.000000000 +0100 ++++ dhcp-4.0.0/common/socket.c 2008-09-02 10:27:29.000000000 +0100 +@@ -46,6 +46,10 @@ + #include <sys/uio.h> + #include <sys/uio.h> + ++#ifdef HAVE_LINUX_IPV6_H ++#include <linux/ipv6.h> ++#endif ++ + #ifdef USE_SOCKET_FALLBACK + # if !defined (USE_SOCKET_SEND) + # define if_register_send if_register_fallback +diff -uNr dhcp-4.0.0.ORIG/configure.ac dhcp-4.0.0/configure.ac +--- dhcp-4.0.0.ORIG/configure.ac 2008-09-02 10:25:21.000000000 +0100 ++++ dhcp-4.0.0/configure.ac 2008-09-02 10:26:29.000000000 +0100 +@@ -37,6 +37,7 @@ + if test "$enable_dhcpv6" != "no"; then + AC_DEFINE([DHCPv6], [1], + [Define to 1 to include DHCPv6 support.]) ++ AC_CHECK_HEADERS(linux/ipv6.h) + fi + + ### diff --git a/net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch b/net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch new file mode 100644 index 000000000000..ac37e954b84b --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch @@ -0,0 +1,96 @@ +diff -uNr dhcp-4.0.0.ORIG/client/dhclient.c dhcp-4.0.0/client/dhclient.c +--- dhcp-4.0.0.ORIG/client/dhclient.c 2008-09-01 13:38:38.000000000 +0100 ++++ dhcp-4.0.0/client/dhclient.c 2008-09-01 13:41:32.000000000 +0100 +@@ -80,6 +80,8 @@ + + static isc_result_t write_duid(struct data_string *duid); + ++extern int log_isc_blurb; ++ + int + main(int argc, char **argv) { + int fd; +@@ -323,6 +325,7 @@ + log_info ("%s", ""); + } else { + log_perror = 0; ++ log_isc_blurb = 0; + quiet_interface_discovery = 1; + } + +diff -uNr dhcp-4.0.0.ORIG/omapip/errwarn.c dhcp-4.0.0/omapip/errwarn.c +--- dhcp-4.0.0.ORIG/omapip/errwarn.c 2008-09-01 13:38:38.000000000 +0100 ++++ dhcp-4.0.0/omapip/errwarn.c 2008-09-01 13:39:17.000000000 +0100 +@@ -43,6 +43,8 @@ + int log_perror = 1; + #endif + int log_priority; ++int log_isc_blurb=1; ++ + void (*log_cleanup) (void); + + #define CVT_BUF_MAX 1023 +@@ -74,7 +76,9 @@ + write (STDERR_FILENO, "\n", 1); + } + +-#if !defined (NOMINUM) ++#if !defined(NOMINUM) ++ if ( log_isc_blurb ) ++ { + log_error ("%s", ""); + log_error ("If you did not get this software from ftp.isc.org, please"); + log_error ("get the latest from ftp.isc.org and install that before"); +@@ -92,7 +96,12 @@ + log_error ("the README file."); + log_error ("%s", ""); + log_error ("exiting."); ++ }else ++ { ++ log_error ("exiting."); ++ } + #endif ++ + if (log_cleanup) + (*log_cleanup) (); + exit (1); +diff -uNr dhcp-4.0.0.ORIG/relay/dhcrelay.c dhcp-4.0.0/relay/dhcrelay.c +--- dhcp-4.0.0.ORIG/relay/dhcrelay.c 2008-09-01 13:38:38.000000000 +0100 ++++ dhcp-4.0.0/relay/dhcrelay.c 2008-09-01 13:43:15.000000000 +0100 +@@ -97,6 +97,7 @@ + static char arr [] = "All rights reserved."; + static char message [] = "Internet Systems Consortium DHCP Relay Agent"; + static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/"; ++extern int log_isc_blurb; + + int + main(int argc, char **argv) { +@@ -163,6 +164,7 @@ + } else if (!strcmp (argv [i], "-q")) { + quiet = 1; + quiet_interface_discovery = 1; ++ log_isc_blurb = 0; + } else if (!strcmp (argv [i], "-a")) { + add_agent_options = 1; + } else if (!strcmp (argv [i], "-c")) { +diff -uNr dhcp-4.0.0.ORIG/server/dhcpd.c dhcp-4.0.0/server/dhcpd.c +--- dhcp-4.0.0.ORIG/server/dhcpd.c 2008-09-01 13:38:38.000000000 +0100 ++++ dhcp-4.0.0/server/dhcpd.c 2008-09-01 13:42:37.000000000 +0100 +@@ -61,6 +61,9 @@ + struct iaddr server_identifier; + int server_identifier_matched; + ++ ++extern int log_isc_blurb; ++ + #if defined (NSUPDATE) + + /* This stuff is always executed to figure the default values for certain +@@ -359,6 +362,7 @@ + lftest = 1; + log_perror = -1; + } else if (!strcmp (argv [i], "-q")) { ++ log_isc_blurb = 0; + quiet = 1; + quiet_interface_discovery = 1; + #ifdef DHCPv6 diff --git a/net-misc/dhcp/files/dhcp-4.0-paranoia.patch b/net-misc/dhcp/files/dhcp-4.0-paranoia.patch new file mode 100644 index 000000000000..4c3ce76e6e39 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0-paranoia.patch @@ -0,0 +1,189 @@ +diff -uNr dhcp-4.0.0.ORIG/configure.ac dhcp-4.0.0/configure.ac +--- dhcp-4.0.0.ORIG/configure.ac 2008-09-02 10:57:37.000000000 +0100 ++++ dhcp-4.0.0/configure.ac 2008-09-02 11:00:27.000000000 +0100 +@@ -30,6 +30,17 @@ + [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs) + or LITTLE_ENDIAN for LSB (Intel CPUs).]) + ++# Paranoia/early chrooting is off by default ++AC_ARG_ENABLE(paranoia, ++ AC_HELP_STRING([--enable-paranoia], ++ [enable support for early chroot (default is no)])) ++if test "$enable_paranoia" != "no"; then ++ AC_DEFINE([PARANOIA], [1], ++ [Define to enable paranoia.]) ++ AC_DEFINE([EARLY_CHROOT], [1], ++ [Define to 1 to chroot early.]) ++fi ++ + # DHCPv6 is off by default + AC_ARG_ENABLE(dhcpv6, + AC_HELP_STRING([--enable-dhcpv6], +diff -uNr dhcp-4.0.0.ORIG/server/dhcpd.c dhcp-4.0.0/server/dhcpd.c +--- dhcp-4.0.0.ORIG/server/dhcpd.c 2008-09-02 10:57:37.000000000 +0100 ++++ dhcp-4.0.0/server/dhcpd.c 2008-09-02 10:57:54.000000000 +0100 +@@ -46,6 +46,16 @@ + #include <sys/types.h> + #include <signal.h> + ++#if defined (PARANOIA) ++# include <sys/types.h> ++# include <unistd.h> ++# include <pwd.h> ++/* get around the ISC declaration of group */ ++# define group real_group ++# include <grp.h> ++# undef group ++#endif /* PARANOIA */ ++ + static void usage(void); + + struct iaddr server_identifier; +@@ -195,6 +205,21 @@ + omapi_object_dereference (&listener, MDL); + } + ++#if defined (PARANOIA) ++/* to be used in one of two possible scenarios */ ++static void setup_chroot (char *chroot_dir) { ++ if (geteuid()) ++ log_fatal ("you must be root to use chroot"); ++ if (chroot(chroot_dir)) { ++ log_fatal ("chroot(\"%s\"): %m", chroot_dir); ++ } ++ if (chdir ("/")) { ++ /* probably permission denied */ ++ log_fatal ("chdir(\"/\"): %m"); ++ } ++} ++#endif /* PARANOIA */ ++ + #ifndef UNIT_TEST + int + main(int argc, char **argv) { +@@ -224,6 +249,14 @@ + char *traceinfile = (char *)0; + char *traceoutfile = (char *)0; + #endif ++#if defined (PARANOIA) ++ char *set_user = 0; ++ char *set_group = 0; ++ char *set_chroot = 0; ++ ++ uid_t set_uid = 0; ++ gid_t set_gid = 0; ++#endif /* PARANOIA */ + + /* Make sure that file descriptors 0 (stdin), 1, (stdout), and + 2 (stderr) are open. To do this, we assume that when we +@@ -284,6 +317,20 @@ + if (++i == argc) + usage (); + server = argv [i]; ++#if defined (PARANOIA) ++ } else if (!strcmp (argv [i], "-user")) { ++ if (++i == argc) ++ usage (); ++ set_user = argv [i]; ++ } else if (!strcmp (argv [i], "-group")) { ++ if (++i == argc) ++ usage (); ++ set_group = argv [i]; ++ } else if (!strcmp (argv [i], "-chroot")) { ++ if (++i == argc) ++ usage (); ++ set_chroot = argv [i]; ++#endif /* PARANOIA */ + } else if (!strcmp (argv [i], "-cf")) { + if (++i == argc) + usage (); +@@ -438,6 +485,44 @@ + trace_seed_stop, MDL); + #endif + ++#if defined (PARANOIA) ++ /* get user and group info if those options were given */ ++ if (set_user) { ++ struct passwd *tmp_pwd; ++ ++ if (geteuid()) ++ log_fatal ("you must be root to set user"); ++ ++ if (!(tmp_pwd = getpwnam(set_user))) ++ log_fatal ("no such user: %s", set_user); ++ ++ set_uid = tmp_pwd->pw_uid; ++ ++ /* use the user's group as the default gid */ ++ if (!set_group) ++ set_gid = tmp_pwd->pw_gid; ++ } ++ ++ if (set_group) { ++/* get around the ISC declaration of group */ ++#define group real_group ++ struct group *tmp_grp; ++ ++ if (geteuid()) ++ log_fatal ("you must be root to set group"); ++ ++ if (!(tmp_grp = getgrnam(set_group))) ++ log_fatal ("no such group: %s", set_group); ++ ++ set_gid = tmp_grp->gr_gid; ++#undef group ++ } ++ ++# if defined (EARLY_CHROOT) ++ if (set_chroot) setup_chroot (set_chroot); ++# endif /* EARLY_CHROOT */ ++#endif /* PARANOIA */ ++ + /* Default to the DHCP/BOOTP port. */ + if (!local_port) + { +@@ -576,6 +661,10 @@ + + postconf_initialization (quiet); + ++#if defined (PARANOIA) && !defined (EARLY_CHROOT) ++ if (set_chroot) setup_chroot (set_chroot); ++#endif /* PARANOIA && !EARLY_CHROOT */ ++ + /* test option should cause an early exit */ + if (cftest && !lftest) + exit(0); +@@ -659,6 +748,22 @@ + exit (0); + } + ++#if defined (PARANOIA) ++ /* change uid to the specified one */ ++ ++ if (set_gid) { ++ if (setgroups (0, (void *)0)) ++ log_fatal ("setgroups: %m"); ++ if (setgid (set_gid)) ++ log_fatal ("setgid(%d): %m", (int) set_gid); ++ } ++ ++ if (set_uid) { ++ if (setuid (set_uid)) ++ log_fatal ("setuid(%d): %m", (int) set_uid); ++ } ++#endif /* PARANOIA */ ++ + /* Read previous pid file. */ + if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { + status = read(i, pbuf, (sizeof pbuf) - 1); +@@ -1039,6 +1144,10 @@ + #else /* !DHCPv6 */ + " [-cf config-file] [-lf lease-file]\n" + #endif /* DHCPv6 */ ++#if defined (PARANOIA) ++ /* meld into the following string */ ++ "\n [-user user] [-group group] [-chroot dir]" ++#endif /* PARANOIA */ + #if defined (TRACING) + " [-tf trace-output-file]\n" + " [-play trace-input-file]\n" |