diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-03-05 23:59:20 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-03-05 23:59:20 +0000 |
commit | 4c8dc14303fbc8e4b80e32237bdcb6c5401b8e2c (patch) | |
tree | 9577c91e941ded5365b7f6e80b64679a51babb72 /net-misc/dhcp | |
parent | old (diff) | |
download | gentoo-2-4c8dc14303fbc8e4b80e32237bdcb6c5401b8e2c.tar.gz gentoo-2-4c8dc14303fbc8e4b80e32237bdcb6c5401b8e2c.tar.bz2 gentoo-2-4c8dc14303fbc8e4b80e32237bdcb6c5401b8e2c.zip |
Version bump #309133 by Milan Dadok, #325605 by Stefan Behte, and #352897 by Paweł Hajdan, Jr. Add ldap support #160979 by Nico. Allow dhcp init.d script to be multiplexed #238277 by Roy Marples. Respect nogateway option by Laszlo Valko #265531 by Dmitry. Fix up chroot config checking by Lance Albertson #278335 by Arthur Hagen. Include full DHCPD_OPTS when checking the config #283352 by Marc. Update path to dhcrelay.pid #309129 by Milan Dadok.
(Portage version: 2.1.9.25/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/dhcp')
-rw-r--r-- | net-misc/dhcp/ChangeLog | 19 | ||||
-rw-r--r-- | net-misc/dhcp/dhcp-4.2.1.ebuild | 204 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch | 31 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch | 384 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch | 46 | ||||
-rwxr-xr-x | net-misc/dhcp/files/dhcpd.init3 | 94 | ||||
-rwxr-xr-x | net-misc/dhcp/files/dhcrelay.init2 | 29 |
7 files changed, 805 insertions, 2 deletions
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog index 080b3762fcee..9e69182a9a1c 100644 --- a/net-misc/dhcp/ChangeLog +++ b/net-misc/dhcp/ChangeLog @@ -1,6 +1,21 @@ # ChangeLog for net-misc/dhcp -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.167 2010/10/15 05:15:23 robbat2 Exp $ +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.168 2011/03/05 23:59:20 vapier Exp $ + +*dhcp-4.2.1 (05 Mar 2011) + + 05 Mar 2011; Mike Frysinger <vapier@gentoo.org> + +files/dhcp-4.2.0-errwarn-message.patch, +dhcp-4.2.1.ebuild, + +files/dhcp-4.2.1-dhclient-resolvconf.patch, + +files/dhcp-4.2.1-nogateway.patch, +files/dhcpd.init3, + +files/dhcrelay.init2: + Version bump #309133 by Milan Dadok, #325605 by Stefan Behte, and #352897 + by Paweł Hajdan, Jr. Add ldap support #160979 by Nico. Allow dhcp init.d + script to be multiplexed #238277 by Roy Marples. Respect nogateway option + by Laszlo Valko #265531 by Dmitry. Fix up chroot config checking by Lance + Albertson #278335 by Arthur Hagen. Include full DHCPD_OPTS when checking + the config #283352 by Marc. Update path to dhcrelay.pid #309129 by Milan + Dadok. *dhcp-3.1.3_p1 (15 Oct 2010) diff --git a/net-misc/dhcp/dhcp-4.2.1.ebuild b/net-misc/dhcp/dhcp-4.2.1.ebuild new file mode 100644 index 000000000000..e21a9e7d7d2e --- /dev/null +++ b/net-misc/dhcp/dhcp-4.2.1.ebuild @@ -0,0 +1,204 @@ +# 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.1.ebuild,v 1.1 2011/03/05 23:59:20 vapier Exp $ + +EAPI="2" + +inherit eutils + +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="doc ipv6 ldap selinux ssl kernel_linux 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 ) + )" + +PROVIDE="virtual/dhcpc" + +S="${WORKDIR}/${MY_P}" + +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.1-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.0.1-dhclient-stdin-conf.patch + epatch "${FILESDIR}"/${PN}-4.2.1-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 + + # 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 +} + +src_configure() { + 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) +} + +src_install() { + emake install DESTDIR="${D}" || die + + # 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 + + if use ldap ; then + insinto /etc/openldap/schema + doins contrib/ldap/dhcp.* || die + dosbin contrib/ldap/dhcpd-conf-to-ldap || die + fi + + use doc && dodoc README RELNOTES doc/* + + insinto /etc/dhcp + doins client/dhclient.conf server/dhcpd.conf || die + newinitd "${FILESDIR}"/dhcpd.init3 dhcpd + newinitd "${FILESDIR}"/dhcrelay.init2 dhcrelay + newconfd "${FILESDIR}"/dhcpd.conf dhcpd + newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay + + keepdir /var/{lib,run}/dhcp + keepdir /var/lib/dhclient +} + +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.0-errwarn-message.patch b/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch new file mode 100644 index 000000000000..f882a1345f35 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch @@ -0,0 +1,31 @@ +ripped from Fedora & tweaked + +--- dhcp-4.2.0/omapip/errwarn.c ++++ dhcp-4.2.0/omapip/errwarn.c +@@ -76,20 +76,13 @@ + + #if !defined (NOMINUM) + 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"); +- log_error ("requesting help."); ++ log_error ("This version of ISC DHCP is based on the release available"); ++ log_error ("on ftp.isc.org. Features have been added and other changes"); ++ log_error ("have been made to the base software release in order to make"); ++ log_error ("it work better with this distribution."); + log_error ("%s", ""); +- log_error ("If you did get this software from ftp.isc.org and have not"); +- log_error ("yet read the README, please read it before requesting help."); +- log_error ("If you intend to request help from the dhcp-server@isc.org"); +- log_error ("mailing list, please read the section on the README about"); +- log_error ("submitting bug reports and requests for help."); +- log_error ("%s", ""); +- log_error ("Please do not under any circumstances send requests for"); +- log_error ("help directly to the authors of this software - please"); +- log_error ("send them to the appropriate mailing list as described in"); +- log_error ("the README file."); ++ log_error ("Please report for this software via the Gentoo Bugzilla site:"); ++ log_error (" http://bugs.gentoo.org/"); + log_error ("%s", ""); + log_error ("exiting."); + #endif diff --git a/net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch new file mode 100644 index 000000000000..6d8caecdf938 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch @@ -0,0 +1,384 @@ +--- a/client/scripts/bsdos ++++ b/client/scripts/bsdos +@@ -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 + } +--- a/client/scripts/freebsd ++++ b/client/scripts/freebsd +@@ -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 + } +--- a/client/scripts/linux ++++ b/client/scripts/linux +@@ -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 + } +--- a/client/scripts/netbsd ++++ b/client/scripts/netbsd +@@ -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 + } +--- a/client/scripts/openbsd ++++ b/client/scripts/openbsd +@@ -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 + } +--- a/client/scripts/solaris ++++ b/client/scripts/solaris +@@ -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.2.1-nogateway.patch b/net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch new file mode 100644 index 000000000000..11aaacefd476 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch @@ -0,0 +1,46 @@ +http://bugs.gentoo.org/265531 + +--- dhcp-4.2.1/client/scripts/linux ++++ dhcp-4.2.1/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 + fi + if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; + then +@@ -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/dhcpd.init3 b/net-misc/dhcp/files/dhcpd.init3 new file mode 100755 index 000000000000..3b00531429a0 --- /dev/null +++ b/net-misc/dhcp/files/dhcpd.init3 @@ -0,0 +1,94 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init3,v 1.1 2011/03/05 23:59:20 vapier Exp $ + +opts="configtest" + +DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/${SVCNAME}.conf} + +depend() { + need net + use logger dns +} + +get_var() { + sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \ + "${DHCPD_CHROOT}/${DHCPD_CONF}" +} + +checkconfig() { + dhcpd ${DHCPD_OPTS} ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} -t 1>/dev/null 2>&1 + local ret=$? + if [ $ret -ne 0 ] ; then + eerror "${SVCNAME} has detected a syntax error in your configuration files:" + dhcpd ${DHCPD_OPTS} ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} -t + fi + + return $ret +} + +configtest() { + ebegin "Checking ${SVCNAME} configuration" + checkconfig + eend $? +} + +start() { + # 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 + + if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then + eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist" + return 1 + fi + + checkconfig || return 1 + + checkpath -d -o dhcp:dhcp /var/run/dhcp /var/lib/dhcp + + local leasefile="$(get_var lease-file-name)" + leasefile="${leasefile:-/var/lib/dhcp/${SVCNAME}.leases}" + if [ ! -f "${DHCPD_CHROOT}${leasefile}" ] ; then + ebegin "Creating ${leasefile}" + touch "${DHCPD_CHROOT}${leasefile}" + chown dhcp:dhcp "${DHCPD_CHROOT}${leasefile}" + eend $? || return 1 + fi + + # Setup LD_PRELOAD so name resolution works in our chroot. + if [ -n "${DHCPD_CHROOT}" ] ; then + LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so" + export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so" + fi + + local pidfile="$(get_var pid-file-name)" + pidfile="${pidfile:-/var/run/dhcp/${SVCNAME}.pid}" + + ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}" + start-stop-daemon --start --exec /usr/sbin/dhcpd \ + --pidfile "${DHCPD_CHROOT}/${pidfile}" \ + -- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \ + -user dhcp -group dhcp \ + ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} ${DHCPD_IFACE} + eend $? \ + && save_options chroot "${DHCPD_CHROOT}" \ + && save_options pidfile "${pidfile}" +} + +stop() { + local chroot="$(get_options chroot)" + + ebegin "Stopping ${chroot:+chrooted }${SVCNAME}" + start-stop-daemon --stop --exec /usr/sbin/dhcpd \ + --pidfile "${chroot}/$(get_options pidfile)" + eend $? +} diff --git a/net-misc/dhcp/files/dhcrelay.init2 b/net-misc/dhcp/files/dhcrelay.init2 new file mode 100755 index 000000000000..08cfb594b831 --- /dev/null +++ b/net-misc/dhcp/files/dhcrelay.init2 @@ -0,0 +1,29 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcrelay.init2,v 1.1 2011/03/05 23:59:20 vapier Exp $ + +depend() { + need net + use logger +} + +start() { + if [ -z "${DHCRELAY_SERVERS}" ]; then + eerror "No DHCRELAY_SERVERS specified in /etc/conf.d/dhcrelay" + return 1 + fi + + checkpath -d /var/run/dhcp + + ebegin "Starting dhcrelay" + start-stop-daemon --start --exec /usr/sbin/dhcrelay \ + -- -q $(printf -- '-i %s ' ${IFACES}) ${DHCRELAY_OPTS} ${DHCRELAY_SERVERS} + eend $? +} + +stop() { + ebegin "Stopping dhcrelay" + start-stop-daemon --stop --pidfile /var/run/dhcp/dhcrelay.pid + eend $? +} |