From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QZNYL-0007yK-UD for garchives@archives.gentoo.org; Wed, 22 Jun 2011 13:33:14 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 153101C136; Wed, 22 Jun 2011 13:33:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 63A671C136 for ; Wed, 22 Jun 2011 13:33:02 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B61602AC012 for ; Wed, 22 Jun 2011 13:33:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 2BABB8003C for ; Wed, 22 Jun 2011 13:33:01 +0000 (UTC) From: "Alexey Shvetsov" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alexey Shvetsov" Message-ID: Subject: [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/ X-VCS-Repository: proj/sci X-VCS-Files: net-misc/dhcp/dhcp-4.2.1_p1-r1.ebuild net-misc/dhcp/files/dhcp-3.0-fix-perms.patch net-misc/dhcp/files/dhcp-3.0-paranoia.patch net-misc/dhcp/files/dhcp-3.0.2-gmake.patch net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch net-misc/dhcp/files/dhcp-3.0.3-dhclient-hostname.patch net-misc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch net-misc/dhcp/files/dhcp-3.0.3-dhclient-mtu.patch net-misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch net-misc/dhcp/files/dhcp-3.0.3-dhclient-ntp.patch net-misc/dhcp/files/dhcp-3.0.3-libdst.patch net-misc/dhcp/files/dhcp-3.0.3-no_isc_blurb.patch net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch net-misc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch net-misc/dhcp/files/dhcp-3.1.0a1-dhclient-resolvconf.patch net-misc/dhcp/files/dhcp-3.1.2_p1-CVE-2009-1892.patch net-misc/dhcp/files/dhcp-3.1.3-dhclient-no-down.patch net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch net-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch net-misc/dhcp/files /dhcp-4.2.0-errwarn-message.patch net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch net-misc/dhcp/files/dhcp-4.2.0-options.patch net-misc/dhcp/files/dhcp-4.2.0-xen-checksum.patch net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch net-misc/dhcp/files/dhcpd.conf net-misc/dhcp/files/dhcpd.init2 net-misc/dhcp/files/dhcpd.init3 net-misc/dhcp/files/dhcrelay.conf net-misc/dhcp/files/dhcrelay.init net-misc/dhcp/files/dhcrelay.init2 net-misc/dhcp/metadata.xml X-VCS-Directories: net-misc/dhcp/files/ net-misc/dhcp/ X-VCS-Committer: alexxy X-VCS-Committer-Name: Alexey Shvetsov X-VCS-Revision: ba626dee191c2cc033901eadef48007c8d7d4e37 Date: Wed, 22 Jun 2011 13:33:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: bea388b91ff56e825cfedc2d55fc041f commit: ba626dee191c2cc033901eadef48007c8d7d4e37 Author: Alexey Shvetsov gentoo org> AuthorDate: Wed Jun 22 13:32:22 2011 +0000 Commit: Alexey Shvetsov gentoo org> CommitDate: Wed Jun 22 13:32:22 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/sci.git;a=3Dc= ommit;h=3Dba626dee [infiniband] Add ib support for dhcp --- net-misc/dhcp/dhcp-4.2.1_p1-r1.ebuild | 230 +++++++++ net-misc/dhcp/files/dhcp-3.0-fix-perms.patch | 15 + net-misc/dhcp/files/dhcp-3.0-paranoia.patch | 207 ++++++++ net-misc/dhcp/files/dhcp-3.0.2-gmake.patch | 66 +++ net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch | 84 +++ .../dhcp/files/dhcp-3.0.3-dhclient-hostname.patch | 16 + .../dhcp/files/dhcp-3.0.3-dhclient-metric.patch | 200 ++++++++ net-misc/dhcp/files/dhcp-3.0.3-dhclient-mtu.patch | 180 +++++++ .../dhcp/files/dhcp-3.0.3-dhclient-no-down.patch | 70 +++ net-misc/dhcp/files/dhcp-3.0.3-dhclient-ntp.patch | 186 +++++++ net-misc/dhcp/files/dhcp-3.0.3-libdst.patch | 14 + net-misc/dhcp/files/dhcp-3.0.3-no_isc_blurb.patch | 105 ++++ .../files/dhcp-3.0.4-dhclient-stdin-conf.patch | 83 +++ .../dhcp/files/dhcp-3.0.5-bpf-nofallback.patch | 44 ++ .../files/dhcp-3.1.0a1-dhclient-resolvconf.patch | 254 +++++++++ .../dhcp/files/dhcp-3.1.2_p1-CVE-2009-1892.patch | 12 + .../dhcp/files/dhcp-3.1.3-dhclient-no-down.patch | 77 +++ net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch | 216 ++++++++ .../files/dhcp-4.0.1-dhclient-stdin-conf.patch | 114 ++++ .../dhcp/files/dhcp-4.2.0-errwarn-message.patch | 31 ++ net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch | 138 +++++ net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch | 538 ++++++++++++++= ++++++ net-misc/dhcp/files/dhcp-4.2.0-options.patch | 401 ++++++++++++++= + net-misc/dhcp/files/dhcp-4.2.0-xen-checksum.patch | 245 +++++++++ .../files/dhcp-4.2.1-dhclient-resolvconf.patch | 384 ++++++++++++++ net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch | 46 ++ net-misc/dhcp/files/dhcpd.conf | 29 + net-misc/dhcp/files/dhcpd.init2 | 94 ++++ net-misc/dhcp/files/dhcpd.init3 | 94 ++++ net-misc/dhcp/files/dhcrelay.conf | 13 + net-misc/dhcp/files/dhcrelay.init | 32 ++ net-misc/dhcp/files/dhcrelay.init2 | 29 + net-misc/dhcp/metadata.xml | 12 + 33 files changed, 4259 insertions(+), 0 deletions(-) diff --git a/net-misc/dhcp/dhcp-4.2.1_p1-r1.ebuild b/net-misc/dhcp/dhcp-4= .2.1_p1-r1.ebuild new file mode 100644 index 0000000..7d99d95 --- /dev/null +++ b/net-misc/dhcp/dhcp-4.2.1_p1-r1.ebuild @@ -0,0 +1,230 @@ +# 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_p1.ebuild,v = 1.2 2011/04/15 21:40:50 ulm Exp $ + +EAPI=3D"2" + +inherit eutils + +MY_PV=3D"${PV//_alpha/a}" +MY_PV=3D"${MY_PV//_beta/b}" +MY_PV=3D"${MY_PV//_rc/rc}" +MY_PV=3D"${MY_PV//_p/-P}" +MY_P=3D"${PN}-${MY_PV}" +DESCRIPTION=3D"ISC Dynamic Host Configuration Protocol (DHCP) client/ser= ver" +HOMEPAGE=3D"http://www.isc.org/products/DHCP" +SRC_URI=3D"ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz" + +LICENSE=3D"as-is BSD" +SLOT=3D"0" +KEYWORDS=3D"~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc = ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE=3D"+client ipv6 kernel_linux ldap selinux +server ssl vim-syntax in= finiband" + +DEPEND=3D"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=3D"${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 + + # Infiniband stuff + if use infiniband; then + epatch "${FILESDIR}/${PN}-4.2.0-improved-xid.patch" + epatch "${FILESDIR}/${PN}-lpf-ib.patch" + epatch "${FILESDIR}/${PN}-options.patch" + epatch "${FILESDIR}/${PN}-xen-checksum.patch" + fi + + # Brand the version with Gentoo + sed -i \ + -e "/VERSION=3D/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=3D/ 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:\::' \ + Makefile.in || die + fi + + # Only install different man pages if we don't have en + if [[ " ${LINGUAS} " !=3D *" en "* ]]; then + # Install Japanese man pages + if [[ " ${LINGUAS} " =3D=3D *" 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=3D/etc/dhcp \ + --with-cli-pid-file=3D/var/run/dhcp/dhclient.pid \ + --with-cli-lease-file=3D/var/lib/dhcp/dhclient.leases \ + --with-cli6-pid-file=3D/var/run/dhcp/dhclient6.pid \ + --with-cli6-lease-file=3D/var/lib/dhcp/dhclient6.leases \ + --with-srv-pid-file=3D/var/run/dhcp/dhcpd.pid \ + --with-srv-lease-file=3D/var/lib/dhcp/dhcpd.leases \ + --with-srv6-pid-file=3D/var/run/dhcp/dhcpd6.pid \ + --with-srv6-lease-file=3D/var/lib/dhcp/dhcpd6.leases \ + --with-relay-pid-file=3D/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=3D"${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=3D"/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 =3D${PF}" +} + +pkg_config() { + local CHROOT=3D"$( + sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT=3D"*\([^#"]\+\)"*/\1/p' \ + "${ROOT}"/etc/conf.d/dhcpd + )" + + if [[ -z ${CHROOT} ]]; then + eerror "CHROOT not defined in /etc/conf.d/dhcpd" + return 1 + fi + + CHROOT=3D"${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=3D"$(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-3.0-fix-perms.patch b/net-misc/dhcp= /files/dhcp-3.0-fix-perms.patch new file mode 100644 index 0000000..13debb2 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch @@ -0,0 +1,15 @@ +--- server/dhcpd.c 2003-11-05 14:08:09.000000000 -0800 ++++ server/dhcpd.c 2003-11-05 14:15:32.000000000 -0800 +@@ -602,6 +602,12 @@ + if (lftest) + exit (0); +=20 ++#if defined (PARANOIA) ++ /* Set proper permissions... */ ++ if (lchown (path_dhcpd_db, set_uid, set_gid)) ++ log_fatal ("lchown(%s, %d, %d): %m", path_dhcpd_db, (int) set_uid, (i= nt) set_gid); ++#endif /* PARANOIA */ ++ + /* Discover all the network interfaces and initialize them. */ + discover_interfaces (DISCOVER_SERVER); +=20 diff --git a/net-misc/dhcp/files/dhcp-3.0-paranoia.patch b/net-misc/dhcp/= files/dhcp-3.0-paranoia.patch new file mode 100644 index 0000000..886f5cb --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0-paranoia.patch @@ -0,0 +1,207 @@ + +paranoia (non-root/chroot) patch for ISC dhcp 3.0 +file to patch: dhcp-3.0/server/dhcpd.c + +update from paranoia patch for ISC dhcp 2.0 + +Adds 3 options: + + -user + -group + -chroot + +Notes: + -DPARANOIA must be passed as an argument to the --copts option + of configure. Otherwise, the paranoia code will not be compiled + in. Example: ./configure --copts -DPARANOIA + + The chroot() call has been delayed in order to allow /dev/log to + be reopened after the configuration file has been read. This is + beneficial for systems on which /dev/log is a unix domain socket. + The main side effect is that dhcpd.conf should be placed in /etc, + instead of /etc. + + If dhcpd is to be run on a sysV-style architecture (or, more + generally, if /dev/log is a character device), one may opt to + create the /dev/log character device and add + -DEARLY_CHROOT to the --copts option of configure (in addition to + -DPARANOIA). This will perform the chroot() call at the earliest + convenience (before reading the configuration file). + + If the -user option is used, the lease and pid file directories + should be writable to the server process after it drops + privileges. + + +ari edelkind (12/10/2001) +last modified 12/10/2001 + + +--- dhcp-3.0/server/dhcpd.c Thu Jun 21 22:12:58 2001 ++++ dhcp-3.0+paranoia/server/dhcpd.c Wed Oct 17 08:23:00 2001 +@@ -56,6 +56,16 @@ + #include "version.h" + #include +=20 ++#if defined (PARANOIA) ++# include ++# include ++# include ++/* get around the ISC declaration of group */ ++# define group real_group=20 ++# include ++# undef group ++#endif /* PARANOIA */ ++ + static void usage PROTO ((void)); +=20 + TIME cur_time; +@@ -204,6 +214,22 @@ + omapi_object_dereference (&listener, MDL); + } +=20 ++#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 */ ++ + int main (argc, argv, envp) + int argc; + char **argv, **envp; +@@ -236,6 +262,14 @@ + char *traceinfile =3D (char *)0; + char *traceoutfile =3D (char *)0; + #endif ++#if defined (PARANOIA) ++ char *set_user =3D 0; ++ char *set_group =3D 0; ++ char *set_chroot =3D 0; ++ ++ uid_t set_uid =3D 0; ++ gid_t set_gid =3D 0; ++#endif /* PARANOIA */ +=20 + /* Make sure we have stdin, stdout and stderr. */ + status =3D open ("/dev/null", O_RDWR); +@@ -298,6 +332,20 @@ + if (++i =3D=3D argc) + usage (); + server =3D argv [i]; ++#if defined (PARANOIA) ++ } else if (!strcmp (argv [i], "-user")) { ++ if (++i =3D=3D argc) ++ usage (); ++ set_user =3D argv [i]; ++ } else if (!strcmp (argv [i], "-group")) { ++ if (++i =3D=3D argc) ++ usage (); ++ set_group =3D argv [i]; ++ } else if (!strcmp (argv [i], "-chroot")) { ++ if (++i =3D=3D argc) ++ usage (); ++ set_chroot =3D argv [i]; ++#endif /* PARANOIA */ + } else if (!strcmp (argv [i], "-cf")) { + if (++i =3D=3D argc) + usage (); +@@ -397,6 +445,44 @@ + trace_seed_stop, MDL); + #endif +=20 ++#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 =3D getpwnam(set_user))) ++ log_fatal ("no such user: %s", set_user); ++ ++ set_uid =3D tmp_pwd->pw_uid; ++ ++ /* use the user's group as the default gid */ ++ if (!set_group) ++ set_gid =3D 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 =3D getgrnam(set_group))) ++ log_fatal ("no such group: %s", set_group); ++ ++ set_gid =3D 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) + { +@@ -500,6 +586,10 @@ +=20 + postconf_initialization (quiet); +=20 ++#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)=20 + exit(0); +@@ -543,6 +633,22 @@ + exit (0); + } +=20 ++#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); ++ }=09 ++ ++ if (set_uid) { ++ if (setuid (set_uid)) ++ log_fatal ("setuid(%d): %m", (int) set_uid); ++ } ++#endif /* PARANOIA */ ++ + /* Read previous pid file. */ + if ((i =3D open (path_dhcpd_pid, O_RDONLY)) >=3D 0) { + status =3D read (i, pbuf, (sizeof pbuf) - 1); +@@ -888,6 +994,10 @@ +=20 + log_fatal ("Usage: dhcpd [-p ] [-d] [-f]%s%s%s%s", + "\n [-cf config-file] [-lf lease-file]", ++#if defined (PARANOIA) ++ /* meld into the following string */ ++ "\n [-user user] [-group group] [-chroot dir]" ++#endif /* PARANOIA */ + #if defined (TRACING) + "\n [-tf trace-output-file]", + "\n [-play trace-input-file]", diff --git a/net-misc/dhcp/files/dhcp-3.0.2-gmake.patch b/net-misc/dhcp/f= iles/dhcp-3.0.2-gmake.patch new file mode 100644 index 0000000..4ab99a2 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.2-gmake.patch @@ -0,0 +1,66 @@ +Index: dhcp-3.0.2/Makefile +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +--- dhcp-3.0.2.orig/Makefile ++++ dhcp-3.0.2/Makefile +@@ -33,7 +33,7 @@ all: + if [ ! -d work.$$sysname ]; then \ + echo No build directory for $$sysname - please run ./configure.; \ + else \ +- (cd work.$$sysname; make all); \ ++ (cd work.$$sysname; $(MAKE) all); \ + fi +=20 + install: +@@ -41,7 +41,7 @@ install: + if [ ! -d work.$$sysname ]; then \ + echo No build directory for $$sysname - please run ./configure.; \ + else \ +- (cd work.$$sysname; make install); \ ++ (cd work.$$sysname; $(MAKE) install); \ + fi +=20 + depend: +@@ -49,7 +49,7 @@ depend: + if [ ! -d work.$$sysname ]; then \ + echo No build directory for $$sysname - please run ./configure.; \ + else \ +- (cd work.$$sysname; make depend); \ ++ (cd work.$$sysname; $(MAKE) depend); \ + fi +=20 + clean: +@@ -57,7 +57,7 @@ clean: + if [ ! -d work.$$sysname ]; then \ + echo No build directory for $$sysname - please run ./configure.; \ + else \ +- (cd work.$$sysname; make clean); \ ++ (cd work.$$sysname; $(MAKE) clean); \ + fi +=20 + realclean: +@@ -65,7 +65,7 @@ realclean: + if [ ! -d work.$$sysname ]; then \ + echo No build directory for $$sysname - please run ./configure.; \ + else \ +- (cd work.$$sysname; make realclean); \ ++ (cd work.$$sysname; $(MAKE) realclean); \ + fi +=20 + distclean: +@@ -73,7 +73,7 @@ distclean: + if [ ! -d work.$$sysname ]; then \ + echo No build directory for $$sysname - please run ./configure.; \ + else \ +- (cd work.$$sysname; make distclean); \ ++ (cd work.$$sysname; $(MAKE) distclean); \ + fi +=20 + links: +@@ -81,6 +81,6 @@ links: + if [ ! -d work.$$sysname ]; then \ + echo No build directory for $$sysname - please run ./configure.; \ + else \ +- (cd work.$$sysname; make links); \ ++ (cd work.$$sysname; $(MAKE) links); \ + fi +=20 diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch b/net-mis= c/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch new file mode 100644 index 0000000..579d72f --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch @@ -0,0 +1,84 @@ +--- client/scripts/bsdos ++++ client/scripts/bsdos +@@ -47,6 +47,11 @@ + . /etc/dhcp/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script ++ if [ x$dhc_dbus !=3D x -a $exit_status -eq 0 ]; then ++ dbus-send --system --dest=3Dcom.redhat.dhcp \ ++ --type=3Dmethod_call /com/redhat/dhcp/$interface com.redhat.dhcp.= set \ ++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\=3D'`" ++ fi + exit $exit_status + } +=20 +--- client/scripts/freebsd ++++ client/scripts/freebsd +@@ -57,6 +57,11 @@ + . /etc/dhcp/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script ++ if [ x$dhc_dbus !=3D x -a $exit_status -eq 0 ]; then ++ dbus-send --system --dest=3Dcom.redhat.dhcp \ ++ --type=3Dmethod_call /com/redhat/dhcp/$interface com.redhat.dhcp.= set \ ++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\=3D'`" ++ fi + exit $exit_status + } +=20 +--- client/scripts/linux ++++ client/scripts/linux +@@ -69,6 +69,11 @@ + . /etc/dhcp/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script ++ if [ x$dhc_dbus !=3D x -a $exit_status -eq 0 ]; then ++ dbus-send --system --dest=3Dcom.redhat.dhcp \ ++ --type=3Dmethod_call /com/redhat/dhcp/$interface com.redhat.dhcp.= set \ ++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\=3D'`" ++ fi + exit $exit_status + } +=20 +--- client/scripts/netbsd ++++ client/scripts/netbsd +@@ -47,6 +47,11 @@ + . /etc/dhcp/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script ++ if [ x$dhc_dbus !=3D x -a $exit_status -eq 0 ]; then ++ dbus-send --system --dest=3Dcom.redhat.dhcp \ ++ --type=3Dmethod_call /com/redhat/dhcp/$interface com.redhat.dhcp.= set \ ++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\=3D'`" ++ fi + exit $exit_status + } +=20 +--- client/scripts/openbsd ++++ client/scripts/openbsd +@@ -47,6 +47,11 @@ + . /etc/dhcp/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script ++ if [ x$dhc_dbus !=3D x -a $exit_status -eq 0 ]; then ++ dbus-send --system --dest=3Dcom.redhat.dhcp \ ++ --type=3Dmethod_call /com/redhat/dhcp/$interface com.redhat.dhcp.= set \ ++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\=3D'`" ++ fi + exit $exit_status + } +=20 +--- client/scripts/solaris ++++ client/scripts/solaris +@@ -47,6 +47,11 @@ + . /etc/dhcp/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script ++ if [ x$dhc_dbus !=3D x -a $exit_status -eq 0 ]; then ++ dbus-send --system --dest=3Dcom.redhat.dhcp \ ++ --type=3Dmethod_call /com/redhat/dhcp/$interface com.redhat.dhcp.= set \ ++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\=3D'`" ++ fi + exit $exit_status + } +=20 diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-hostname.patch b/net= -misc/dhcp/files/dhcp-3.0.3-dhclient-hostname.patch new file mode 100644 index 0000000..9a6e7b9 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-hostname.patch @@ -0,0 +1,16 @@ +--- client/scripts/linux ++++ client/scripts/linux +@@ -138,10 +138,12 @@ + [ x$reason =3D xREBIND ] || [ x$reason =3D xREBOOT ]; then + current_hostname=3D`hostname` + if [ x$current_hostname =3D x ] || \ ++ [ x$current_hostname =3D "x(none)" ] || \ ++ [ x$current_hostname =3D xlocalhost ] || \ + [ x$current_hostname =3D x$old_host_name ]; then + if [ x$current_hostname =3D x ] || \ + [ x$new_host_name !=3D x$old_host_name ]; then +- hostname $new_host_name ++ hostname "$new_host_name" + fi + fi + =20 diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch b/net-m= isc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch new file mode 100644 index 0000000..040ef77 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch @@ -0,0 +1,200 @@ +--- client/scripts/bsdos ++++ client/scripts/bsdos +@@ -84,6 +84,9 @@ + if [ x$new_interface_mtu !=3D x ]; then + mtu_arg=3D"mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC !=3D x ]; then ++ metric_arg=3D"metric $IF_METRIC" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -141,7 +144,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D 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 +@@ -198,7 +201,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" !=3D "" ]; then + set $new_routers +--- client/scripts/freebsd ++++ client/scripts/freebsd +@@ -94,6 +94,9 @@ + if [ x$new_interface_mtu !=3D x ]; then + mtu_arg=3D"mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC !=3D x ]; then ++ metric_arg=3D"metric $IF_METRIC" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -151,7 +154,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D 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= " +@@ -215,7 +218,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" +--- client/scripts/linux ++++ client/scripts/linux +@@ -83,11 +83,6 @@ + fi + fi +=20 +-release=3D`uname -r` +-release=3D`expr $release : '\(.*\)\..*'` +-relminor=3D`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/= \1/'` +-relmajor=3D`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'` +- + if [ x$new_broadcast_address !=3D x ]; then + new_broadcast_arg=3D"broadcast $new_broadcast_address" + fi +@@ -106,6 +101,9 @@ + if [ x$new_interface_mtu !=3D x ]; then + mtu_arg=3D"mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC !=3D x ]; then ++ metric_arg=3D"metric $IF_METRIC" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + # Linux doesn't do mediums (ok, ok, media). +@@ -117,15 +115,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 +=20 + # We need to give the kernel some time to get the interface up. + sleep 1 +@@ -164,12 +154,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 !=3D x ] && [ x$IF_METRIC !=3D 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 !=3D x$alias_ip_address ] && [ x$alias_ip_addre= ss !=3D x ]; +@@ -213,12 +205,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 !=3D x ] && [ x$IF_METRIC !=3D 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 +--- client/scripts/netbsd ++++ client/scripts/netbsd +@@ -84,6 +84,9 @@ + if [ x$new_interface_mtu !=3D x ]; then + mtu_arg=3D"mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC !=3D x ]; then ++ metric_arg=3D"metric $IF_METRIC" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -141,7 +144,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D 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 +@@ -198,7 +201,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" !=3D "" ]; then + set $new_routers +--- client/scripts/solaris ++++ client/scripts/solaris +@@ -79,6 +79,9 @@ + if [ x$new_interface_mtu !=3D x ]; then + mtu_arg=3D"mtu $new_interface_mtu" + fi ++if [ x$IF_METRIC !=3D x ]; then ++ metric_arg=3D"metric $IF_METRIC" ++fi +=20 + ifconfig=3D/sbin/ifconfig +=20 +@@ -141,7 +144,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D 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 +@@ -182,7 +185,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-3.0.3-dhclient-mtu.patch b/net-misc= /dhcp/files/dhcp-3.0.3-dhclient-mtu.patch new file mode 100644 index 0000000..5ef4442 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-mtu.patch @@ -0,0 +1,180 @@ +--- client/scripts/bsdos ++++ client/scripts/bsdos +@@ -81,6 +81,9 @@ + if [ x$alias_subnet_mask !=3D x ]; then + alias_subnet_arg=3D"netmask $alias_subnet_mask" + fi ++if [ x$new_interface_mtu !=3D x ]; then ++ mtu_arg=3D"mtu $new_interface_mtu" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -138,7 +141,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D xREBOOT ]; then + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $medium" ++ $new_broadcast_arg $mtu_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 +@@ -195,7 +198,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 $medium" ++ $new_broadcast_arg $mtu_arg $medium" + sleep 1 + if [ "$new_routers" !=3D "" ]; then + set $new_routers +--- client/scripts/freebsd ++++ client/scripts/freebsd +@@ -91,6 +91,9 @@ + if [ x$alias_subnet_mask !=3D x ]; then + alias_subnet_arg=3D"netmask $alias_subnet_mask" + fi ++if [ x$new_interface_mtu !=3D x ]; then ++ mtu_arg=3D"mtu $new_interface_mtu" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -148,7 +151,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D xREBOOT ]; then + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $medium" ++ $new_broadcast_arg $mtu_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= " +@@ -212,7 +215,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 $medium" ++ $new_broadcast_arg $mtu_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" +--- client/scripts/linux ++++ client/scripts/linux +@@ -103,6 +103,9 @@ + if [ x$alias_subnet_mask !=3D x ]; then + alias_subnet_arg=3D"netmask $alias_subnet_mask" + fi ++if [ x$new_interface_mtu !=3D x ]; then ++ mtu_arg=3D"mtu $new_interface_mtu" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + # Linux doesn't do mediums (ok, ok, media). +@@ -159,7 +162,7 @@ + [ x$reason =3D xBOUND ] || [ x$reason =3D xREBOOT ]; then +=20 + ifconfig $interface inet $new_ip_address $new_subnet_arg \ +- $new_broadcast_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 +@@ -201,7 +204,7 @@ + ifconfig $interface:0- inet 0 + fi + ifconfig $interface inet $new_ip_address $new_subnet_arg \ +- $new_broadcast_arg ++ $new_broadcast_arg $mtu_arg + set $new_routers + ############## what is -w in ping? + if ping -q -c 1 $1; then +--- client/scripts/netbsd ++++ client/scripts/netbsd +@@ -81,6 +81,9 @@ + if [ x$alias_subnet_mask !=3D x ]; then + alias_subnet_arg=3D"netmask $alias_subnet_mask" + fi ++if [ x$new_interface_mtu !=3D x ]; then ++ mtu_arg=3D"mtu $new_interface_mtu" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -138,7 +141,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D xREBOOT ]; then + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $medium" ++ $new_broadcast_arg $mtu_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 +@@ -195,7 +198,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 $medium" ++ $new_broadcast_arg $mtu_arg $medium" + sleep 1 + if [ "$new_routers" !=3D "" ]; then + set $new_routers +--- client/scripts/openbsd ++++ client/scripts/openbsd +@@ -81,6 +81,9 @@ + if [ x$alias_subnet_mask !=3D x ]; then + alias_subnet_arg=3D"netmask $alias_subnet_mask" + fi ++if [ x$new_interface_mtu !=3D x ]; then ++ mtu_arg=3D"mtu $new_interface_mtu" ++fi +=20 + if [ x$reason =3D xMEDIUM ]; then + eval "ifconfig $interface $medium" +@@ -138,7 +141,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D xREBOOT ]; then + eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $medium" ++ $new_broadcast_arg $mtu_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 +@@ -195,7 +198,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 $medium" ++ $new_broadcast_arg $mtu_arg $medium" + sleep 1 + if [ "$new_routers" !=3D "" ]; then + set $new_routers +--- client/scripts/solaris ++++ client/scripts/solaris +@@ -76,6 +76,9 @@ + if [ x$alias_subnet_mask !=3D x ]; then + alias_subnet_arg=3D"netmask $alias_subnet_mask" + fi ++if [ x$new_interface_mtu !=3D x ]; then ++ mtu_arg=3D"mtu $new_interface_mtu" ++fi +=20 + ifconfig=3D/sbin/ifconfig +=20 +@@ -138,7 +141,7 @@ + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ + [ x$reason =3D xBOUND ] || [ x$reason =3D xREBOOT ]; then + eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \ +- $new_broadcast_arg $medium" ++ $new_broadcast_arg $mtu_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 +@@ -179,7 +182,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 $medium" ++ $new_broadcast_arg $mtu_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-3.0.3-dhclient-no-down.patch b/net-= misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch new file mode 100644 index 0000000..518efec --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch @@ -0,0 +1,70 @@ +--- client/scripts/linux ++++ client/scripts/linux +@@ -118,9 +118,9 @@ + if [ x$reason =3D xPREINIT ]; then + if [ x$alias_ip_address !=3D x ]; then + # Bring down alias interface. Its routes will disappear too. +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi +- ifconfig $interface 0 up ++ ifconfig $interface 0.0.0.0 up +=20 + # We need to give the kernel some time to get the interface up. + sleep 1 +@@ -145,12 +145,12 @@ + if [ x$old_ip_address !=3D x ] && [ x$alias_ip_address !=3D x ] && \ + [ x$alias_ip_address !=3D x$old_ip_address ]; then + # Possible new alias. Remove old alias. +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi + if [ x$old_ip_address !=3D x ] && [ x$old_ip_address !=3D x$new_ip_ad= dress ]; then + # IP address changed. Bringing down the interface will delete all r= outes, + # and clear the ARP cache. +- ifconfig $interface inet 0 down ++ ifconfig $interface inet 0.0.0.0 +=20 + fi + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ +@@ -171,7 +171,7 @@ + fi + if [ x$new_ip_address !=3D x$alias_ip_address ] && [ x$alias_ip_addre= ss !=3D x ]; + then +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg + route add -host $alias_ip_address $interface:0 + fi +@@ -183,11 +183,11 @@ + || [ x$reason =3D xSTOP ]; then + if [ x$alias_ip_address !=3D x ]; then + # Turn off alias interface. +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi + if [ x$old_ip_address !=3D x ]; then + # Shut down interface, which will delete routes and clear arp cache= . +- ifconfig $interface inet 0 down ++ ifconfig $interface inet 0.0.0.0 + fi + if [ x$alias_ip_address !=3D x ]; then + ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg +@@ -198,7 +198,7 @@ +=20 + if [ x$reason =3D xTIMEOUT ]; then + if [ x$alias_ip_address !=3D x ]; then +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi + ifconfig $interface inet $new_ip_address $new_subnet_arg \ + $new_broadcast_arg $mtu_arg +@@ -223,7 +223,7 @@ + make_resolv_conf + exit_with_hooks 0 + fi +- ifconfig $interface inet 0 down ++ ifconfig $interface inet 0.0.0.0 + exit_with_hooks 1 + fi +=20 diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-ntp.patch b/net-misc= /dhcp/files/dhcp-3.0.3-dhclient-ntp.patch new file mode 100644 index 0000000..d84e6f6 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-ntp.patch @@ -0,0 +1,186 @@ +--- client/clparse.c ++++ client/clparse.c +@@ -51,6 +51,7 @@ + DHO_DOMAIN_NAME, + DHO_DOMAIN_NAME_SERVERS, + DHO_HOST_NAME, ++ DHO_NTP_SERVERS, + 0 + }; + +--- client/scripts/bsdos ++++ client/scripts/bsdos +@@ -7,6 +7,26 @@ + echo nameserver $nameserver >>/etc/resolv.conf + done + fi ++ # If we're making confs, may as well make an ntp.conf too ++ make_ntp_conf ++} ++ ++make_ntp_conf() { ++ if [ x$PEER_NTP =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ x$new_ntp_servers !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # Must be used on exit. Invokes the local dhcp client exit hooks, if = any. +--- client/scripts/freebsd ++++ client/scripts/freebsd +@@ -32,8 +32,28 @@ + done + fi + fi ++ # If we're making confs, may as well make an ntp.conf too ++ make_ntp_conf + } +=20 ++make_ntp_conf() { ++ if [ x$PEER_NTP =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${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. + exit_with_hooks() { + exit_status=3D$1 +--- client/scripts/linux ++++ client/scripts/linux +@@ -30,6 +30,26 @@ + echo nameserver $nameserver >>/etc/resolv.conf + done + fi ++ # If we're making confs, may as well make an ntp.conf too ++ make_ntp_conf ++} ++ ++make_ntp_conf() { ++ if [ x$PEER_NTP =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # Must be used on exit. Invokes the local dhcp client exit hooks, if = any. +--- client/scripts/netbsd ++++ client/scripts/netbsd +@@ -7,6 +7,26 @@ + echo nameserver $nameserver >>/etc/resolv.conf + done + fi ++ # If we're making confs, may as well make an ntp.conf too ++ make_ntp_conf ++} ++ ++make_ntp_conf() { ++ if [ x$PEER_NTP =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # Must be used on exit. Invokes the local dhcp client exit hooks, if = any. +--- client/scripts/openbsd ++++ client/scripts/openbsd +@@ -7,6 +7,26 @@ + echo nameserver $nameserver >>/etc/resolv.conf + done + fi ++ # If we're making confs, may as well make an ntp.conf too ++ make_ntp_conf ++} ++ ++make_ntp_conf() { ++ if [ x$PEER_NTP =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # Must be used on exit. Invokes the local dhcp client exit hooks, if = any. +--- client/scripts/solaris ++++ client/scripts/solaris +@@ -7,6 +7,26 @@ + echo nameserver $nameserver >>/etc/resolv.conf + done + fi ++ # If we're making confs, may as well make an ntp.conf too ++ make_ntp_conf ++} ++ ++make_ntp_conf() { ++ if [ x$PEER_NTP =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # Must be used on exit. Invokes the local dhcp client exit hooks, if = any. diff --git a/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch b/net-misc/dhcp/= files/dhcp-3.0.3-libdst.patch new file mode 100644 index 0000000..8e93ac9 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch @@ -0,0 +1,14 @@ +--- dst/Makefile.dist.old 2004-12-24 13:31:22.986061032 +0000 ++++ dst/Makefile.dist 2004-12-24 13:47:19.036913364 +0000 +@@ -31,6 +31,10 @@ + all: libdst.a +=20 + install: ++ mkdir -p $(DESTDIR)$(LIBDIR) ++ $(INSTALL) libdst.a $(DESTDIR)$(LIBDIR) ++ $(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libdst.a ++ +=20 + libdst.a: $(OBJ) + rm -f dst.a + diff --git a/net-misc/dhcp/files/dhcp-3.0.3-no_isc_blurb.patch b/net-misc= /dhcp/files/dhcp-3.0.3-no_isc_blurb.patch new file mode 100644 index 0000000..38f7713 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-no_isc_blurb.patch @@ -0,0 +1,105 @@ +Patch nobbled from RedHat, and adapted to work with dhclient and dhrelay +by Roy Marples + +--- dhcp-3.0.3/omapip/errwarn.c.no_isc_blurb 2004-09-30 16:38:32.0000000= 00 -0400 ++++ dhcp-3.0.3/omapip/errwarn.c 2005-04-18 13:45:49.037158000 -0400 +@@ -45,6 +45,8 @@ + int log_perror =3D 1; + #endif + int log_priority; ++int log_isc_blurb=3D1; ++ + void (*log_cleanup) (void); +=20 + #define CVT_BUF_MAX 1023 +@@ -76,7 +78,9 @@ + write (STDERR_FILENO, "\n", 1); + } +=20 +-#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")= ; +@@ -94,7 +98,12 @@ + log_error ("the README file."); + log_error ("%s", ""); + log_error ("exiting."); ++ }else ++ { ++ log_error ("exiting."); ++ } + #endif ++ + if (log_cleanup) + (*log_cleanup) (); + exit (1); +--- dhcp-3.0.3/client/dhclient.c.no_isc_blurb 2005-04-18 13:21:08.509169= 000 -0400 ++++ dhcp-3.0.3/client/dhclient.c 2005-04-18 13:49:27.574402000 -0400 +@@ -34,7 +34,7 @@ + static char ocopyright[] =3D + "$Id: dhcp-3.0.3-no_isc_blurb.patch,v 1.1 2005/12/09 14:13:30 uberlord = Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserve= d.\n"; + #endif /* not lint */ +- ++=20 + #include "dhcpd.h" + #include "version.h" +=20 +@@ -81,6 +81,8 @@ +=20 + void do_release(struct client_state *); +=20 ++extern int log_isc_blurb; ++ + int main (argc, argv, envp) + int argc; + char **argv, **envp; +@@ -176,6 +178,7 @@ + } else if (!strcmp (argv [i], "-q")) { + quiet =3D 1; + quiet_interface_discovery =3D 1; ++ log_isc_blurb =3D 0; =20 + } else if (!strcmp (argv [i], "-s")) { + if (++i =3D=3D argc) + usage (); +--- dhcp-3.0.3/server/dhcpd.c.no_isc_blurb 2005-12-08 10:01:40.000000000= +0000 ++++ dhcp-3.0.3/server/dhcpd.c 2005-12-08 10:05:55.000000000 +0000 +@@ -62,6 +62,9 @@ + struct iaddr server_identifier; + int server_identifier_matched; +=20 ++ ++extern int log_isc_blurb; ++ + #if defined (NSUPDATE) +=20 + /* This stuff is always executed to figure the default values for certa= in +@@ -368,6 +371,7 @@ + } else if (!strcmp (argv [i], "-q")) { + quiet =3D 1; + quiet_interface_discovery =3D 1; ++ log_isc_blurb =3D 0; + } else if (!strcmp (argv [i], "--version")) { + log_info ("isc-dhcpd-%s", DHCP_VERSION); + exit (0); +--- dhcp-3.0.3/relay/dhcrelay.c.no_isc_blurb 2005-12-08 10:21:00.0000000= 00 +0000 ++++ dhcp-3.0.3/relay/dhcrelay.c 2005-12-08 10:21:50.000000000 +0000 +@@ -102,6 +102,8 @@ + static char message [] =3D "Internet Systems Consortium DHCP Relay Agen= t"; + static char url [] =3D "For info, please visit http://www.isc.org/sw/dh= cp/"; +=20 ++extern int log_isc_blurb; ++ + int main (argc, argv, envp) + int argc; + char **argv, **envp; +@@ -170,6 +172,7 @@ + } else if (!strcmp (argv [i], "-q")) { + quiet =3D 1; + quiet_interface_discovery =3D 1; ++ log_isc_blurb =3D 0; + } else if (!strcmp (argv [i], "-a")) { + add_agent_options =3D 1; + } else if (!strcmp (argv [i], "-c")) { diff --git a/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch b/n= et-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch new file mode 100644 index 0000000..3fedc7c --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch @@ -0,0 +1,83 @@ +--- common/conflex.c.orig 2006-02-21 16:21:45.000000000 +0000 ++++ common/conflex.c 2006-02-21 16:23:06.000000000 +0000 +@@ -90,7 +90,7 @@ + struct parse **cfile; + { + /* "Memory" config files have no file. */ +- if ((*cfile)->file !=3D -1) ++ if ((*cfile)->file !=3D -1 && (*cfile)->file !=3D fileno(stdin)) + close((*cfile)->file); +=20 + if ((*cfile)->bufsiz) +--- client/clparse.c.orig 2006-02-22 09:37:12.000000000 +0000 ++++ client/clparse.c 2006-02-22 09:38:26.000000000 +0000 +@@ -97,6 +97,11 @@ + status =3D read_client_conf_file (path_dhclient_conf, + (struct interface_info *)0, + &top_level_config); ++ ++ /* Read any extra configuration from stdin */ ++ read_client_conf_stdin ((struct interface_info *)0, ++ &top_level_config); ++=09 + if (status !=3D ISC_R_SUCCESS) { + ; + #ifdef LATER +@@ -148,20 +153,17 @@ + return status; + } +=20 +-int read_client_conf_file (const char *name, struct interface_info *ip, +- struct client_config *client) ++int read_client_conf_actual (int file, const char *name,=20 ++ struct interface_info *ip, ++ struct client_config *client) + { +- int file; + struct parse *cfile; + const char *val; + int token; + isc_result_t status; + =09 +- if ((file =3D open (name, O_RDONLY)) < 0) +- return uerr2isc (errno); +- + cfile =3D (struct parse *)0; +- new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); ++ new_parse (&cfile, file, (char *)0, 0, name , 0); +=20 + do { + token =3D peek_token (&val, (unsigned *)0, cfile); +@@ -177,6 +179,32 @@ + return status; + } +=20 ++int read_client_conf_file (const char *name, struct interface_info *ip, ++ struct client_config *client) ++{ ++ int file; ++ isc_result_t status; ++=09 ++ if ((file =3D open (name, O_RDONLY)) < 0) ++ return uerr2isc (errno); ++ ++ status =3D read_client_conf_actual(file, name, ip, client); ++ ++ return status; ++} ++ ++ ++int read_client_conf_stdin (struct interface_info *ip, ++ struct client_config *client) ++{ ++ int file =3D fileno(stdin); ++ isc_result_t status; ++ ++ if (isatty(file)) return ISC_R_NOTFOUND; ++ status =3D read_client_conf_actual(file, "stdin", ip, client); ++ ++ return status; ++} +=20 + /* lease-file :=3D=3D client-lease-statements END_OF_FILE + client-lease-statements :=3D=3D diff --git a/net-misc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch b/net-mi= sc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch new file mode 100644 index 0000000..2fae6f2 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch @@ -0,0 +1,44 @@ +diff -ur common.orig/bpf.c common/bpf.c +--- common.orig/bpf.c 2006-09-20 12:52:47 +0100 ++++ common/bpf.c 2006-09-20 12:53:22 +0100 +@@ -354,10 +354,6 @@ + int result; + int fudge; +=20 +- if (!strcmp (interface -> name, "fallback")) +- return send_fallback (interface, packet, raw, +- len, from, to, hto); +- + /* Assemble the headers... */ + assemble_hw_header (interface, (unsigned char *)hw, &hbufp, hto); + assemble_udp_ip_header (interface, +@@ -531,17 +527,5 @@ +=20 + void maybe_setup_fallback () + { +- isc_result_t status; +- struct interface_info *fbi =3D (struct interface_info *)0; +- if (setup_fallback (&fbi, MDL)) { +- if_register_fallback (fbi); +- status =3D omapi_register_io_object ((omapi_object_t *)fbi, +- if_readsocket, 0, +- fallback_discard, 0, 0); +- if (status !=3D ISC_R_SUCCESS) +- log_fatal ("Can't register I/O handle for %s: %s", +- fbi -> name, isc_result_totext (status)); +- interface_dereference (&fbi, MDL); +- } + } + #endif +diff -ur includes.orig/osdep.h includes/osdep.h +--- includes.orig/osdep.h 2006-09-20 12:54:52 +0100 ++++ includes/osdep.h 2006-09-20 12:56:40 +0100 +@@ -190,7 +190,7 @@ + Currently, all low-level packet interfaces use BSD sockets as a + fallback. */ +=20 +-#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ ++#if defined (USE_NIT_SEND) || \ + defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ + defined (USE_LPF_SEND) || \ + (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) diff --git a/net-misc/dhcp/files/dhcp-3.1.0a1-dhclient-resolvconf.patch b= /net-misc/dhcp/files/dhcp-3.1.0a1-dhclient-resolvconf.patch new file mode 100644 index 0000000..5c420ae --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.1.0a1-dhclient-resolvconf.patch @@ -0,0 +1,254 @@ +diff -ur client.orig/scripts/bsdos client/scripts/bsdos +--- client.orig/scripts/bsdos 2006-09-07 18:53:10.476329752 +0100 ++++ client/scripts/bsdos 2006-09-07 19:19:53.000000000 +0100 +@@ -1,21 +1,22 @@ + #!/bin/sh +=20 + make_resolv_conf() { +- if [ x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- if [ "x$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ "x$new_domain_name" !=3D 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 ++ if [ x$PEER_DNS =3D x ] || [ x$PEER_DNS =3D xyes ]; then ++ if [ "x$new_domain_name" !=3D x ] || [ "x$new_domain_name_servers" = !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ if [ "x$new_domain_name" !=3D x ]; then ++ conf=3D"${conf}search $new_domain_name\n" ++ fi ++ for nameserver in $new_domain_name_servers; do ++ conf=3D"${conf}nameserver $nameserver\n" ++ done ++ if [ -x /sbin/resolvconf ]; then ++ printf "$conf" | resolvconf -a "$interface" ++ else ++ printf "$conf" > /etc/resolv.conf ++ chmod 644 /etc/resolv.conf ++ fi + fi +- for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >> /etc/resolv.conf.dhclient +- done +- +- 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 +diff -ur client.orig/scripts/freebsd client/scripts/freebsd +--- client.orig/scripts/freebsd 2006-09-07 18:53:10.476329752 +0100 ++++ client/scripts/freebsd 2006-09-07 19:19:32.000000000 +0100 +@@ -11,38 +11,20 @@ + fi +=20 + make_resolv_conf() { +- if [ x"$new_domain_name_servers" !=3D x ]; then +- ( cat /dev/null > /etc/resolv.conf.dhclient ) +- exit_status=3D$? +- if [ $exit_status -ne 0 ]; then +- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_= status" +- else +- if [ "x$new_domain_search" !=3D x ]; then +- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient ) +- exit_status=3D$? +- elif [ "x$new_domain_name" !=3D 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=3D$? ++ if [ x$PEER_DNS =3D x ] || [ x$PEER_DNS =3D xyes ]; then ++ if [ "x$new_domain_name" !=3D x ] || [ "x$new_domain_name_servers" = !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ if [ "x$new_domain_name" !=3D x ]; then ++ conf=3D"${conf}search $new_domain_name\n" + 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=3D$? ++ conf=3D"${conf}nameserver $nameserver\n" + 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 =3D $? +- fi +- +- if [ $exit_status -ne 0 ]; then +- $LOGGER "Error while writing new /etc/resolv.conf." ++ if [ -x /sbin/resolvconf ]; then ++ printf "$conf" | resolvconf -a "$interface" ++ else ++ printf "$conf" > /etc/resolv.conf ++ chmod 644 /etc/resolv.conf + fi + fi + fi +diff -ur client.orig/scripts/linux client/scripts/linux +--- client.orig/scripts/linux 2006-09-07 18:53:10.476329752 +0100 ++++ client/scripts/linux 2006-09-07 19:18:57.000000000 +0100 +@@ -23,22 +23,22 @@ + # of the $1 in its args. +=20 + make_resolv_conf() { +- if [ x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- chmod 644 /etc/resolv.conf.dhclient +- if [ x"$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ x"$new_domain_name" !=3D 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 ++ if [ x$PEER_DNS =3D x ] || [ x$PEER_DNS =3D xyes ]; then ++ if [ "x$new_domain_name" !=3D x ] || [ "x$new_domain_name_servers" = !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ if [ "x$new_domain_name" !=3D x ]; then ++ conf=3D"${conf}search $new_domain_name\n" ++ fi ++ for nameserver in $new_domain_name_servers; do ++ conf=3D"${conf}nameserver $nameserver\n" ++ done ++ if [ -x /sbin/resolvconf ]; then ++ printf "$conf" | resolvconf -a "$interface" ++ else ++ printf "$conf" > /etc/resolv.conf ++ chmod 644 /etc/resolv.conf ++ fi + fi +- for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient +- done +- +- 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 +diff -ur client.orig/scripts/netbsd client/scripts/netbsd +--- client.orig/scripts/netbsd 2006-09-07 18:53:10.476329752 +0100 ++++ client/scripts/netbsd 2006-09-07 19:20:10.000000000 +0100 +@@ -1,21 +1,22 @@ + #!/bin/sh +=20 + make_resolv_conf() { +- if [ "x$new_domain_name" !=3D x ] && [ x"$new_domain_name_servers" !=3D= x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- if [ "x$new_domain_search !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ "x$new_domain_name !=3D 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 ++ if [ x$PEER_DNS =3D x ] || [ x$PEER_DNS =3D xyes ]; then ++ if [ "x$new_domain_name" !=3D x ] || [ "x$new_domain_name_servers" = !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ if [ "x$new_domain_name" !=3D x ]; then ++ conf=3D"${conf}search $new_domain_name\n" ++ fi ++ for nameserver in $new_domain_name_servers; do ++ conf=3D"${conf}nameserver $nameserver\n" ++ done ++ if [ -x /sbin/resolvconf ]; then ++ printf "$conf" | resolvconf -a "$interface" ++ else ++ printf "$conf" > /etc/resolv.conf ++ chmod 644 /etc/resolv.conf ++ fi + fi +- for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient +- done +- +- 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 +diff -ur client.orig/scripts/openbsd client/scripts/openbsd +--- client.orig/scripts/openbsd 2006-09-07 18:53:10.476329752 +0100 ++++ client/scripts/openbsd 2006-09-07 19:20:38.000000000 +0100 +@@ -1,21 +1,22 @@ + #!/bin/sh +=20 + make_resolv_conf() { +- if x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- if [ x"$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ x"$new_domain_name" !=3D 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 ++ if [ x$PEER_DNS =3D x ] || [ x$PEER_DNS =3D xyes ]; then ++ if [ "x$new_domain_name" !=3D x ] || [ "x$new_domain_name_servers" = !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ if [ "x$new_domain_name" !=3D x ]; then ++ conf=3D"${conf}search $new_domain_name\n" ++ fi ++ for nameserver in $new_domain_name_servers; do ++ conf=3D"${conf}nameserver $nameserver\n" ++ done ++ if [ -x /sbin/resolvconf ]; then ++ printf "$conf" | resolvconf -a "$interface" ++ else ++ printf "$conf" > /etc/resolv.conf ++ chmod 644 /etc/resolv.conf ++ fi + fi +- for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient +- done +- +- mv /etc/ersolv.conf.dhclient /etc/resolv.conf + fi + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf +diff -ur client.orig/scripts/solaris client/scripts/solaris +--- client.orig/scripts/solaris 2006-09-07 18:53:10.476329752 +0100 ++++ client/scripts/solaris 2006-09-07 19:21:12.000000000 +0100 +@@ -1,21 +1,22 @@ + #!/bin/sh =20 +=20 + make_resolv_conf() { +- if [ x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- if [ x"$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ x"$new_domain_name" !=3D 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 ++ if [ x$PEER_DNS =3D x ] || [ x$PEER_DNS =3D xyes ]; then ++ if [ "x$new_domain_name" !=3D x ] || [ "x$new_domain_name_servers" = !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ if [ "x$new_domain_name" !=3D x ]; then ++ conf=3D"${conf}search $new_domain_name\n" ++ fi ++ for nameserver in $new_domain_name_servers; do ++ conf=3D"${conf}nameserver $nameserver\n" ++ done ++ if [ -x /sbin/resolvconf ]; then ++ printf "$conf" | resolvconf -a "$interface" ++ else ++ printf "$conf" > /etc/resolv.conf ++ chmod 644 /etc/resolv.conf ++ fi + fi +- for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient +- done +- +- 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 diff --git a/net-misc/dhcp/files/dhcp-3.1.2_p1-CVE-2009-1892.patch b/net-= misc/dhcp/files/dhcp-3.1.2_p1-CVE-2009-1892.patch new file mode 100644 index 0000000..ae1b92a --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.1.2_p1-CVE-2009-1892.patch @@ -0,0 +1,12 @@ +diff -uNr dhcp-3.1.2.ORIG/server/dhcp.c dhcp-3.1.2/server/dhcp.c +--- dhcp-3.1.2.ORIG/server/dhcp.c 2009-07-13 14:26:15.000000000 +0100 ++++ dhcp-3.1.2/server/dhcp.c 2009-07-13 14:26:33.000000000 +0100 +@@ -1747,6 +1747,8 @@ + host_reference (&host, h, MDL); + } + if (!host) { ++ if (hp) ++ host_dereference (&hp, MDL); + find_hosts_by_haddr (&hp, + packet -> raw -> htype, + packet -> raw -> chaddr, diff --git a/net-misc/dhcp/files/dhcp-3.1.3-dhclient-no-down.patch b/net-= misc/dhcp/files/dhcp-3.1.3-dhclient-no-down.patch new file mode 100644 index 0000000..89935df --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.1.3-dhclient-no-down.patch @@ -0,0 +1,77 @@ +diff -Nuar --exclude '*.orig' dhcp-3.1.3.orig//client/scripts/linux dhcp= -3.1.3//client/scripts/linux +--- dhcp-3.1.3.orig//client/scripts/linux 2010-10-15 04:59:15.890664245 = +0000 ++++ dhcp-3.1.3//client/scripts/linux 2010-10-15 05:04:57.940396350 +0000 +@@ -118,7 +118,7 @@ + if [ x$reason =3D xPREINIT ]; then + if [ x$alias_ip_address !=3D x ]; then + # Bring down alias interface. Its routes will disappear too. +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi + if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 = ] ) + then +@@ -127,7 +127,7 @@ + # 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 ++ ifconfig $interface 0.0.0.0 up + fi +=20 + # We need to give the kernel some time to get the interface up. +@@ -155,12 +155,12 @@ + if [ x$old_ip_address !=3D x ] && [ x$alias_ip_address !=3D x ] && \ + [ x$alias_ip_address !=3D x$old_ip_address ]; then + # Possible new alias. Remove old alias. +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi + if [ x$old_ip_address !=3D x ] && [ x$old_ip_address !=3D x$new_ip_ad= dress ]; then + # IP address changed. Bringing down the interface will delete all r= outes, + # and clear the ARP cache. +- ifconfig $interface inet 0 down ++ ifconfig $interface inet 0.0.0.0 +=20 + fi + if [ x$old_ip_address =3D x ] || [ x$old_ip_address !=3D x$new_ip_add= ress ] || \ +@@ -179,7 +179,7 @@ + fi + if [ x$new_ip_address !=3D x$alias_ip_address ] && [ x$alias_ip_addre= ss !=3D x ]; + then +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg + route add -host $alias_ip_address $interface:0 + fi +@@ -191,11 +191,11 @@ + || [ x$reason =3D xSTOP ]; then + if [ x$alias_ip_address !=3D x ]; then + # Turn off alias interface. +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi + if [ x$old_ip_address !=3D x ]; then + # Shut down interface, which will delete routes and clear arp cache= . +- ifconfig $interface inet 0 down ++ ifconfig $interface inet 0.0.0.0 + fi + if [ x$alias_ip_address !=3D x ]; then + ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg +@@ -206,7 +206,7 @@ +=20 + if [ x$reason =3D xTIMEOUT ]; then + if [ x$alias_ip_address !=3D x ]; then +- ifconfig $interface:0- inet 0 ++ ifconfig $interface:0- inet 0.0.0.0 + fi + ifconfig $interface inet $new_ip_address $new_subnet_arg \ + $new_broadcast_arg $mtu_arg +@@ -227,7 +227,7 @@ + make_resolv_conf + exit_with_hooks 0 + fi +- ifconfig $interface inet 0 down ++ ifconfig $interface inet 0.0.0.0 + exit_with_hooks 1 + fi +=20 diff --git a/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch b/net-misc/d= hcp/files/dhcp-4.0-dhclient-ntp.patch new file mode 100644 index 0000000..d3f2971 --- /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 @@ +=20 + struct client_config top_level_config; +=20 +-#define NUM_DEFAULT_REQUESTED_OPTS 9 ++#define NUM_DEFAULT_REQUESTED_OPTS 10 + struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1= ]; +=20 + static void parse_client_default_duid(struct parse *cfile); +@@ -98,15 +98,20 @@ + dhcp_universe.code_hash, &code, 0, MDL); +=20 + /* 8 */ +- code =3D D6O_NAME_SERVERS; ++ code =3D 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); +=20 + /* 9 */ +- code =3D D6O_DOMAIN_SEARCH; ++ code =3D D6O_NAME_SERVERS; + option_code_hash_lookup(&default_requested_options[8], + dhcpv6_universe.code_hash, &code, 0, MDL); +=20 ++ /* 10 */ ++ code =3D D6O_DOMAIN_SEARCH; ++ option_code_hash_lookup(&default_requested_options[9], ++ dhcpv6_universe.code_hash, &code, 0, MDL); ++ + for (code =3D 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) { + if (default_requested_options[code] =3D=3D 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 @@ +=20 + 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 =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ x$new_ntp_servers !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # 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/scrip= ts/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 +010= 0 +@@ -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 =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # 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 @@ +=20 + 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 =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # 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/script= s/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 @@ +=20 + 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 =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # 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/scrip= ts/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 +010= 0 +@@ -29,6 +29,26 @@ +=20 + 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 =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # 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/scrip= ts/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 +010= 0 +@@ -17,6 +17,26 @@ +=20 + 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 =3D x ] || [ x$PEER_NTP =3D xyes ]; then ++ if [ "x$new_ntp_servers" !=3D x ]; then ++ conf=3D"# Generated by dhclient for interface $interface\n" ++ conf=3D"${conf}restrict default noquery notrust nomodify\n" ++ conf=3D"${conf}restrict 127.0.0.1\n" ++ for ntpserver in $new_ntp_servers; do ++ conf=3D"${conf}restrict $ntpserver nomodify notrap noquery\n" ++ conf=3D"${conf}server $ntpserver\n" ++ done ++ conf=3D"${conf}driftfile /var/lib/ntp/ntp.drift\n" ++ conf=3D"${conf}logfile /var/log/ntp.log\n" ++ printf "${conf}" > /etc/ntp.conf ++ chmod 644 /etc/ntp.conf ++ fi ++ fi + } +=20 + # Must be used on exit. Invokes the local dhcp client exit hooks, if = any. diff --git a/net-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch b/n= et-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch new file mode 100644 index 0000000..ddbe4a3 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch @@ -0,0 +1,114 @@ +diff -uNr dhcp-4.0.1.ORIG/client/clparse.c dhcp-4.0.1/client/clparse.c +--- dhcp-4.0.1.ORIG/client/clparse.c 2009-03-30 13:54:47.000000000 +0100 ++++ dhcp-4.0.1/client/clparse.c 2009-03-30 13:58:02.000000000 +0100 +@@ -174,6 +174,10 @@ + #endif + } +=20 ++ /* 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 =3D (struct client_config *)0; +@@ -203,23 +207,13 @@ + return status; + } +=20 +-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; + =09 +- if ((file =3D open (name, O_RDONLY)) < 0) +- return uerr2isc (errno); +- +- cfile =3D NULL; +- status =3D new_parse(&cfile, file, NULL, 0, path_dhclient_conf, 0); +- if (status !=3D ISC_R_SUCCESS || cfile =3D=3D NULL) +- return status; +- + do { + token =3D peek_token (&val, (unsigned *)0, cfile); + if (token =3D=3D END_OF_FILE) +@@ -230,10 +224,74 @@ + status =3D (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; ++=09 ++ if ((file =3D open (name, O_RDONLY)) < 0) ++ return uerr2isc (errno); ++ ++ cfile =3D (struct parse *)0; ++ new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); ++ status =3D read_client_conf_actual(cfile, ip, client); + end_parse (&cfile); + return status; + } +=20 ++int read_client_conf_stdin (struct interface_info *ip, ++ struct client_config *client) ++{ ++ int file; ++ char *buffer =3D NULL, *p; ++ unsigned buflen, len =3D 0; ++ struct parse *cfile; ++ size_t bytes; ++ isc_result_t status; ++ ++ file =3D 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 =3D BUFSIZ; ++ buffer =3D malloc (BUFSIZ + 1); ++ p =3D buffer; ++ do { ++ bytes =3D read (file, p, BUFSIZ); ++ if (bytes =3D=3D 0) ++ break; ++ if (bytes =3D=3D -1) ++ log_fatal ("failed to read stdin!"); ++ if (bytes >=3D BUFSIZ) { ++ buflen +=3D BUFSIZ; ++ len +=3D BUFSIZ; ++ buffer =3D realloc (buffer, buflen + 1); ++ if (!buffer) ++ log_fatal ("not enough buffer to read stdin!"); ++ p =3D buffer + len; ++ } else { ++ len +=3D bytes; ++ break; ++ } ++ } while(1); ++ buffer[len] =3D '\0'; ++ ++ cfile =3D (struct parse *)0; ++ status =3D new_parse (&cfile, -1, buffer, len, "stdin", 0); ++ if (status =3D=3D ISC_R_SUCCESS) { ++ status =3D read_client_conf_actual (cfile, ip, client); ++ end_parse (&cfile); ++ } ++ free(buffer); ++ return status; ++} +=20 + /* lease-file :=3D=3D client-lease-statements END_OF_FILE + client-lease-statements :=3D=3D diff --git a/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch b/net-m= isc/dhcp/files/dhcp-4.2.0-errwarn-message.patch new file mode 100644 index 0000000..f882a13 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch @@ -0,0 +1,31 @@ +ripped from Fedora & tweaked=20 + +--- dhcp-4.2.0/omapip/errwarn.c ++++ dhcp-4.2.0/omapip/errwarn.c +@@ -76,20 +76,13 @@ +=20 + #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 availabl= e"); ++ log_error ("on ftp.isc.org. Features have been added and other chang= es"); ++ log_error ("have been made to the base software release in order to m= ake"); ++ 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 no= t"); +- log_error ("yet read the README, please read it before requesting hel= p."); +- log_error ("If you intend to request help from the dhcp-server@isc.or= g"); +- 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 s= ite:"); ++ log_error (" http://bugs.gentoo.org/"); + log_error ("%s", ""); + log_error ("exiting."); + #endif diff --git a/net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch b/net-misc= /dhcp/files/dhcp-4.2.0-improved-xid.patch new file mode 100644 index 0000000..567601f --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch @@ -0,0 +1,138 @@ +diff -up dhcp-4.2.0/client/dhclient.c.xid dhcp-4.2.0/client/dhclient.c +--- dhcp-4.2.0/client/dhclient.c.xid 2010-09-23 06:21:03.000000000 -0400 ++++ dhcp-4.2.0/client/dhclient.c 2010-09-23 09:14:09.000000000 -0400 +@@ -805,6 +805,26 @@ main(int argc, char **argv) { + } + } +=20 ++ /* We create a backup seed before rediscovering interfaces in order to ++ have a seed built using all of the available interfaces ++ It's interesting if required interfaces doesn't let us defined ++ a really unique seed due to a lack of valid HW addr later ++ (this is the case with DHCP over IB) ++ We only use the last device as using a sum could broke the ++ uniqueness of the seed among multiple nodes ++ */ ++ unsigned backup_seed =3D 0; ++ for (ip =3D interfaces; ip; ip =3D ip -> next) { ++ int junk; ++ if ( ip -> hw_address.hlen <=3D sizeof seed ) ++ continue; ++ memcpy (&junk, ++ &ip -> hw_address.hbuf [ip -> hw_address.hlen - ++ sizeof seed], sizeof seed); ++ backup_seed =3D junk; ++ } ++ ++ + /* At this point, all the interfaces that the script thinks + are relevant should be running, so now we once again call + discover_interfaces(), and this time ask it to actually set +@@ -819,14 +839,36 @@ main(int argc, char **argv) { + Not much entropy, but we're booting, so we're not likely to + find anything better. */ + seed =3D 0; ++ int seed_flag =3D 0; + for (ip =3D interfaces; ip; ip =3D ip->next) { + int junk; ++ if ( ip -> hw_address.hlen <=3D sizeof seed ) ++ continue; + memcpy(&junk, + &ip->hw_address.hbuf[ip->hw_address.hlen - + sizeof seed], sizeof seed); + seed +=3D junk; ++ seed_flag =3D 1; + } +- srandom(seed + cur_time); ++ if ( seed_flag =3D=3D 0 ) { ++ if ( backup_seed !=3D 0 ) { ++ seed =3D backup_seed; ++ log_info ("xid: rand init seed (0x%x) built using all" ++ " available interfaces",seed); ++ } ++ else { ++ seed =3D cur_time^((unsigned) gethostid()) ; ++ log_info ("xid: warning: no netdev with useable HWADDR found" ++ " for seed's uniqueness enforcement"); ++ log_info ("xid: rand init seed (0x%x) built using gethostid", ++ seed); ++ } ++ /* we only use seed and no current time as a broadcast reply */ ++ /* will certainly be used by the hwaddrless interface */ ++ srandom(seed); ++ } ++ else ++ srandom(seed + cur_time); +=20 + /* Setup specific Infiniband options */ + for (ip =3D interfaces; ip; ip =3D ip->next) { +@@ -1310,7 +1352,7 @@ void dhcpack (packet) + return; + } +=20 +- log_info ("DHCPACK from %s", piaddr (packet -> client_addr)); ++ log_info ("DHCPACK from %s (xid=3D0x%x)", piaddr (packet -> client_add= r), client -> xid); +=20 + lease =3D packet_to_lease (packet, client); + if (!lease) { +@@ -2010,7 +2052,7 @@ void dhcpnak (packet) + return; + } +=20 +- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr)); ++ log_info ("DHCPNAK from %s (xid=3D0x%x)", piaddr (packet -> client_add= r), client -> xid); +=20 + if (!client -> active) { + #if defined (DEBUG) +@@ -2136,10 +2178,10 @@ void send_discover (cpp) + client -> packet.secs =3D htons (65535); + client -> secs =3D client -> packet.secs; +=20 +- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld", ++ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=3D0x%x)"= , + client -> name ? client -> name : client -> interface -> name, + inet_ntoa (sockaddr_broadcast.sin_addr), +- ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval))= ; ++ ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval),= client -> xid); +=20 + /* Send out a packet. */ + result =3D send_packet (client -> interface, (struct packet *)0, +@@ -2394,10 +2436,10 @@ void send_request (cpp) + client -> packet.secs =3D htons (65535); + } +=20 +- log_info ("DHCPREQUEST on %s to %s port %d", ++ log_info ("DHCPREQUEST on %s to %s port %d (xid=3D0x%x)", + client -> name ? client -> name : client -> interface -> name, + inet_ntoa (destination.sin_addr), +- ntohs (destination.sin_port)); ++ ntohs (destination.sin_port), client -> xid); +=20 + if (destination.sin_addr.s_addr !=3D INADDR_BROADCAST && + fallback_interface) +@@ -2427,10 +2469,10 @@ void send_decline (cpp) +=20 + int result; +=20 +- log_info ("DHCPDECLINE on %s to %s port %d", ++ log_info ("DHCPDECLINE on %s to %s port %d (xid=3D0x%x)", + client -> name ? client -> name : client -> interface -> name, + inet_ntoa (sockaddr_broadcast.sin_addr), +- ntohs (sockaddr_broadcast.sin_port)); ++ ntohs (sockaddr_broadcast.sin_port), client -> xid); +=20 + /* Send out a packet. */ + result =3D send_packet (client -> interface, (struct packet *)0, +@@ -2470,10 +2512,10 @@ void send_release (cpp) + return; + } +=20 +- log_info ("DHCPRELEASE on %s to %s port %d", ++ log_info ("DHCPRELEASE on %s to %s port %d (xid=3D0x%x)", + client -> name ? client -> name : client -> interface -> name, + inet_ntoa (destination.sin_addr), +- ntohs (destination.sin_port)); ++ ntohs (destination.sin_port), client -> xid); +=20 + if (fallback_interface) + result =3D send_packet (fallback_interface, diff --git a/net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch b/net-misc/dhcp/= files/dhcp-4.2.0-lpf-ib.patch new file mode 100644 index 0000000..52a7aa8 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch @@ -0,0 +1,538 @@ +diff -up dhcp-4.2.0/common/lpf.c.ib dhcp-4.2.0/common/lpf.c +--- dhcp-4.2.0/common/lpf.c.ib 2010-09-23 05:24:09.000000000 -0400 ++++ dhcp-4.2.0/common/lpf.c 2010-09-23 06:21:03.000000000 -0400 +@@ -42,6 +42,7 @@ + #include "includes/netinet/udp.h" + #include "includes/netinet/if_ether.h" + #include ++#include +=20 + #ifndef PACKET_AUXDATA + #define PACKET_AUXDATA 8 +@@ -59,6 +60,15 @@ struct tpacket_auxdata + /* Reinitializes the specified interface after an address change. Thi= s + is not required for packet-filter APIs. */ +=20 ++/* Default broadcast address for IPoIB */ ++static unsigned char default_ib_bcast_addr[20] =3D { ++ 0x00, 0xff, 0xff, 0xff, ++ 0xff, 0x12, 0x40, 0x1b, ++ 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, ++ 0xff, 0xff, 0xff, 0xff ++}; ++ + #ifdef USE_LPF_SEND + void if_reinitialize_send (info) + struct interface_info *info; +@@ -86,10 +96,21 @@ int if_register_lpf (info) + struct sockaddr common; + } sa; + struct ifreq ifr; ++ int type; ++ int protocol; +=20 + /* Make an LPF socket. */ +- if ((sock =3D socket(PF_PACKET, SOCK_RAW, +- htons((short)ETH_P_ALL))) < 0) { ++ get_hw_addr(info); ++ ++ if (info->hw_address.hbuf[0] =3D=3D HTYPE_INFINIBAND) { ++ type =3D SOCK_DGRAM; ++ protocol =3D ETHERTYPE_IP; ++ } else { ++ type =3D SOCK_RAW; ++ protocol =3D ETH_P_ALL; ++ } ++ ++ if ((sock =3D socket(PF_PACKET, type, htons((short)protocol))) < 0) { + if (errno =3D=3D ENOPROTOOPT || errno =3D=3D EPROTONOSUPPORT || + errno =3D=3D ESOCKTNOSUPPORT || errno =3D=3D EPFNOSUPPORT || + errno =3D=3D EAFNOSUPPORT || errno =3D=3D EINVAL) { +@@ -111,6 +132,7 @@ int if_register_lpf (info) + /* Bind to the interface name */ + memset (&sa, 0, sizeof sa); + sa.ll.sll_family =3D AF_PACKET; ++ sa.ll.sll_protocol =3D htons(protocol); + sa.ll.sll_ifindex =3D ifr.ifr_ifindex; + if (bind (sock, &sa.common, sizeof sa)) { + if (errno =3D=3D ENOPROTOOPT || errno =3D=3D EPROTONOSUPPORT || +@@ -126,8 +148,6 @@ int if_register_lpf (info) + log_fatal ("Bind socket to interface: %m"); + } +=20 +- get_hw_addr(info->name, &info->hw_address); +- + return sock; + } + #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */ +@@ -182,6 +202,8 @@ void if_deregister_send (info) + in bpf includes... */ + extern struct sock_filter dhcp_bpf_filter []; + extern int dhcp_bpf_filter_len; ++extern struct sock_filter dhcp_ib_bpf_filter []; ++extern int dhcp_ib_bpf_filter_len; +=20 + #if defined (HAVE_TR_SUPPORT) + extern struct sock_filter dhcp_bpf_tr_filter []; +@@ -199,11 +221,13 @@ void if_register_receive (info) + /* Open a LPF device and hang it on this interface... */ + info -> rfdesc =3D if_register_lpf (info); +=20 +- val =3D 1; +- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val, +- sizeof val) < 0) { +- if (errno !=3D ENOPROTOOPT) +- log_fatal ("Failed to set auxiliary packet data: %m"); ++ if (info->hw_address.hbuf[0] !=3D HTYPE_INFINIBAND) { ++ val =3D 1; ++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, ++ &val, sizeof val) < 0) { ++ if (errno !=3D ENOPROTOOPT) ++ log_fatal ("Failed to set auxiliary packet data: %m"); ++ } + } +=20 + #if defined (HAVE_TR_SUPPORT) +@@ -249,15 +273,28 @@ static void lpf_gen_filter_setup (info) +=20 + memset(&p, 0, sizeof(p)); +=20 +- /* Set up the bpf filter program structure. This is defined in +- bpf.c */ +- p.len =3D dhcp_bpf_filter_len; +- p.filter =3D dhcp_bpf_filter; +- +- /* Patch the server port into the LPF program... +- XXX changes to filter program may require changes +- to the insn number(s) used below! XXX */ +- dhcp_bpf_filter [8].k =3D ntohs ((short)local_port); ++ if (info->hw_address.hbuf[0] =3D=3D HTYPE_INFINIBAND) { ++ /* Set up the bpf filter program structure. */ ++ p.len =3D dhcp_ib_bpf_filter_len; ++ p.filter =3D dhcp_ib_bpf_filter; ++ ++ /* Patch the server port into the LPF program... ++ XXX ++ changes to filter program may require changes ++ to the insn number(s) used below! ++ XXX */ ++ dhcp_ib_bpf_filter[6].k =3D ntohs ((short)local_port); ++ } else { ++ /* Set up the bpf filter program structure. ++ This is defined in bpf.c */ ++ p.len =3D dhcp_bpf_filter_len; ++ p.filter =3D dhcp_bpf_filter; ++ ++ /* Patch the server port into the LPF program... ++ XXX changes to filter program may require changes ++ to the insn number(s) used below! XXX */ ++ dhcp_bpf_filter [8].k =3D ntohs ((short)local_port); ++ } +=20 + if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, + sizeof p) < 0) { +@@ -314,6 +351,54 @@ static void lpf_tr_filter_setup (info) + #endif /* USE_LPF_RECEIVE */ +=20 + #ifdef USE_LPF_SEND ++ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto) ++ struct interface_info *interface; ++ struct packet *packet; ++ struct dhcp_packet *raw; ++ size_t len; ++ struct in_addr from; ++ struct sockaddr_in *to; ++ struct hardware *hto; ++{ ++ unsigned ibufp =3D 0; ++ double ih [1536 / sizeof (double)]; ++ unsigned char *buf =3D (unsigned char *)ih; ++ ssize_t result; ++ ++ union sockunion { ++ struct sockaddr sa; ++ struct sockaddr_ll sll; ++ struct sockaddr_storage ss; ++ } su; ++ ++ assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr, ++ to->sin_addr.s_addr, to->sin_port, ++ (unsigned char *)raw, len); ++ memcpy (buf + ibufp, raw, len); ++ ++ memset(&su, 0, sizeof(su)); ++ su.sll.sll_family =3D AF_PACKET; ++ su.sll.sll_protocol =3D htons(ETHERTYPE_IP); ++ ++ if (!(su.sll.sll_ifindex =3D if_nametoindex(interface->name))) { ++ errno =3D ENOENT; ++ log_error ("send_packet_ib: %m - failed to get if index"); ++ return -1; ++ } ++ ++ su.sll.sll_hatype =3D htons(HTYPE_INFINIBAND); ++ su.sll.sll_halen =3D sizeof(interface->bcast_addr); ++ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20); ++ ++ result =3D sendto(interface->wfdesc, buf, ibufp + len, 0, ++ &su.sa, sizeof(su)); ++ ++ if (result < 0) ++ log_error ("send_packet_ib: %m"); ++ ++ return result; ++} ++ + ssize_t send_packet (interface, packet, raw, len, from, to, hto) + struct interface_info *interface; + struct packet *packet; +@@ -334,6 +419,11 @@ ssize_t send_packet (interface, packet,=20 + return send_fallback (interface, packet, raw, + len, from, to, hto); +=20 ++ if (interface->hw_address.hbuf[0] =3D=3D HTYPE_INFINIBAND) { ++ return send_packet_ib(interface, packet, raw, len, from, ++ to, hto); ++ } ++ + if (hto =3D=3D NULL && interface->anycast_mac_addr.hlen) + hto =3D &interface->anycast_mac_addr; +=20 +@@ -355,6 +445,42 @@ ssize_t send_packet (interface, packet,=20 + #endif /* USE_LPF_SEND */ +=20 + #ifdef USE_LPF_RECEIVE ++ssize_t receive_packet_ib (interface, buf, len, from, hfrom) ++ struct interface_info *interface; ++ unsigned char *buf; ++ size_t len; ++ struct sockaddr_in *from; ++ struct hardware *hfrom; ++{ ++ int length =3D 0; ++ int offset =3D 0; ++ unsigned char ibuf [1536]; ++ unsigned bufix =3D 0; ++ unsigned paylen; ++ ++ length =3D read(interface->rfdesc, ibuf, sizeof(ibuf)); ++ ++ if (length <=3D 0) ++ return length; ++ ++ offset =3D decode_udp_ip_header(interface, ibuf, bufix, from, ++ (unsigned)length, &paylen, 0); ++ ++ if (offset < 0) ++ return 0; ++ ++ bufix +=3D offset; ++ length -=3D offset; ++ ++ if (length < paylen) ++ log_fatal("Internal inconsistency at %s:%d.", MDL); ++ ++ /* Copy out the data in the packet... */ ++ memcpy(buf, &ibuf[bufix], paylen); ++ ++ return (ssize_t)paylen; ++} ++ + ssize_t receive_packet (interface, buf, len, from, hfrom) + struct interface_info *interface; + unsigned char *buf; +@@ -381,6 +507,10 @@ ssize_t receive_packet (interface, buf,=20 + }; + struct cmsghdr *cmsg; +=20 ++ if (interface->hw_address.hbuf[0] =3D=3D HTYPE_INFINIBAND) { ++ return receive_packet_ib(interface, buf, len, from, hfrom); ++ } ++ + length =3D recvmsg (interface -> rfdesc, &msg, 0); + if (length <=3D 0) + return length; +@@ -461,33 +591,41 @@ void maybe_setup_fallback () + } +=20 + void +-get_hw_addr(const char *name, struct hardware *hw) { +- int sock; +- struct ifreq tmp; +- struct sockaddr *sa; ++get_hw_addr(struct interface_info *info) ++{ ++ struct hardware *hw =3D &info->hw_address; ++ char *name =3D info->name; ++ struct ifaddrs *ifaddrs; ++ struct ifaddrs *ifa; ++ struct sockaddr_ll *sll =3D NULL; +=20 +- if (strlen(name) >=3D sizeof(tmp.ifr_name)) { +- log_fatal("Device name too long: \"%s\"", name); +- } ++ if (getifaddrs(&ifaddrs) =3D=3D -1) ++ log_fatal("Failed to get interfaces"); ++ ++ for (ifa =3D ifaddrs; ifa !=3D NULL; ifa =3D ifa->ifa_next) { ++ ++ if (ifa->ifa_addr->sa_family !=3D AF_PACKET) ++ continue; +=20 +- sock =3D socket(AF_INET, SOCK_DGRAM, 0); +- if (sock < 0) { +- log_fatal("Can't create socket for \"%s\": %m", name); ++ if (ifa->ifa_flags & IFF_LOOPBACK) ++ continue; ++ ++ if (strcmp(ifa->ifa_name, name) =3D=3D 0) { ++ sll =3D (struct sockaddr_ll *)(void *)ifa->ifa_addr; ++ break; ++ } + } +=20 +- memset(&tmp, 0, sizeof(tmp)); +- strcpy(tmp.ifr_name, name); +- if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) { +- log_fatal("Error getting hardware address for \"%s\": %m",=20 +- name); ++ if (sll =3D=3D NULL) { ++ freeifaddrs(ifaddrs); ++ log_fatal("Failed to get HW address for %s\n", name); + } +=20 +- sa =3D &tmp.ifr_hwaddr; +- switch (sa->sa_family) { ++ switch (sll->sll_hatype) { + case ARPHRD_ETHER: + hw->hlen =3D 7; + hw->hbuf[0] =3D HTYPE_ETHER; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); + break; + case ARPHRD_IEEE802: + #ifdef ARPHRD_IEEE802_TR +@@ -495,18 +633,36 @@ get_hw_addr(const char *name, struct har + #endif /* ARPHRD_IEEE802_TR */ + hw->hlen =3D 7; + hw->hbuf[0] =3D HTYPE_IEEE802; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); + break; + case ARPHRD_FDDI: + hw->hlen =3D 17; + hw->hbuf[0] =3D HTYPE_FDDI; +- memcpy(&hw->hbuf[1], sa->sa_data, 16); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 16); ++ break; ++ case ARPHRD_INFINIBAND: ++ /* For Infiniband, save the broadcast address and store ++ * the port GUID into the hardware address. ++ */ ++ if (ifa->ifa_flags & IFF_BROADCAST) { ++ struct sockaddr_ll *bll; ++ ++ bll =3D (struct sockaddr_ll *)ifa->ifa_broadaddr; ++ memcpy(&info->bcast_addr, bll->sll_addr, 20); ++ } else { ++ memcpy(&info->bcast_addr, default_ib_bcast_addr, ++ 20); ++ } ++ ++ hw->hlen =3D 1; ++ hw->hbuf[0] =3D HTYPE_INFINIBAND; + break; + default: ++ freeifaddrs(ifaddrs); + log_fatal("Unsupported device type %ld for \"%s\"", +- (long int)sa->sa_family, name); ++ (long int)sll->sll_family, name); + } +=20 +- close(sock); ++ freeifaddrs(ifaddrs); + } + #endif +diff -up dhcp-4.2.0/includes/dhcp.h.ib dhcp-4.2.0/includes/dhcp.h +--- dhcp-4.2.0/includes/dhcp.h.ib 2009-11-19 20:49:01.000000000 -0500 ++++ dhcp-4.2.0/includes/dhcp.h 2010-09-23 06:21:03.000000000 -0400 +@@ -79,6 +79,7 @@ struct dhcp_packet { + #define HTYPE_ETHER 1 /* Ethernet 10Mbps */ + #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ + #define HTYPE_FDDI 8 /* FDDI... */ ++#define HTYPE_INFINIBAND 32 /* Infiniband IPoIB */ +=20 + /* Magic cookie validating dhcp options field (and bootp vendor + extensions field). */ +diff -up dhcp-4.2.0/client/dhclient.c.ib dhcp-4.2.0/client/dhclient.c +--- dhcp-4.2.0/client/dhclient.c.ib 2010-09-23 06:11:14.000000000 -0400 ++++ dhcp-4.2.0/client/dhclient.c 2010-09-23 06:21:03.000000000 -0400 +@@ -98,6 +98,29 @@ static void usage(void); +=20 + static isc_result_t write_duid(struct data_string *duid); +=20 ++static void setup_ib_interface(struct interface_info *ip) ++{ ++ struct group *g; ++ ++ /* Set the broadcast flag */ ++ ip->client->config->bootp_broadcast_always =3D 1; ++ ++ /* ++ * Find out if a dhcp-client-identifier option was specified either ++ * in the config file or on the command line ++ */ ++ for (g =3D ip->client->config->on_transmission; g !=3D NULL; g =3D g->= next) { ++ if ((g->statements !=3D NULL) && ++ (strcmp(g->statements->data.option->option->name, ++ "dhcp-client-identifier") =3D=3D 0)) { ++ return; ++ } ++ } ++ ++ /* No client ID specified */ ++ log_fatal("dhcp-client-identifier must be specified for InfiniBand"); ++} ++ + int + main(int argc, char **argv) { + int fd; +@@ -805,6 +828,14 @@ main(int argc, char **argv) { + } + srandom(seed + cur_time); +=20 ++ /* Setup specific Infiniband options */ ++ for (ip =3D interfaces; ip; ip =3D ip->next) { ++ if (ip->client && ++ (ip->hw_address.hbuf[0] =3D=3D HTYPE_INFINIBAND)) { ++ setup_ib_interface(ip); ++ } ++ } ++ + /* Start a configuration state machine for each interface. */ + #ifdef DHCPv6 + if (local_family =3D=3D AF_INET6) { +diff -up dhcp-4.2.0/common/bpf.c.ib dhcp-4.2.0/common/bpf.c +--- dhcp-4.2.0/common/bpf.c.ib 2010-09-23 05:24:01.000000000 -0400 ++++ dhcp-4.2.0/common/bpf.c 2010-09-23 06:37:48.000000000 -0400 +@@ -116,7 +116,7 @@ int if_register_bpf (info) + log_fatal ("Can't attach interface %s to bpf device %s: %m", + info -> name, filename); +=20 +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); +=20 + return sock; + } +@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] =3D { + BPF_STMT(BPF_RET+BPF_K, 0), + }; +=20 ++/* Packet filter program for DHCP over Infiniband. ++ * ++ * XXX ++ * Changes to the filter program may require changes to the constant of= fsets ++ * used in lpf_gen_filter_setup to patch the port in the BPF program! ++ * XXX ++ */ ++struct bpf_insn dhcp_ib_bpf_filter [] =3D { ++ /* Packet filter for Infiniband */ ++ /* Make sure it's a UDP packet... */ ++ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6), ++ ++ /* Make sure this isn't a fragment... */ ++ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6), ++ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), ++ ++ /* Get the IP header length... */ ++ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0), ++ ++ /* Make sure it's to the right port... */ ++ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), ++ ++ /* If we passed all the tests, ask for the whole packet. */ ++ BPF_STMT(BPF_RET + BPF_K, (u_int)-1), ++ ++ /* Otherwise, drop it. */ ++ BPF_STMT(BPF_RET + BPF_K, 0), ++}; ++ + #if defined (DEC_FDDI) + struct bpf_insn *bpf_fddi_filter; + #endif +=20 + int dhcp_bpf_filter_len =3D sizeof dhcp_bpf_filter / sizeof (struct bpf= _insn); ++int dhcp_ib_bpf_filter_len =3D sizeof dhcp_ib_bpf_filter / sizeof (stru= ct bpf_insn); ++ + #if defined (HAVE_TR_SUPPORT) + struct bpf_insn dhcp_bpf_tr_filter [] =3D { + /* accept all token ring packets due to variable length header = */ +@@ -552,7 +585,9 @@ void maybe_setup_fallback () + } +=20 + void +-get_hw_addr(const char *name, struct hardware *hw) { ++get_hw_addr(struct interface_info *info) { ++ struct hardware *hw =3D &info->hw_address; ++ char *name =3D info->name; + struct ifaddrs *ifa; + struct ifaddrs *p; + struct sockaddr_dl *sa; +diff -up dhcp-4.2.0/common/socket.c.ib dhcp-4.2.0/common/socket.c +--- dhcp-4.2.0/common/socket.c.ib 2009-11-19 20:49:01.000000000 -0500 ++++ dhcp-4.2.0/common/socket.c 2010-09-23 06:21:03.000000000 -0400 +@@ -283,7 +283,7 @@ if_register_socket(struct interface_info +=20 + /* If this is a normal IPv4 address, get the hardware address. */ + if ((local_family =3D=3D AF_INET) && (strcmp(info->name, "fallback") != =3D 0)) +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); +=20 + return sock; + } +@@ -429,7 +429,7 @@ if_register6(struct interface_info *info + if (req_multi) + if_register_multicast(info); +=20 +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); +=20 + if (!quiet_interface_discovery) { + if (info->shared_network !=3D NULL) { +diff -up dhcp-4.2.0/includes/dhcpd.h.ib dhcp-4.2.0/includes/dhcpd.h +--- dhcp-4.2.0/includes/dhcpd.h.ib 2010-09-23 06:07:17.000000000 -0400 ++++ dhcp-4.2.0/includes/dhcpd.h 2010-09-23 06:21:03.000000000 -0400 +@@ -1214,6 +1214,7 @@ struct interface_info { + struct shared_network *shared_network; + /* Networks connected to this interface. */ + struct hardware hw_address; /* Its physical address. */ ++ u_int8_t bcast_addr[20]; /* Infiniband broadcast address */ + struct in_addr *addresses; /* Addresses associated with this + * interface. + */ +@@ -2324,7 +2325,7 @@ void print_dns_status (int, struct dhcp_ + #endif + const char *print_time(TIME); +=20 +-void get_hw_addr(const char *name, struct hardware *hw); ++void get_hw_addr(struct interface_info *info); +=20 + /* socket.c */ + #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ +diff -up dhcp-4.2.0/common/dlpi.c.ib dhcp-4.2.0/common/dlpi.c +--- dhcp-4.2.0/common/dlpi.c.ib 2010-09-23 05:24:05.000000000 -0400 ++++ dhcp-4.2.0/common/dlpi.c 2010-09-23 06:39:26.000000000 -0400 +@@ -1342,7 +1342,9 @@ void maybe_setup_fallback () + #endif /* USE_DLPI_SEND */ +=20 + void=20 +-get_hw_addr(const char *name, struct hardware *hw) { ++get_hw_addr(struct interface_info *info) { ++ struct hardware *hw =3D &info->hw_address; ++ char *name =3D info->name; + int sock, unit; + long buf[DLPI_MAXDLBUF]; + union DL_primitives *dlp; diff --git a/net-misc/dhcp/files/dhcp-4.2.0-options.patch b/net-misc/dhcp= /files/dhcp-4.2.0-options.patch new file mode 100644 index 0000000..6c2062a --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.0-options.patch @@ -0,0 +1,401 @@ +diff -up dhcp-4.2.0/client/clparse.c.options dhcp-4.2.0/client/clparse.c +--- dhcp-4.2.0/client/clparse.c.options 2009-11-19 20:48:58.000000000 -0= 500 ++++ dhcp-4.2.0/client/clparse.c 2010-09-23 06:07:17.000000000 -0400 +@@ -136,6 +136,7 @@ isc_result_t read_client_conf () + /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache) + */ + top_level_config.requested_lease =3D 7200; ++ top_level_config.bootp_broadcast_always =3D 0; +=20 + group_allocate (&top_level_config.on_receipt, MDL); + if (!top_level_config.on_receipt) +@@ -303,7 +304,8 @@ void read_client_leases () + interface-declaration | + LEASE client-lease-statement | + ALIAS client-lease-statement | +- KEY key-definition */ ++ KEY key-definition | ++ BOOTP_BROADCAST_ALWAYS */ +=20 + void parse_client_statement (cfile, ip, config) + struct parse *cfile; +@@ -717,6 +719,12 @@ void parse_client_statement (cfile, ip,=20 + parse_reject_statement (cfile, config); + return; +=20 ++ case BOOTP_BROADCAST_ALWAYS: ++ token =3D next_token(&val, (unsigned*)0, cfile); ++ config -> bootp_broadcast_always =3D 1; ++ parse_semi (cfile); ++ return; ++ + default: + lose =3D 0; + stmt =3D (struct executable_statement *)0; +diff -up dhcp-4.2.0/client/dhclient.c.options dhcp-4.2.0/client/dhclient= .c +--- dhcp-4.2.0/client/dhclient.c.options 2010-02-17 15:33:55.000000000 -= 0500 ++++ dhcp-4.2.0/client/dhclient.c 2010-09-23 06:11:14.000000000 -0400 +@@ -39,6 +39,12 @@ + #include + #include +=20 ++/* ++ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to def= ine ++ * that when building ISC code. ++ */ ++extern int asprintf(char **strp, const char *fmt, ...); ++ + TIME default_lease_time =3D 43200; /* 12 hours... */ + TIME max_lease_time =3D 86400; /* 24 hours... */ +=20 +@@ -82,6 +88,9 @@ int wanted_ia_na =3D -1; /* the absolute=20 + int wanted_ia_ta =3D 0; + int wanted_ia_pd =3D 0; + char *mockup_relay =3D NULL; ++int bootp_broadcast_always =3D 0; ++ ++extern u_int32_t default_requested_options[]; +=20 + void run_stateless(int exit_mode); +=20 +@@ -112,6 +121,15 @@ main(int argc, char **argv) { + int local_family_set =3D 0; + #endif /* DHCPv6 */ + char *s; ++ char *dhcp_client_identifier_arg =3D NULL; ++ char *dhcp_host_name_arg =3D NULL; ++ char *dhcp_fqdn_arg =3D NULL; ++ char *dhcp_vendor_class_identifier_arg =3D NULL; ++ char *dhclient_request_options =3D NULL; ++ ++ int timeout_arg =3D 0; ++ char *arg_conf =3D NULL; ++ int arg_conf_len =3D 0; +=20 + /* Initialize client globals. */ + memset(&default_duid, 0, sizeof(default_duid)); +@@ -297,6 +315,88 @@ main(int argc, char **argv) { + } else if (!strcmp(argv[i], "--version")) { + log_info("isc-dhclient-%s", PACKAGE_VERSION); + exit(0); ++ } else if (!strcmp(argv[i], "-I")) { ++ if ((++i =3D=3D argc) || (argv[i] =3D=3D NULL) || (*(argv[i])=3D=3D'= \0')) { ++ usage(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >=3D DHCP_MAX_OPTION_LEN) { ++ log_error("-I option dhcp-client-identifier string \"%s\" is too lo= ng - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1); ++ exit(1); ++ } ++ ++ dhcp_client_identifier_arg =3D argv[i]; ++ } else if (!strcmp(argv[i], "-B")) { ++ bootp_broadcast_always =3D 1; ++ } else if (!strcmp(argv[i], "-H")) { ++ if ((++i =3D=3D argc) || (argv[i] =3D=3D NULL) || (*(argv[i])=3D=3D'= \0')) { ++ usage(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >=3D DHCP_MAX_OPTION_LEN) { ++ log_error("-H option host-name string \"%s\" is too long - maximum = length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1); ++ exit(1); ++ } ++ ++ if (dhcp_host_name_arg !=3D NULL) { ++ log_error("The -H and -F arguments are mutually = exclusive"); ++ exit(1); ++ } ++ ++ dhcp_host_name_arg =3D argv[i]; ++ } else if (!strcmp(argv[i], "-F")) { ++ if ((++i =3D=3D argc) || (argv[i] =3D=3D NULL) || (*(argv[i])=3D=3D'= \0')) { ++ usage(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >=3D DHCP_MAX_OPTION_LEN) { ++ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum = length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1); ++ exit(1); ++ } ++ ++ if (dhcp_fqdn_arg !=3D NULL) { ++ log_error("Only one -F argument can be specified"); ++ exit(1); ++ } ++ ++ if (dhcp_host_name_arg !=3D NULL) { ++ log_error("The -F and -H arguments are mutually = exclusive"); ++ exit(1); ++ } ++ ++ dhcp_fqdn_arg =3D argv[i]; ++ } else if (!strcmp(argv[i], "-timeout")) { ++ if ((++i =3D=3D argc) || (argv[i] =3D=3D NULL) || (*(argv[i])=3D=3D'= \0')) { ++ usage(); ++ exit(1); ++ } ++ ++ if ((timeout_arg =3D atoi(argv[i])) <=3D 0) { ++ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]); ++ exit(1); ++ } ++ } else if (!strcmp(argv[i], "-V")) { ++ if ((++i =3D=3D argc) || (argv[i] =3D=3D NULL) || (*(argv[i])=3D=3D'= \0')) { ++ usage(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >=3D DHCP_MAX_OPTION_LEN) { ++ log_error("-V option vendor-class-identifier string \"%s\" is too l= ong - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1); ++ exit(1); ++ } ++ ++ dhcp_vendor_class_identifier_arg =3D argv[i]; ++ } else if (!strcmp(argv[i], "-R")) { ++ if ((++i =3D=3D argc) || (argv[i] =3D=3D NULL) || (*(argv[i])=3D=3D'= \0')) { ++ usage(); ++ exit(1); ++ } ++ ++ dhclient_request_options =3D argv[i]; + } else if (argv[i][0] =3D=3D '-') { + usage(); + } else if (interfaces_requested < 0) { +@@ -466,6 +566,166 @@ main(int argc, char **argv) { + /* Parse the dhclient.conf file. */ + read_client_conf(); +=20 ++ /* Parse any extra command line configuration arguments: */ ++ if ((dhcp_client_identifier_arg !=3D NULL) && (*dhcp_client_identifier= _arg !=3D '\0')) { ++ arg_conf_len =3D asprintf(&arg_conf, "send dhcp-client-identifier \"%= s\";", dhcp_client_identifier_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to send -I option dhcp-client-identifier"); ++ } ++ ++ if ((dhcp_host_name_arg !=3D NULL) && (*dhcp_host_name_arg !=3D '\0'))= { ++ if (arg_conf =3D=3D 0) { ++ arg_conf_len =3D asprintf(&arg_conf, "send host-name \"%s\";", dhcp_= host_name_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to send -H option host-name"); ++ } else { ++ char *last_arg_conf =3D arg_conf; ++ arg_conf =3D NULL; ++ arg_conf_len =3D asprintf(&arg_conf, "%s\nsend host-name \"%s\";", l= ast_arg_conf, dhcp_host_name_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to send -H option host-name"); ++ ++ free(last_arg_conf); ++ } ++ } ++ ++ if ((dhcp_fqdn_arg !=3D NULL) && (*dhcp_fqdn_arg !=3D '\0')) { ++ if (arg_conf =3D=3D 0) { ++ arg_conf_len =3D asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp= _fqdn_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to send -F option fqdn.fqdn"); ++ } else { ++ char *last_arg_conf =3D arg_conf; ++ arg_conf =3D NULL; ++ arg_conf_len =3D asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", l= ast_arg_conf, dhcp_fqdn_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to send -F option fqdn.fqdn"); ++ ++ free(last_arg_conf); ++ } ++ } ++ ++ if (timeout_arg) { ++ if (arg_conf =3D=3D 0) { ++ arg_conf_len =3D asprintf(&arg_conf, "timeout %d;", timeout_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to process -timeout timeout argument"); ++ } else { ++ char *last_arg_conf =3D arg_conf; ++ arg_conf =3D NULL; ++ arg_conf_len =3D asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_con= f, timeout_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len =3D=3D 0)) ++ log_fatal("Unable to process -timeout timeout argument"); ++ ++ free(last_arg_conf); ++ } ++ } ++ ++ if ((dhcp_vendor_class_identifier_arg !=3D NULL) && (*dhcp_vendor_clas= s_identifier_arg !=3D '\0')) { ++ if (arg_conf =3D=3D 0) { ++ arg_conf_len =3D asprintf(&arg_conf, "send vendor-class-identifier = \"%s\";", dhcp_vendor_class_identifier_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to send -V option vendor-class-identifier"); ++ } else { ++ char *last_arg_conf =3D arg_conf; ++ arg_conf =3D NULL; ++ arg_conf_len =3D asprintf(&arg_conf, "%s\nsend vendor-class-identifi= er \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to send -V option vendor-class-identifier"); ++ ++ free(last_arg_conf); ++ } ++ } ++ ++ if (dhclient_request_options !=3D NULL) { ++ if (arg_conf =3D=3D 0) { ++ arg_conf_len =3D asprintf(&arg_conf, "request %s;", dhclient_reques= t_options); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to parse -R argument"); ++ } else { ++ char *last_arg_conf =3D arg_conf; ++ arg_conf =3D NULL; ++ arg_conf_len =3D asprintf(&arg_conf, "%s\nrequest %s;", last_arg_con= f, dhclient_request_options); ++ ++ if ((arg_conf =3D=3D 0) || (arg_conf_len <=3D 0)) ++ log_fatal("Unable to parse -R argument"); ++ ++ free(last_arg_conf); ++ } ++ } ++ ++ if (arg_conf) { ++ if (arg_conf_len =3D=3D 0) ++ if ((arg_conf_len =3D strlen(arg_conf)) =3D=3D 0) ++ /* huh ? cannot happen ! */ ++ log_fatal("Unable to process -I/-H/-F/-timeout/-V/-R configuration = arguments"); ++ ++ /* parse the extra dhclient.conf configuration arguments ++ * into top level config: */ ++ struct parse *cfile =3D (struct parse *)0; ++ const char *val =3D NULL; ++ int token; ++ ++ status =3D new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhcli= ent -I/-H/-F/-timeout/-V/-R configuration arguments", 0); ++ ++ if ((status !=3D ISC_R_SUCCESS) || (cfile -> warnings_occurred)) ++ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration argume= nts !"); ++ /* more detailed parse failures will be logged */ ++ ++ do { ++ token =3D peek_token(&val, (unsigned *)0, cfile); ++ if (token =3D=3D END_OF_FILE) ++ break; ++ ++ parse_client_statement(cfile, (struct interface_info *)0, &top_level= _config); ++ } while (1); ++ ++ if (cfile -> warnings_occurred) ++ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration argume= nts !"); ++ end_parse(&cfile); ++ ++ if (timeout_arg) { ++ /* we just set the toplevel timeout, but per-client ++ * timeouts may still be at defaults. Also, it makes no ++ * sense having the reboot_timeout or backoff_cutoff ++ * greater than the timeout: ++ */ ++ if ((top_level_config.backoff_cutoff =3D=3D 15) && (top_level_config= .backoff_cutoff > (timeout_arg / 2))) ++ top_level_config.backoff_cutoff =3D (((unsigned long)(timeout_arg /= 2)) =3D=3D 0) ? timeout_arg : (unsigned long)(timeout_arg / 2); ++ ++ for (ip=3Dinterfaces; ip; ip =3D ip->next) { ++ if (ip->client->config->timeout =3D=3D 60) ++ ip->client->config->timeout =3D timeout_arg; ++ ++ if ((ip->client->config->reboot_timeout =3D=3D 10) && (ip->client->= config->reboot_timeout > ip->client->config->timeout)) ++ ip->client->config->reboot_timeout =3D ip->client->config->timeout= ; ++ if ((ip->client->config->backoff_cutoff =3D=3D 15) && (ip->client->= config->backoff_cutoff > top_level_config.backoff_cutoff)) ++ ip->client->config->backoff_cutoff =3D top_level_config.backoff_cu= toff; ++ } ++ } ++ ++ if ((dhclient_request_options !=3D 0) && (top_level_config.requested_= options !=3D (void *) default_requested_options)) { ++ for (ip=3Dinterfaces; ip; ip =3D ip->next) { ++ if (ip->client->config->requested_options =3D=3D (void *) default_r= equested_options) ++ ip->client->config->requested_options =3D top_level_config.request= ed_options; ++ } ++ } ++ ++ free(arg_conf); ++ arg_conf =3D NULL; ++ arg_conf_len =3D 0; ++ } ++ + /* Parse the lease database. */ + read_client_leases(); +=20 +@@ -2337,7 +2597,8 @@ void make_discover (client, lease) + client -> packet.xid =3D random (); + client -> packet.secs =3D 0; /* filled in by send_discover. */ +=20 +- if (can_receive_unicast_unconfigured (client -> interface)) ++ if ((!(bootp_broadcast_always || client->config->bootp_broadcast_alway= s)) ++ && can_receive_unicast_unconfigured(client->interface)) + client -> packet.flags =3D 0; + else + client -> packet.flags =3D htons (BOOTP_BROADCAST); +@@ -2421,7 +2682,9 @@ void make_request (client, lease) + } else { + memset (&client -> packet.ciaddr, 0, + sizeof client -> packet.ciaddr); +- if (can_receive_unicast_unconfigured (client -> interface)) ++ if ((!(bootp_broadcast_always || ++ client ->config->bootp_broadcast_always)) && ++ can_receive_unicast_unconfigured (client -> interface)) + client -> packet.flags =3D 0; + else + client -> packet.flags =3D htons (BOOTP_BROADCAST); +@@ -2483,7 +2746,8 @@ void make_decline (client, lease) + client -> packet.hops =3D 0; + client -> packet.xid =3D client -> xid; + client -> packet.secs =3D 0; /* Filled in by send_request. */ +- if (can_receive_unicast_unconfigured (client -> interface)) ++ if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_alwa= ys)) ++ && can_receive_unicast_unconfigured (client->interface)) + client -> packet.flags =3D 0; + else + client -> packet.flags =3D htons (BOOTP_BROADCAST); +diff -up dhcp-4.2.0/common/conflex.c.options dhcp-4.2.0/common/conflex.c +--- dhcp-4.2.0/common/conflex.c.options 2010-03-24 17:49:47.000000000 -0= 400 ++++ dhcp-4.2.0/common/conflex.c 2010-09-23 06:07:17.000000000 -0400 +@@ -803,6 +803,8 @@ intern(char *atom, enum dhcp_token dfv)=20 + return BALANCE; + if (!strcasecmp (atom + 1, "ound")) + return BOUND; ++ if (!strcasecmp (atom + 1, "ootp-broadcast-always")) ++ return BOOTP_BROADCAST_ALWAYS; + break; + case 'c': + if (!strcasecmp(atom + 1, "ase")) +diff -up dhcp-4.2.0/includes/dhcpd.h.options dhcp-4.2.0/includes/dhcpd.h +--- dhcp-4.2.0/includes/dhcpd.h.options 2010-09-23 05:24:32.000000000 -0= 400 ++++ dhcp-4.2.0/includes/dhcpd.h 2010-09-23 06:07:17.000000000 -0400 +@@ -1119,6 +1119,9 @@ struct client_config { + int do_forward_update; /* If nonzero, and if we have the + information we need, update the + A record for the address we get. */ ++ ++ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADC= AST ++ flag in requests */ + }; +=20 + /* Per-interface state used in the dhcp client... */ +diff -up dhcp-4.2.0/includes/dhctoken.h.options dhcp-4.2.0/includes/dhct= oken.h +--- dhcp-4.2.0/includes/dhctoken.h.options 2010-02-17 15:33:55.000000000= -0500 ++++ dhcp-4.2.0/includes/dhctoken.h 2010-09-23 06:08:18.000000000 -0400 +@@ -357,7 +357,8 @@ enum dhcp_token { + CONFLICT_DONE =3D 660, + AUTO_PARTNER_DOWN =3D 661, + GETHOSTNAME =3D 662, +- REWIND =3D 663 ++ REWIND =3D 663, ++ BOOTP_BROADCAST_ALWAYS =3D 664 + }; +=20 + #define is_identifier(x) ((x) >=3D FIRST_TOKEN && \ diff --git a/net-misc/dhcp/files/dhcp-4.2.0-xen-checksum.patch b/net-misc= /dhcp/files/dhcp-4.2.0-xen-checksum.patch new file mode 100644 index 0000000..fe33bdf --- /dev/null +++ b/net-misc/dhcp/files/dhcp-4.2.0-xen-checksum.patch @@ -0,0 +1,245 @@ +diff -up dhcp-4.2.0/common/bpf.c.xen dhcp-4.2.0/common/bpf.c +--- dhcp-4.2.0/common/bpf.c.xen 2009-11-19 20:48:59.000000000 -0500 ++++ dhcp-4.2.0/common/bpf.c 2010-09-23 05:24:01.000000000 -0400 +@@ -485,7 +485,7 @@ ssize_t receive_packet (interface, buf,=20 + offset =3D decode_udp_ip_header (interface, + interface -> rbuf, + interface -> rbuf_offset, +- from, hdr.bh_caplen, &paylen); ++ from, hdr.bh_caplen, &paylen, 0); +=20 + /* If the IP or UDP checksum was bad, skip the packet... */ + if (offset < 0) { +diff -up dhcp-4.2.0/common/dlpi.c.xen dhcp-4.2.0/common/dlpi.c +--- dhcp-4.2.0/common/dlpi.c.xen 2009-11-19 20:49:00.000000000 -0500 ++++ dhcp-4.2.0/common/dlpi.c 2010-09-23 05:24:05.000000000 -0400 +@@ -694,7 +694,7 @@ ssize_t receive_packet (interface, buf,=20 + length -=3D offset; + #endif + offset =3D decode_udp_ip_header (interface, dbuf, bufix, +- from, length, &paylen); ++ from, length, &paylen, 0); +=20 + /* + * If the IP or UDP checksum was bad, skip the packet... +diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c +--- dhcp-4.2.0/common/lpf.c.xen 2009-07-23 14:52:19.000000000 -0400 ++++ dhcp-4.2.0/common/lpf.c 2010-09-23 05:24:09.000000000 -0400 +@@ -29,18 +29,33 @@ + #include "dhcpd.h" + #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) + #include ++#include + #include + #include +=20 + #include + #include + #include ++#include + #include + #include "includes/netinet/ip.h" + #include "includes/netinet/udp.h" + #include "includes/netinet/if_ether.h" + #include +=20 ++#ifndef PACKET_AUXDATA ++#define PACKET_AUXDATA 8 ++ ++struct tpacket_auxdata ++{ ++ __u32 tp_status; ++ __u32 tp_len; ++ __u32 tp_snaplen; ++ __u16 tp_mac; ++ __u16 tp_net; ++}; ++#endif ++ + /* Reinitializes the specified interface after an address change. Thi= s + is not required for packet-filter APIs. */ +=20 +@@ -66,10 +81,14 @@ int if_register_lpf (info) + struct interface_info *info; + { + int sock; +- struct sockaddr sa; ++ union { ++ struct sockaddr_ll ll; ++ struct sockaddr common; ++ } sa; ++ struct ifreq ifr; +=20 + /* Make an LPF socket. */ +- if ((sock =3D socket(PF_PACKET, SOCK_PACKET, ++ if ((sock =3D socket(PF_PACKET, SOCK_RAW, + htons((short)ETH_P_ALL))) < 0) { + if (errno =3D=3D ENOPROTOOPT || errno =3D=3D EPROTONOSUPPORT || + errno =3D=3D ESOCKTNOSUPPORT || errno =3D=3D EPFNOSUPPORT || +@@ -84,11 +103,16 @@ int if_register_lpf (info) + log_fatal ("Open a socket for LPF: %m"); + } +=20 ++ memset (&ifr, 0, sizeof ifr); ++ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name)= ; ++ if (ioctl (sock, SIOCGIFINDEX, &ifr)) ++ log_fatal ("Failed to get interface index: %m"); ++ + /* Bind to the interface name */ + memset (&sa, 0, sizeof sa); +- sa.sa_family =3D AF_PACKET; +- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data); +- if (bind (sock, &sa, sizeof sa)) { ++ sa.ll.sll_family =3D AF_PACKET; ++ sa.ll.sll_ifindex =3D ifr.ifr_ifindex; ++ if (bind (sock, &sa.common, sizeof sa)) { + if (errno =3D=3D ENOPROTOOPT || errno =3D=3D EPROTONOSUPPORT || + errno =3D=3D ESOCKTNOSUPPORT || errno =3D=3D EPFNOSUPPORT || + errno =3D=3D EAFNOSUPPORT || errno =3D=3D EINVAL) { +@@ -170,9 +194,18 @@ static void lpf_gen_filter_setup (struct + void if_register_receive (info) + struct interface_info *info; + { ++ int val; ++ + /* Open a LPF device and hang it on this interface... */ + info -> rfdesc =3D if_register_lpf (info); +=20 ++ val =3D 1; ++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val, ++ sizeof val) < 0) { ++ if (errno !=3D ENOPROTOOPT) ++ log_fatal ("Failed to set auxiliary packet data: %m"); ++ } ++ + #if defined (HAVE_TR_SUPPORT) + if (info -> hw_address.hbuf [0] =3D=3D HTYPE_IEEE802) + lpf_tr_filter_setup (info); +@@ -294,7 +327,6 @@ ssize_t send_packet (interface, packet,=20 + double hh [16]; + double ih [1536 / sizeof (double)]; + unsigned char *buf =3D (unsigned char *)ih; +- struct sockaddr sa; + int result; + int fudge; +=20 +@@ -315,15 +347,7 @@ ssize_t send_packet (interface, packet,=20 + (unsigned char *)raw, len); + memcpy (buf + ibufp, raw, len); +=20 +- /* For some reason, SOCK_PACKET sockets can't be connected, +- so we have to do a sentdo every time. */ +- memset (&sa, 0, sizeof sa); +- sa.sa_family =3D AF_PACKET; +- strncpy (sa.sa_data, +- (const char *)interface -> ifp, sizeof sa.sa_data); +- +- result =3D sendto (interface -> wfdesc, +- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa); ++ result =3D write (interface -> wfdesc, buf + fudge, ibufp + len - fudg= e); + if (result < 0) + log_error ("send_packet: %m"); + return result; +@@ -340,14 +364,35 @@ ssize_t receive_packet (interface, buf,=20 + { + int length =3D 0; + int offset =3D 0; ++ int nocsum =3D 0; + unsigned char ibuf [1536]; + unsigned bufix =3D 0; + unsigned paylen; ++ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))]; ++ struct iovec iov =3D { ++ .iov_base =3D ibuf, ++ .iov_len =3D sizeof ibuf, ++ }; ++ struct msghdr msg =3D { ++ .msg_iov =3D &iov, ++ .msg_iovlen =3D 1, ++ .msg_control =3D cmsgbuf, ++ .msg_controllen =3D sizeof(cmsgbuf), ++ }; ++ struct cmsghdr *cmsg; +=20 +- length =3D read (interface -> rfdesc, ibuf, sizeof ibuf); ++ length =3D recvmsg (interface -> rfdesc, &msg, 0); + if (length <=3D 0) + return length; +=20 ++ for (cmsg =3D CMSG_FIRSTHDR(&msg); cmsg; cmsg =3D CMSG_NXTHDR(&msg, cm= sg)) { ++ if (cmsg->cmsg_level =3D=3D SOL_PACKET && ++ cmsg->cmsg_type =3D=3D PACKET_AUXDATA) { ++ struct tpacket_auxdata *aux =3D (void *)CMSG_DATA(cmsg); ++ nocsum =3D aux->tp_status & TP_STATUS_CSUMNOTREADY; ++ } ++ } ++ + bufix =3D 0; + /* Decode the physical header... */ + offset =3D decode_hw_header (interface, ibuf, bufix, hfrom); +@@ -364,7 +409,7 @@ ssize_t receive_packet (interface, buf,=20 +=20 + /* Decode the IP and UDP headers... */ + offset =3D decode_udp_ip_header (interface, ibuf, bufix, from, +- (unsigned)length, &paylen); ++ (unsigned)length, &paylen, nocsum); +=20 + /* If the IP or UDP checksum was bad, skip the packet... */ + if (offset < 0) +diff -up dhcp-4.2.0/common/nit.c.xen dhcp-4.2.0/common/nit.c +--- dhcp-4.2.0/common/nit.c.xen 2009-11-19 20:49:01.000000000 -0500 ++++ dhcp-4.2.0/common/nit.c 2010-09-23 05:24:18.000000000 -0400 +@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf,=20 +=20 + /* Decode the IP and UDP headers... */ + offset =3D decode_udp_ip_header (interface, ibuf, bufix, +- from, length, &paylen); ++ from, length, &paylen, 0); +=20 + /* If the IP or UDP checksum was bad, skip the packet... */ + if (offset < 0) +diff -up dhcp-4.2.0/common/packet.c.xen dhcp-4.2.0/common/packet.c +--- dhcp-4.2.0/common/packet.c.xen 2009-07-23 14:52:20.000000000 -0400 ++++ dhcp-4.2.0/common/packet.c 2010-09-23 05:24:21.000000000 -0400 +@@ -211,7 +211,7 @@ ssize_t + decode_udp_ip_header(struct interface_info *interface, + unsigned char *buf, unsigned bufix, + struct sockaddr_in *from, unsigned buflen, +- unsigned *rbuflen) ++ unsigned *rbuflen, int nocsum) + { + unsigned char *data; + struct ip ip; +@@ -322,7 +322,7 @@ decode_udp_ip_header(struct interface_in + 8, IPPROTO_UDP + ulen)))); +=20 + udp_packets_seen++; +- if (usum && usum !=3D sum) { ++ if (!nocsum && usum && usum !=3D sum) { + udp_packets_bad_checksum++; + if (udp_packets_seen > 4 && + (udp_packets_seen / udp_packets_bad_checksum) < 2) { +diff -up dhcp-4.2.0/common/upf.c.xen dhcp-4.2.0/common/upf.c +--- dhcp-4.2.0/common/upf.c.xen 2009-11-19 20:49:01.000000000 -0500 ++++ dhcp-4.2.0/common/upf.c 2010-09-23 05:24:25.000000000 -0400 +@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf,=20 +=20 + /* Decode the IP and UDP headers... */ + offset =3D decode_udp_ip_header (interface, ibuf, bufix, +- from, length, &paylen); ++ from, length, &paylen, 0); +=20 + /* If the IP or UDP checksum was bad, skip the packet... */ + if (offset < 0) +diff -up dhcp-4.2.0/includes/dhcpd.h.xen dhcp-4.2.0/includes/dhcpd.h +--- dhcp-4.2.0/includes/dhcpd.h.xen 2010-06-01 13:29:59.000000000 -0400 ++++ dhcp-4.2.0/includes/dhcpd.h 2010-09-23 05:24:32.000000000 -0400 +@@ -2769,7 +2769,7 @@ ssize_t decode_hw_header PROTO ((struct=20 + unsigned, struct hardware *)); + ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned = char *, + unsigned, struct sockaddr_in *, +- unsigned, unsigned *)); ++ unsigned, unsigned *, int)); +=20 + /* ethernet.c */ + void assemble_ethernet_header PROTO ((struct interface_info *, unsigned= char *, diff --git a/net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch b/n= et-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch new file mode 100644 index 0000000..6d8caec --- /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 +=20 + make_resolv_conf() { ++ if [ x"$PEER_DNS" !=3D x ] && [ x$"PEER_DNS" !=3D xyes ]; then ++ return 0 ++ fi ++ local conf=3D + if [ x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient + if [ "x$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient ++ conf=3D"${conf}search ${new_domain_search}\n" + elif [ "x$new_domain_name" !=3D 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=3D"${conf}search ${new_domain_name}\n" + fi + for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >> /etc/resolv.conf.dhclient ++ conf=3D"${conf}nameserver ${nameserver}\n" + done +- +- mv /etc/resolv.conf.dhclient /etc/resolv.conf + elif [ "x${new_dhcp6_name_servers}" !=3D x ] ; then +- cat /dev/null > /etc/resolv.conf.dhclient6 +- chmod 644 /etc/resolv.conf.dhclient6 +- + if [ "x${new_dhcp6_domain_search}" !=3D x ] ; then +- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclie= nt6 ++ conf=3D"${conf}search ${new_dhcp6_domain_search}\n" + fi + for nameserver in ${new_dhcp6_name_servers} ; do +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf=3D"${conf}nameserver ${nameserver}\n" + done ++ fi +=20 +- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf ++ if [ x"$conf" !=3D x ]; then ++ conf=3D"# 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 +=20 + make_resolv_conf() { ++ if [ x"$PEER_DNS" !=3D x ] && [ x$"PEER_DNS" !=3D xyes ]; then ++ return 0 ++ fi ++ local conf=3D + if [ x"$new_domain_name_servers" !=3D x ]; then +- ( cat /dev/null > /etc/resolv.conf.dhclient ) +- exit_status=3D$? +- if [ $exit_status -ne 0 ]; then +- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_= status" +- else +- if [ "x$new_domain_search" !=3D x ]; then +- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient ) +- exit_status=3D$? +- elif [ "x$new_domain_name" !=3D 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=3D$? +- 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=3D$? +- 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=3D$? +- fi +- +- if [ $exit_status -ne 0 ]; then +- $LOGGER "Error while writing new /etc/resolv.conf." +- fi ++ if [ "x$new_domain_search" !=3D x ]; then ++ conf=3D"${conf}search ${new_domain_search}\n" ++ elif [ "x$new_domain_name" !=3D 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=3D"${conf}search ${new_domain_name}\n" + fi ++ for nameserver in $new_domain_name_servers; do ++ conf=3D"${conf}nameserver ${nameserver}\n" ++ done + elif [ "x${new_dhcp6_name_servers}" !=3D x ] ; then +- ( cat /dev/null > /etc/resolv.conf.dhclient6 ) +- exit_status=3D$? +- if [ $exit_status -ne 0 ] ; then +- $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit= _status" +- else +- if [ "x${new_dhcp6_domain_search}" !=3D x ] ; then +- ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6= ) +- exit_status=3D$? +- 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=3D$? +- done +- +- if [ $exit_status -eq 0 ] ; then +- ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf ) +- exit_status=3D$? +- fi ++ if [ "x${new_dhcp6_domain_search}" !=3D x ] ; then ++ conf=3D"${conf}search ${new_dhcp6_domain_search}\n" ++ fi ++ for nameserver in ${new_dhcp6_name_servers} ; do ++ conf=3D"${conf}nameserver ${nameserver}\n" ++ done ++ fi +=20 +- if [ $exit_status -ne 0 ] ; then +- $LOGGER "Error while writing new /etc/resolv.conf." +- fi ++ if [ x"$conf" !=3D x ]; then ++ conf=3D"# 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=3D/sbin/ip +=20 + make_resolv_conf() { ++ if [ x"$PEER_DNS" !=3D x ] && [ x$"PEER_DNS" !=3D xyes ]; then ++ return 0 ++ fi ++ local conf=3D + if [ x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- chmod 644 /etc/resolv.conf.dhclient +- if [ x"$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ x"$new_domain_name" !=3D x ]; then ++ if [ "x$new_domain_search" !=3D x ]; then ++ conf=3D"${conf}search ${new_domain_search}\n" ++ elif [ "x$new_domain_name" !=3D 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=3D"${conf}search ${new_domain_name}\n" + fi + for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient ++ conf=3D"${conf}nameserver ${nameserver}\n" + done +- +- mv /etc/resolv.conf.dhclient /etc/resolv.conf + elif [ "x${new_dhcp6_name_servers}" !=3D x ] ; then +- cat /dev/null > /etc/resolv.conf.dhclient6 +- chmod 644 /etc/resolv.conf.dhclient6 +- + if [ "x${new_dhcp6_domain_search}" !=3D x ] ; then +- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclie= nt6 ++ conf=3D"${conf}search ${new_dhcp6_domain_search}\n" + fi + for nameserver in ${new_dhcp6_name_servers} ; do +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf=3D"${conf}nameserver ${nameserver}\n" + done ++ fi +=20 +- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf ++ if [ x"$conf" !=3D x ]; then ++ conf=3D"# 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 +=20 + make_resolv_conf() { +- if [ "x$new_domain_name" !=3D x ] && [ x"$new_domain_name_servers" !=3D= x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- if [ "x$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ "x$new_domain_name" !=3D x ]; then ++ if [ x"$PEER_DNS" !=3D x ] && [ x$"PEER_DNS" !=3D xyes ]; then ++ return 0 ++ fi ++ local conf=3D ++ if [ x"$new_domain_name_servers" !=3D x ]; then ++ if [ "x$new_domain_search" !=3D x ]; then ++ conf=3D"${conf}search ${new_domain_search}\n" ++ elif [ "x$new_domain_name" !=3D 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=3D"${conf}search ${new_domain_name}\n" + fi + for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient ++ conf=3D"${conf}nameserver ${nameserver}\n" + done +- +- mv /etc/resolv.conf.dhclient /etc/resolv.conf + elif [ "x${new_dhcp6_name_servers}" !=3D x ] ; then +- cat /dev/null > /etc/resolv.conf.dhclient6 +- chmod 644 /etc/resolv.conf.dhclient6 +- + if [ "x${new_dhcp6_domain_search}" !=3D x ] ; then +- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclie= nt6 ++ conf=3D"${conf}search ${new_dhcp6_domain_search}\n" + fi + for nameserver in ${new_dhcp6_name_servers} ; do +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf=3D"${conf}nameserver ${nameserver}\n" + done ++ fi +=20 +- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf ++ if [ x"$conf" !=3D x ]; then ++ conf=3D"# 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 +=20 + make_resolv_conf() { +- if x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- if [ x"$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ x"$new_domain_name" !=3D x ]; then ++ if [ x"$PEER_DNS" !=3D x ] && [ x$"PEER_DNS" !=3D xyes ]; then ++ return 0 ++ fi ++ local conf=3D ++ if [ x"$new_domain_name_servers" !=3D x ]; then ++ if [ "x$new_domain_search" !=3D x ]; then ++ conf=3D"${conf}search ${new_domain_search}\n" ++ elif [ "x$new_domain_name" !=3D 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=3D"${conf}search ${new_domain_name}\n" + fi + for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient ++ conf=3D"${conf}nameserver ${nameserver}\n" + done +- +- mv /etc/ersolv.conf.dhclient /etc/resolv.conf + elif [ "x${new_dhcp6_name_servers}" !=3D x ] ; then +- cat /dev/null > /etc/resolv.conf.dhclient6 +- chmod 644 /etc/resolv.conf.dhclient6 +- + if [ "x${new_dhcp6_domain_search}" !=3D x ] ; then +- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclie= nt6 ++ conf=3D"${conf}search ${new_dhcp6_domain_search}\n" + fi + for nameserver in ${new_dhcp6_name_servers} ; do +- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 ++ conf=3D"${conf}nameserver ${nameserver}\n" + done ++ fi +=20 +- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf ++ if [ x"$conf" !=3D x ]; then ++ conf=3D"# 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 =20 +=20 + make_resolv_conf() { ++ if [ x"$PEER_DNS" !=3D x ] && [ x$"PEER_DNS" !=3D xyes ]; then ++ return 0 ++ fi ++ local conf=3D + if [ x"$new_domain_name_servers" !=3D x ]; then +- cat /dev/null > /etc/resolv.conf.dhclient +- if [ x"$new_domain_search" !=3D x ]; then +- echo search $new_domain_search >> /etc/resolv.conf.dhclient +- elif [ x"$new_domain_name" !=3D x ]; then ++ if [ "x$new_domain_search" !=3D x ]; then ++ conf=3D"${conf}search ${new_domain_search}\n" ++ elif [ "x$new_domain_name" !=3D 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=3D"${conf}search ${new_domain_name}\n" + fi + for nameserver in $new_domain_name_servers; do +- echo nameserver $nameserver >>/etc/resolv.conf.dhclient ++ conf=3D"${conf}nameserver ${nameserver}\n" ++ done ++ elif [ "x${new_dhcp6_name_servers}" !=3D x ] ; then ++ if [ "x${new_dhcp6_domain_search}" !=3D x ] ; then ++ conf=3D"${conf}search ${new_dhcp6_domain_search}\n" ++ fi ++ for nameserver in ${new_dhcp6_name_servers} ; do ++ conf=3D"${conf}nameserver ${nameserver}\n" + done ++ fi +=20 +- mv /etc/resolv.conf.dhclient /etc/resolv.conf ++ if [ x"$conf" !=3D x ]; then ++ conf=3D"# 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/dh= cp/files/dhcp-4.2.1-nogateway.patch new file mode 100644 index 0000000..11aaace --- /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" =3D "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 =3D x ] || [ x$PEER_ROUTERS =3D xyes ]; then ++ for router in $new_routers; do ++ if [ "x$new_subnet_mask" =3D "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 !=3D x$alias_ip_address ] && [ x$alias_ip_addre= ss !=3D 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" =3D "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 =3D x ] || [ x$PEER_ROUTERS =3D xyes ]; then ++ for router in $new_routers; do ++ if [ "x$new_subnet_mask" =3D "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.conf b/net-misc/dhcp/files/dhcpd.c= onf new file mode 100644 index 0000000..1672633 --- /dev/null +++ b/net-misc/dhcp/files/dhcpd.conf @@ -0,0 +1,29 @@ +# /etc/conf.d/dhcpd: config file for /etc/init.d/dhcpd + +# If you require more than one instance of dhcpd you can create symbolic +# links to dhcpd service like so +# cd /etc/init.d +# ln -s dhcpd dhcpd.foo +# cd ../conf.d +# cp dhcpd dhcpd.foo +# Now you can edit dhcpd.foo and specify a different configuration file. +# You'll also need to specify a pidfile in that dhcpd.conf file. +# See the pid-file-name option in the dhcpd.conf man page for details. + +# If you wish to run dhcpd in a chroot, uncomment the following line +# DHCPD_CHROOT=3D"/chroot/dhcp" + +# Then run emerge dhcp --config +# All file paths below are relative to the chroot. +# You can specify a different chroot directory but MAKE SURE it's empty. + +# Specify a configuration file - the default is /etc/dhcp/dhcpd.conf +# DHCPD_CONF=3D"/etc/dhcp/dhcpd.conf" + +# Configure which interface or interfaces to for dhcpd to listen on. +# List all interfaces space separated. If this is not specified then +# we listen on all interfaces. +# DHCPD_IFACE=3D"" + +# Insert any other dhcpd options - see the man page for a full list. +# DHCPD_OPTS=3D"" diff --git a/net-misc/dhcp/files/dhcpd.init2 b/net-misc/dhcp/files/dhcpd.= init2 new file mode 100644 index 0000000..82cb26e --- /dev/null +++ b/net-misc/dhcp/files/dhcpd.init2 @@ -0,0 +1,94 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init2,v 1.1= 2009/07/09 14:45:22 chainsaw Exp $ + +opts=3D"configtest" + +DHCPD_CONF=3D${DHCPD_CONF:-/etc/dhcp/dhcpd.conf} + +depend() { + need net + use logger dns +} + +get_var() { + sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \ + "${DHCPD_CHROOT}/${DHCPD_CONF}" +} + +checkconfig() { + /usr/sbin/dhcpd -cf ${DHCPD_CHROOT}/${DHCPD_CONF} -t 1>/dev/null 2>&1 + ret=3D$? + if [ $ret -ne 0 ]; then + eerror "${SVCNAME} has detected a syntax error in your configuration f= iles:" + /usr/sbin/dhcpd -cf ${DHCPD_CHROOT}/${DHCPD_CONF} -t + fi + + return $ret +} + +configtest() { + ebegin "Checking ${SVCNAME} configuration" + checkconfig + eend $? +} + +start() { + # Work out our cffile if it's on our DHCPD_OPTS + case " ${DHCPD_OPTS} " in + *" -cf "*)=20 + DHCPD_CONF=3D" ${DHCPD_OPTS} " + DHCPD_CONF=3D"${DHCPD_CONF##* -cf }" + DHCPD_CONF=3D"${DHCPD_CONF%% *}" + ;; + *) DHCPD_OPTS=3D"${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 + + local leasefile=3D"$(get_var lease-file-name)" + leasefile=3D"${DHCPD_CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}" + if [ ! -f "${leasefile}" ] ; then + ebegin "Creating ${leasefile}" + touch "${leasefile}" + chown dhcp:dhcp "${leasefile}" + eend $? || return 1 + fi + + # Setup LD_PRELOAD so name resolution works in our chroot. + if [ -n "${DHCPD_CHROOT}" ] ; then + LD_PRELOAD=3D"${LD_PRELOAD} /usr/lib/libresolv.so" + export LD_PRELOAD=3D"${LD_PRELOAD} /usr/lib/libnss_dns.so" + fi + + local pidfile=3D"$(get_var pid-file-name)" + pidfile=3D"${pidfile:-/var/run/dhcp/dhcpd.pid}" + + ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}" + start-stop-daemon --start --exec /usr/sbin/dhcpd \ + --pidfile "${DHCPD_CHROOT}/${pidfile}" \ + -- ${DHCPD_OPTS} -q -pf "${pidfile}" \ + -user dhcp -group dhcp \ + ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} ${DHCPD_IFACE} + eend $? \ + && save_options chroot "${DHCPD_CHROOT}" \ + && save_options pidfile "${pidfile}" +} + +stop() { + local chroot=3D"$(get_options chroot)" +=09 + checkconfig || return 1 + + 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/dhcpd.init3 b/net-misc/dhcp/files/dhcpd.= init3 new file mode 100755 index 0000000..3b00531 --- /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=3D"configtest" + +DHCPD_CONF=3D${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=3D$? + if [ $ret -ne 0 ] ; then + eerror "${SVCNAME} has detected a syntax error in your configuration f= iles:" + 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=3D" ${DHCPD_OPTS} " + DHCPD_CONF=3D"${DHCPD_CONF##* -cf }" + DHCPD_CONF=3D"${DHCPD_CONF%% *}" + ;; + *) DHCPD_OPTS=3D"${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=3D"$(get_var lease-file-name)" + leasefile=3D"${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=3D"${LD_PRELOAD} /usr/lib/libresolv.so" + export LD_PRELOAD=3D"${LD_PRELOAD} /usr/lib/libnss_dns.so" + fi + + local pidfile=3D"$(get_var pid-file-name)" + pidfile=3D"${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=3D"$(get_options chroot)" +=09 + 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.conf b/net-misc/dhcp/files/dhcr= elay.conf new file mode 100644 index 0000000..1102d3a --- /dev/null +++ b/net-misc/dhcp/files/dhcrelay.conf @@ -0,0 +1,13 @@ +# /etc/conf.d/dhcrelay: config file for /etc/init.d/dhcrelay + +# Configure which interface or interfaces to for dhcrelay to listen on +# and send to. +# List all interfaces space separated. If this is not specified then +# we use all interfaces. +#IFACE=3D"" + +# Insert any other options needed. See dhcrelay(8) for details. +#DHCRELAY_OPTS=3D"" + +# Space separated list of IPs to forward BOOTP/DHCP packets to. +DHCRELAY_SERVERS=3D"" diff --git a/net-misc/dhcp/files/dhcrelay.init b/net-misc/dhcp/files/dhcr= elay.init new file mode 100644 index 0000000..2f92956 --- /dev/null +++ b/net-misc/dhcp/files/dhcrelay.init @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcrelay.init,v 1= .2 2007/03/22 15:36:59 uberlord 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 + + local IFACES=3D i=3D + for i in ${IFACE} ; do + IFACES=3D"${IFACES} -i ${i}" + done + + ebegin "Starting dhcrelay" + start-stop-daemon --start --exec /usr/sbin/dhcrelay \ + -- -q ${IFACES} ${DHCRELAY_OPTS} ${DHCRELAY_SERVERS} + eend $? +} + +stop() { + ebegin "Stopping dhcrelay" + start-stop-daemon --stop --pidfile /var/run/dhcrelay.pid + eend $? +} diff --git a/net-misc/dhcp/files/dhcrelay.init2 b/net-misc/dhcp/files/dhc= relay.init2 new file mode 100755 index 0000000..4f09249 --- /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.2 2011/03/08 20:13:26 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 ' ${IFACE}) ${DHCRELAY_OPTS} ${DHCRELAY_SERVE= RS} + eend $? +} + +stop() { + ebegin "Stopping dhcrelay" + start-stop-daemon --stop --pidfile /var/run/dhcp/dhcrelay.pid + eend $? +} diff --git a/net-misc/dhcp/metadata.xml b/net-misc/dhcp/metadata.xml new file mode 100644 index 0000000..62e79c8 --- /dev/null +++ b/net-misc/dhcp/metadata.xml @@ -0,0 +1,12 @@ + + + + base-system + The ISC DHCP client/server package. + ISC DHCP =E3=82=AF=E3=83=A9=E3=82=A4=E3=82= =A2=E3=83=B3=E3=83=88/=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BB=E3=83=91=E3=83= =83=E3=82=B1=E3=83=BC=E3=82=B8=E3=81=A7=E3=81=99=E3=80=82 + + Install the dhclient program + Install the dhcpd and dhcrelay programs + Enable ipoib support + +