Version bump for security #378799, and fix cross-compiling.
authorMike Frysinger <vapier@gentoo.org>
Fri, 26 Aug 2011 02:39:43 +0000 (02:39 +0000)
committerMike Frysinger <vapier@gentoo.org>
Fri, 26 Aug 2011 02:39:43 +0000 (02:39 +0000)
Package-Manager: portage-2.2.0_alpha51/cvs/Linux x86_64

net-misc/dhcp/ChangeLog
net-misc/dhcp/Manifest
net-misc/dhcp/dhcp-4.2.2.ebuild [new file with mode: 0644]
net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch [new file with mode: 0644]
net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch [new file with mode: 0644]
net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch [new file with mode: 0644]

index a38aa419afa5fed2874baa2c4dbacda9e89dfe4a..04274008b2a687fc82423f7d32a1dcd46021fc06 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for net-misc/dhcp
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.180 2011/05/01 09:50:20 xarthisius Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.181 2011/08/26 02:39:43 vapier Exp $
+
+*dhcp-4.2.2 (26 Aug 2011)
+
+  26 Aug 2011; Mike Frysinger <vapier@gentoo.org> +dhcp-4.2.2.ebuild,
+  +files/dhcp-4.2.2-dhclient-resolvconf.patch,
+  +files/dhcp-4.2.2-dhclient-stdin-conf.patch,
+  +files/dhcp-4.2.2-nogateway.patch:
+  Version bump for security #378799, and fix cross-compiling.
 
   01 May 2011; Kacper Kowalik <xarthisius@gentoo.org> dhcp-3.1.3_p1.ebuild:
   ppc64 stable wrt #360047
index aab5f6d738fe6ad0a067c347f01b3b28e891ab35..a42f2432b19a2bc58283022cd2fa7cfa63b8fdcb 100644 (file)
@@ -1,5 +1,5 @@
 -----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
+Hash: SHA256
 
 AUX dhcp-3.0-fix-perms.patch 485 RMD160 3857270dffed5feee95609aeb37d0c9ef8844945 SHA1 1217265a8a7f1416b781e9f79e8dfb8304268e6c SHA256 a805a60b36e148886887aebb797e80f642386b3e55ef4a0b5132f96a2877e018
 AUX dhcp-3.0-paranoia.patch 5366 RMD160 7c64e3dac5b07ff3859fcaa7a8b0e52a0c50446c SHA1 a30103c138e480766f84644fffb1d0897709c27d SHA256 a8db9eb98397a9c1b3a0de07fc107c39dc4f6a4a331d404fc6fcc4a8dbc7aeae
@@ -22,6 +22,9 @@ AUX dhcp-4.0.1-dhclient-stdin-conf.patch 2965 RMD160 2c3dd3994f0a7f15f3fe51972dd
 AUX dhcp-4.2.0-errwarn-message.patch 1508 RMD160 604c680c22b620ae11e4c1ab83902a0c3dacaa62 SHA1 8d645f2510dac8c68d6114cb3f3c0077d832f8c0 SHA256 e2baa7b6097a6ca20b66afcd7b0e399840a8b0f251b3750a49a03f0d5b714231
 AUX dhcp-4.2.1-dhclient-resolvconf.patch 13742 RMD160 e226e793ab4d1302dbaf288c3077f3f6c8758b97 SHA1 d4ea97c3383c7f7769ab36c8d36674a3297dc1f9 SHA256 ddc284623b421098702d3e0cc1849b37c015e78dc510aa7efdd2e5fc9b6a849c
 AUX dhcp-4.2.1-nogateway.patch 1648 RMD160 820956e072e4a84ffabdee6714377ae23827b7bf SHA1 5c6c8118ee6b4b8524451827756aab052766ca09 SHA256 694caca5fbcf900cef2223307a43fb21a66fd672728cebfd873313730029acc4
+AUX dhcp-4.2.2-dhclient-resolvconf.patch 14535 RMD160 7527ea3e52a6913ae3ba2d8a6e07cc3d1c04f492 SHA1 02d83d591d361d6a6543245b39a51531f8926cc4 SHA256 a87f33e33fc3f3a103264909cc85c477036949f2c00c428d562c12b560f09877
+AUX dhcp-4.2.2-dhclient-stdin-conf.patch 3017 RMD160 9d43cb04b50ca91c680b195eb33ca68c2d06a2a7 SHA1 5ceb5ea6ec3c444df14c04585ff1482ffe8b9e35 SHA256 701da4d022490bf9e1cfd946c752a00a2d2ab9a1fd5030281c1608f367cc68fe
+AUX dhcp-4.2.2-nogateway.patch 1671 RMD160 bf401172a4c379f4c51c7afcd912c3e7faef6140 SHA1 1a82353a031d49ecc27441bbb9640de9e6ff5530 SHA256 3fed5823812c134e1819c8ac10c5fc718df86f4013ffc7505efbbe692319480e
 AUX dhcpd.conf 1092 RMD160 936bb112c7cdf8e669b695599252d1f6626be2f3 SHA1 cbabbcea73a0cbc9692462683b983c96d6f18b0c SHA256 b86d27e0560689057b01a352474582fceb3a398eaf3b17f901378ec56284c4d5
 AUX dhcpd.init2 2421 RMD160 baa01ae97b227edba7653cd51735613be2dac652 SHA1 f2068ceb2d79d7992f46b31e6a6e3277a0167dce SHA256 fef93e5a7264780044a977ade27e9cc70de824063791bcd07d3db81c11c16df5
 AUX dhcpd.init3 2525 RMD160 d56c77e6f2e3981c78c3fefad04347615e9d9d60 SHA1 c04f470d0cc3b262cf87cc766ceee5a35aec8b43 SHA256 69f5e6bee391a9a03554bead07c9dd5775e1fbb2a0ae515b7930cec328a8959c
@@ -31,17 +34,17 @@ AUX dhcrelay.init2 712 RMD160 2baeaf7c0fb8a5796792b5721f32104907243798 SHA1 ced2
 DIST dhcp-3.1-ESV.tar.gz 797454 RMD160 c6a8d943240dde72d47bb9bfbd740ff6e68ceee9 SHA1 e1cce81ead844fbdaf7ad99ba1146efa0b8b72c0 SHA256 e316b7dc34f05e38724273a473f823719281f229a71a80bc358f8e74687fd7d7
 DIST dhcp-3.1.2p1.tar.gz 792355 RMD160 53434f8404c69e8e113cad030ec975cf13b467cc SHA1 730214fa6e70d187f1492aa3d4f1c2868ffcc8de SHA256 e0cb405e0fef0ecebec7aaed294032a06178ff28be87498596e6069ccda4341e
 DIST dhcp-4.2.1-P1.tar.gz 8797289 RMD160 e3607828ea12eb718c0877430f9607d336d78c36 SHA1 7767019313b4128357054a1eb053c66799831dd6 SHA256 6cd5e06512c53ad43d71400f39071ce0bd07f074e416c727d5bc7e5949ec55ec
+DIST dhcp-4.2.2.tar.gz 8764108 RMD160 a7d0a66a6156cc2194a784b120587ffd5e8e200e SHA1 a2d5d5bf0fb2a98e9e3e18b243d0a07e12837f81 SHA256 846ee115bd3a789ef4d8d051e1078b920b152c5644179c1a28ed59aa1b5ee38c
 EBUILD dhcp-3.1.2_p1.ebuild 7582 RMD160 d7f42417b80f9f17e0c8c217c978707506802a22 SHA1 be9987191d730c6065c74fc8c9e8835e5d229561 SHA256 4ebe414e6dc4ce6f6b9ebf4f0bfd44b6af03330ff48c39ad7c9987ac1cae624f
 EBUILD dhcp-3.1.3_p1.ebuild 7741 RMD160 62ef4cf524beadef2847675416ea5982f23a3f8e SHA1 3995b5c53d6b11fde440cf43c0dacac31f084d72 SHA256 7a71c86e1685858826a09f28dff77d69a98ec1d37c93bbb6e4dd216af00ce96c
 EBUILD dhcp-4.2.1_p1.ebuild 6610 RMD160 0d058e755de185a58fc62a3d047021671de9a54a SHA1 5cf96d94250ba44b3120ae6a961c04e4f01996b5 SHA256 70534d654d5a2d02ea009d87f77bf86724ee94b7587f5b6959eef90475e5062a
-MISC ChangeLog 30822 RMD160 5eeec9e209c25713cd4fa5e571894786bdcbae94 SHA1 9771b84596725acb7ad6fd504aecf84af01307ae SHA256 0e35e1cc9129d27728a3a454c86d1b587931177df25879cd64177f113bad0839
+EBUILD dhcp-4.2.2.ebuild 7506 RMD160 858a51a5a336aeab1809bc2383e71eed372e87fd SHA1 8e8270d80c7d9defd6b1231552cd171e29b11bc3 SHA256 06a2c6950172ac2d0f180e94f43e55f16e0f0c009560970822435ef4b83e5e3c
+MISC ChangeLog 31109 RMD160 4165e99bfcb956de24846239e2c357c19c6acf27 SHA1 668988ef302695edaefc0367c43a62c963393eb0 SHA256 805ca6c7bb74e93d84b498278bcf7b7b34dd81915a66d9bb744a3154bd218922
 MISC metadata.xml 500 RMD160 b5ad909ab2b12acd20e78039e33fda0a27383c9e SHA1 2fc5cee8e105e75a251195254c96085a0f3fa9a3 SHA256 e9e4edcf7671391ee2f2af0917a75fc07883f1401aaa22b72dd0133bef81601c
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.17 (GNU/Linux)
 
-iJwEAQECAAYFAk29LOUACgkQIiMqcbOVdxToLgP+OcQiMGtKaJtYtbszn1hZYIqR
-HxgLP86vHiNPsmudXYXJ/lK3ygJkZLj145DbUIjyzvAlxLWEypcw7OrBDkS9GZ4E
-twuDHWNk/GRf+filAXrZ/pvJR0EpWXoETEy6fEhLo4sdtduBRX6HnqddZDRcx3q0
-mpqDb3dVQA7mBmerePM=
-=y6V6
+iF4EAREIAAYFAk5XB3cACgkQaC/OocHi7JZ8aQEAg84+70JXyuRHp6y2I4baAlBS
+ATgQ+Yqw7J/YyOUUbPEBAJyvsGGyuszN6KPRBqZJqK637+oC+sfPzcer2+6Wclsc
+=HUNX
 -----END PGP SIGNATURE-----
diff --git a/net-misc/dhcp/dhcp-4.2.2.ebuild b/net-misc/dhcp/dhcp-4.2.2.ebuild
new file mode 100644 (file)
index 0000000..48dd91d
--- /dev/null
@@ -0,0 +1,259 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-4.2.2.ebuild,v 1.1 2011/08/26 02:39:43 vapier Exp $
+
+EAPI="2"
+
+inherit eutils toolchain-funcs
+
+MY_PV="${PV//_alpha/a}"
+MY_PV="${MY_PV//_beta/b}"
+MY_PV="${MY_PV//_rc/rc}"
+MY_PV="${MY_PV//_p/-P}"
+MY_P="${PN}-${MY_PV}"
+DESCRIPTION="ISC Dynamic Host Configuration Protocol (DHCP) client/server"
+HOMEPAGE="http://www.isc.org/products/DHCP"
+SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz"
+
+LICENSE="as-is BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="+client ipv6 kernel_linux ldap selinux +server ssl vim-syntax"
+
+DEPEND="selinux? ( sec-policy/selinux-dhcp )
+       kernel_linux? ( sys-apps/net-tools )
+       vim-syntax? ( app-vim/dhcpd-syntax )
+       ldap? (
+               net-nds/openldap
+               ssl? ( dev-libs/openssl )
+       )"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+       unpack ${A}
+       # handle local bind hell
+       cd "${S}"/bind
+       unpack ./bind.tar.gz
+}
+
+src_prepare() {
+       # Gentoo patches - these will probably never be accepted upstream
+       # 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.2.2-dhclient-resolvconf.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
+       epatch "${FILESDIR}"/${PN}-4.2.0-errwarn-message.patch
+       # Enable dhclient to get extra configuration from stdin
+       epatch "${FILESDIR}"/${PN}-4.2.2-dhclient-stdin-conf.patch
+       epatch "${FILESDIR}"/${PN}-4.2.2-nogateway.patch #265531
+
+       # 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
+       sed -i \
+               -e "/VERSION=/s:'$: Gentoo-${PR}':" \
+               configure || 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
+
+       if use client && ! use server ; then
+               sed -i -r \
+                       -e '/^SUBDIRS/s:\<(dhcpctl|relay|server)\>::g' \
+                       Makefile.in || die
+       elif ! use client && use server ; then
+               sed -i -r \
+                       -e '/^SUBDIRS/s:\<client\>::' \
+                       Makefile.in || die
+       fi
+
+       # 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
+       rm -rf doc/ja_JP.eucJP
+
+       # make the bind build work
+       binddir=${S}/bind
+       cat <<-EOF > "${binddir}"/bindvar.tmp
+       binddir=${binddir}
+       GMAKE=${MAKE:-gmake}
+       EOF
+       sed -i '/^all:/s,$,\nfoo:,' "${binddir}"/Makefile || die
+       # since the bind source is dynamic, sed it rather than patch
+       sed -i -r \
+               -e '/CC.*ALL_CFLAGS/{
+                       s:(CC):BUILD_\1:;
+                       s:ALL(_CFLAGS.):BUILD\1 $(CINCLUDES):;
+                       s:(LDFLAGS):BUILD_\1:
+               }' \
+               -e '/BUILD_CC/s:ISC_INCLUDES:CINCLUDES:' \
+               "${binddir}"/bind-*/lib/export/dns/Makefile.in || die
+}
+
+src_configure() {
+       tc-export BUILD_CC
+
+       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-cli6-pid-file=/var/run/dhcp/dhclient6.pid \
+               --with-cli6-lease-file=/var/lib/dhcp/dhclient6.leases \
+               --with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
+               --with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
+               --with-srv6-pid-file=/var/run/dhcp/dhcpd6.pid \
+               --with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
+               --with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
+               $(use_enable ipv6 dhcpv6) \
+               $(use_with ldap) \
+               $(use ldap && use_with ssl ldapcrypto || echo --without-ldapcrypto)
+
+       # configure local bind cruft
+       cd bind/bind-*/ || die
+       eval econf $(sed -n '/ [.].configure /{s:^[^-]*::;s:>.*::;p}' ../Makefile)
+}
+
+src_compile() {
+       # build local bind cruft first
+       emake -C bind/bind-*/lib/export install || die
+       # then build standard dhcp code
+       emake || die
+}
+
+src_install() {
+       emake install DESTDIR="${D}" || die
+
+       dodoc README RELNOTES doc/{api+protocol,IANA-arp-parameters}
+       dohtml doc/References.html
+
+       if [[ -e client/dhclient ]] ; then
+               # move the client to /
+               dodir /sbin
+               mv "${D}"/usr/sbin/dhclient "${D}"/sbin/ || die
+
+               exeinto /sbin
+               if use kernel_linux ; then
+                       newexe "${S}"/client/scripts/linux dhclient-script || die
+               else
+                       newexe "${S}"/client/scripts/freebsd dhclient-script || die
+               fi
+
+               insinto /etc/dhcp
+               doins client/dhclient.conf || die
+
+               keepdir /var/lib/dhclient
+       fi
+
+       if [[ -e server/dhcpd ]] ; then
+               if use ldap ; then
+                       insinto /etc/openldap/schema
+                       doins contrib/ldap/dhcp.* || die
+                       dosbin contrib/ldap/dhcpd-conf-to-ldap || die
+               fi
+
+               newinitd "${FILESDIR}"/dhcpd.init3 dhcpd
+               newinitd "${FILESDIR}"/dhcrelay.init2 dhcrelay
+               newconfd "${FILESDIR}"/dhcpd.conf dhcpd
+               newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
+
+               insinto /etc/dhcp
+               doins server/dhcpd.conf || die
+
+               keepdir /var/{lib,run}/dhcp
+       fi
+}
+
+pkg_preinst() {
+       enewgroup dhcp
+       enewuser dhcp -1 -1 /var/lib/dhcp dhcp
+
+       # Keep the user files over the sample ones
+       local f
+       for f in dhclient dhcpd ; do
+               f="/etc/dhcp/${f}.conf"
+               if [ -e "${ROOT}"${f} ] ; then
+                       cp -p "${ROOT}"${f} "${D}"${f}
+               fi
+       done
+}
+
+pkg_postinst() {
+       chown -R 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.2.2-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch
new file mode 100644 (file)
index 0000000..95a0d65
--- /dev/null
@@ -0,0 +1,409 @@
+--- 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.2.2-dhclient-stdin-conf.patch b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
new file mode 100644 (file)
index 0000000..bf5a54c
--- /dev/null
@@ -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 (file)
index 0000000..27fb2b0
--- /dev/null
@@ -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