From e687a24136dcc225c94abf37bbfcb75645c260f6 Mon Sep 17 00:00:00 2001 From: geos_one Date: Sat, 1 Nov 2008 18:10:17 +0000 Subject: [PATCH] net-misc/dhcp: Bump git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@513 6952d904-891a-0410-993b-d76249ca496b --- net-misc/dhcp/ChangeLog | 10 + net-misc/dhcp/Manifest | 14 +- net-misc/dhcp/dhcp-4.0.0-r1.ebuild | 218 ++++++++++ .../dhcp/files/dhcp-4.0-dhclient-metric.patch | 205 +++++++++ .../dhcp/files/dhcp-4.0-dhclient-ntp.patch | 216 ++++++++++ .../files/dhcp-4.0-dhclient-resolvconf.patch | 390 ++++++++++++++++++ ....0-dhclient-script-correct-operators.patch | 48 +++ .../files/dhcp-4.0-dhclient-stdin-conf.patch | 115 ++++++ .../files/dhcp-4.0-linux-ipv6-header.patch | 25 ++ .../dhcp/files/dhcp-4.0-no_isc_blurb.patch | 96 +++++ net-misc/dhcp/files/dhcp-4.0-paranoia.patch | 189 +++++++++ net-misc/dhcp/files/dhcp-ebuild.patch | 2 +- 12 files changed, 1525 insertions(+), 3 deletions(-) create mode 100644 net-misc/dhcp/dhcp-4.0.0-r1.ebuild create mode 100644 net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch create mode 100644 net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch create mode 100644 net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch create mode 100644 net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch create mode 100644 net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch create mode 100644 net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch create mode 100644 net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch create mode 100644 net-misc/dhcp/files/dhcp-4.0-paranoia.patch diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog index a2ac637a..bce512b2 100644 --- a/net-misc/dhcp/ChangeLog +++ b/net-misc/dhcp/ChangeLog @@ -2,6 +2,16 @@ # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 01 Nov 2008; Mario Fetka + +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, + files/dhcp-ebuild.patch, +dhcp-4.0.0-r1.ebuild: + Bump + 30 Jul 2008; Mario Fetka +files/dhcp-4.0.0-ldap-1.patch: add 4.0 ldap patch diff --git a/net-misc/dhcp/Manifest b/net-misc/dhcp/Manifest index dccd3e55..dd7c7f6a 100644 --- a/net-misc/dhcp/Manifest +++ b/net-misc/dhcp/Manifest @@ -18,15 +18,25 @@ AUX dhcp-3.0.4-dhclient-stdin-conf.patch 2176 RMD160 fae08899f6b57da3ec7ab0068e2 AUX dhcp-3.0.5-bpf-nofallback.patch 1473 RMD160 1a5ece77cb481416935b0d2eea53e85dc4c4ee93 SHA1 d4cad638075a98606e07c633551c8a1d2f78f2e7 SHA256 b215c5ff4a282b475f28168250c05bbbc85e7c37e7af92616571d499b8c14da6 AUX dhcp-3.1.0-ldap.patch 186418 RMD160 a84a45107f5b050c859a6a78e6a05be48e553364 SHA1 30f60d83e01decf0de6556f4abab85b168071062 SHA256 2c061f5cd90858d9cacc7176c60c1d9f26a6f034daf161c4f4df1e381eed91cb AUX dhcp-3.1.0a1-dhclient-resolvconf.patch 10316 RMD160 183bedd1660bf5a5f9dc7d002199e76aec12341c SHA1 1e0332ea31cfdbe92f3053405587f08117de8f8b SHA256 112b2ed44aab92592eb3810c61ada7f30d9d01fe43b647667326972a37b412a1 +AUX dhcp-4.0-dhclient-metric.patch 8100 RMD160 cd599d5523be30809024b8e0f81cd84e4d932317 SHA1 ba9ff19cc5274b0e3e8408eba4725e0546413954 SHA256 a1c5589ac1c57ba7fe66336646f4286ebd7112f05abf5ae59b69ff26e7409afc +AUX dhcp-4.0-dhclient-ntp.patch 7966 RMD160 d6dd1c3363f06712a82231eae1eb559f5a45bbb5 SHA1 3c1b373c6649c1ccb44f205fbee116c134514f4e SHA256 e93bda7f2baae9163f96ab0408bfbe885caa96a8698f9e566b8a9dc04de9359b +AUX dhcp-4.0-dhclient-resolvconf.patch 14516 RMD160 0a53cbb795c4d4989f5632b6314b69be5bd94611 SHA1 e1db8ecca4de1c45fcec7e93fb13d186931d74f6 SHA256 1cdbb9ed297426b2d44063ffb8642c9c5cdf54dc2f9c3c8f59100f4ab2c40986 +AUX dhcp-4.0-dhclient-script-correct-operators.patch 1382 RMD160 3a37a68c5e9ab44b6f885e1e644f6138557ba45c SHA1 c5459430398b9c92ce9585672860abc6d247c451 SHA256 f5f1a75e9873b141d4b0a0f4fde911e6dfdddf13985e28e1789029ef7a072dfb +AUX dhcp-4.0-dhclient-stdin-conf.patch 3009 RMD160 749a3768dd709b54ad0ce6fc53828e8e777f32c7 SHA1 49d2a5db802431d894c0c790addd7c6752be7070 SHA256 b3136285b6a9099ac1018d768b072c03bd136c1b5bffa58e48c5101dfe79cd83 +AUX dhcp-4.0-linux-ipv6-header.patch 817 RMD160 cd395ba33c6e729862af7a3c869d412e91ad5b41 SHA1 1e268892009a58caa8b6030be192a25583a96dd5 SHA256 dbb6f22c99dcf31fd91f89061398dea194476d37a1e328736adaff6fe2f00c6d +AUX dhcp-4.0-no_isc_blurb.patch 2748 RMD160 f29d8705fab63320c18c6319dd5703a51acc1687 SHA1 d8af8f4567e4bdbfac5d8e5455dede87a188ad40 SHA256 603e9a6f28264e35513f40f987d10e4fdce6d5e4f8d48aa46f83b8687d57dff0 +AUX dhcp-4.0-paranoia.patch 4996 RMD160 2f8339e3d8af9164c91cc5a3bab7605ecd728295 SHA1 94db8a07b82b69d0a05645b08ef5d0ec0b99bd19 SHA256 14d328d400cdc1b4d7d6329d9c8e997b2c5e76e8f21330e267a75d6240799058 AUX dhcp-4.0.0-ldap-1.patch 173862 RMD160 73a7d17638eeb47a93386281fc1d25c7b15f2d6f SHA1 da02fb9b0865b17fb94b6840dbddb2267d4617d7 SHA256 445379243ea745a7389fbb5a37dd77d2ca6b644baace2d843453a26d42038af8 -AUX dhcp-ebuild.patch 1058 RMD160 cac2599e02559a1121fdb59d81ef6eb75a4b5176 SHA1 678d14435dec874a33661f471796d88a025ccc74 SHA256 940cf75efd99f26135fbcb3032229f5c1c7ca032ea0236ea20dbd74b01c8aedb +AUX dhcp-ebuild.patch 1058 RMD160 41ee0def17846786c19cf88695dbe0d2886ddbcf SHA1 cc32b5a520649b68a35179bf71dd464d70a470df SHA256 00b4963336a23d860c4d095178acf8086fa2ea930611992a0a9ad87a5e58189c AUX dhcpd.conf 1092 RMD160 936bb112c7cdf8e669b695599252d1f6626be2f3 SHA1 cbabbcea73a0cbc9692462683b983c96d6f18b0c SHA256 b86d27e0560689057b01a352474582fceb3a398eaf3b17f901378ec56284c4d5 AUX dhcpd.init 1989 RMD160 7f6b6858020100e47efa5d6a0809b2959e551249 SHA1 2c611adc6425fd095740aa56d09d8aafb4fea58a SHA256 916bfeb81dcb3423fd4239270ac2dce2e6dc105b28a06e03b352f6bf6b30ed1e AUX dhcrelay.conf 421 RMD160 456edbc9bcc8d3a44db5bb6dbf0c3003c3e7419c SHA1 78ecdb000382893fb49d0052ced063955b0ad9cf SHA256 409b895ed489e75c1a08f72961b45d641b93fd9357f528abc78b1fd036b7f730 AUX dhcrelay.init 736 RMD160 04566b87bd6dbb8bb754b26409ca30b878ef3ca3 SHA1 72742b308314b2e1476b27e94212fbf4d179adc4 SHA256 cfdaff3a723be3935d06c14e171d4008f2ad3329bd05ac2e49c19bc0e14bc59c DIST dhcp-3.1.0.tar.gz 797100 RMD160 59ef8b695b66d3cb61437e25a179d9f17639017d SHA1 f33d017f055648e6571aa26cf314d37857491a2e SHA256 26d02217f53e40ab7c7140cf58d99b55a64979c8501481b28da9c432f0f92243 DIST dhcp-3.1.1.tar.gz 798228 RMD160 08ed15d26ca64928e1d3b07c631cbbfa9a3dc8cb SHA1 3f7e013cb62aed0f3af45bdd97424d8b63e9c280 SHA256 129024c7545e3e8d37e75cd5d534b50c53955592c4935189a57916e216355f6d +DIST dhcp-4.0.0.tar.gz 1043725 RMD160 86963598124617bc7d1059262c75176db431f26d SHA1 acb4ab7634ba002893b15baba1443ef4d6c92201 SHA256 8efee52b567e934d0e80fb33f17dc0cc9f43892dc2e177a242eddebd64e23c68 EBUILD dhcp-3.1.0-r1.ebuild 7622 RMD160 831ed83951cf678c02ea5b2a7b6c0c873009270f SHA1 a1be08f55e97189d6cde851491b410294db6c6c0 SHA256 a7ca880b7af8422ed152f09eb9c5917b6c3186d51f2a87ab043eae560b94d127 EBUILD dhcp-3.1.1-r1.ebuild 7627 RMD160 be9c724df2ed0914b35aaf5fd3e84668abc8876e SHA1 d25967f3fc46afbd60b8eb38573e175efdfe2a69 SHA256 bb9c72fa54c65b5bccb0fb4b155fd84a71ae198deb3ea6abe2c617364d18601a -MISC ChangeLog 423 RMD160 d76a1ec5544cd5ed13687fe39f5bae58661e0ba0 SHA1 15c016c1032bfb410c63f85e41815be82c4b6778 SHA256 ea486e945f5cfbdca565568b9427c14328e937d306bd010aefd3773c257a6310 +EBUILD dhcp-4.0.0-r1.ebuild 6928 RMD160 b64f080ddd84c08e1101dd31c60a2924e6cbb997 SHA1 49253dae217afb93d7988b79986c9b4369b17884 SHA256 ac73f2c317f58de897bf2f3ddab6b067c0901501d477f5ae1d57f6b1a37efd93 +MISC ChangeLog 871 RMD160 05b6b5dfbb6945a6c37902976a6323d2c7ba9a96 SHA1 b48e452eea82cbf2b03ba003de1f72e2c40f7363 SHA256 9cee63899dac8ec03f8d13689a837085915278147b1b9976f45d3b882a77c417 MISC metadata.xml 170 RMD160 645927a396fdc21cdeb089fe42c5397332420ea6 SHA1 ac7f48a14fec325926f9ce1be8fbf1f311b4f2e4 SHA256 d797a2ec6f9dc516c9f9c1a758ee87ad3e8c43101b5dc76c2f872d5bd4639b42 diff --git a/net-misc/dhcp/dhcp-4.0.0-r1.ebuild b/net-misc/dhcp/dhcp-4.0.0-r1.ebuild new file mode 100644 index 00000000..c3eb58ab --- /dev/null +++ b/net-misc/dhcp/dhcp-4.0.0-r1.ebuild @@ -0,0 +1,218 @@ +# 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.2 2008/10/26 03:45:20 vapier 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="doc ipv6 selinux kernel_linux vim-syntax ldap" + +DEPEND="selinux? ( sec-policy/selinux-dhcp ) + kernel_linux? ( sys-apps/net-tools ) + vim-syntax? ( app-vim/dhcpd-syntax ) + ldap? ( net-nds/openldap )" + +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 + + # Ldap support patch + # Add ldap support to dhcpd + use ldap && epatch "${FILESDIR}/${PN}"-4.0.0-ldap-1.patch + + # Brand the version with Gentoo + # include revision if >0 + local newver="Gentoo" + use ldap && local newver="Gentoo-LDAP" + [[ ${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 00000000..cca3e2b1 --- /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 00000000..d3f29714 --- /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 00000000..063b8e33 --- /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 00000000..7cf0b241 --- /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 00000000..c5bfb150 --- /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 :== +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 00000000..948bd878 --- /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 + #include + ++#ifdef HAVE_LINUX_IPV6_H ++#include ++#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 00000000..ac37e954 --- /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 00000000..4c3ce76e --- /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 + #include + ++#if defined (PARANOIA) ++# include ++# include ++# include ++/* get around the ISC declaration of group */ ++# define group real_group ++# include ++# 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" diff --git a/net-misc/dhcp/files/dhcp-ebuild.patch b/net-misc/dhcp/files/dhcp-ebuild.patch index c7eb2ed4..a43e7329 100644 --- a/net-misc/dhcp/files/dhcp-ebuild.patch +++ b/net-misc/dhcp/files/dhcp-ebuild.patch @@ -1,5 +1,5 @@ --- dhcp-3.1.0.ebuild 2008-01-10 10:36:28.000000000 +0100 -+++ dhcp-3.1.0-r1.ebuild 2008-07-30 14:55:17.000000000 +0200 ++++ dhcp-4.0.0-r1.ebuild 2008-07-30 14:55:17.000000000 +0200 @@ -15,10 +15,11 @@ LICENSE="isc-dhcp" SLOT="0"