* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2011-06-22 13:33 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2011-06-22 13:33 UTC (permalink / raw
To: gentoo-commits
commit: ba626dee191c2cc033901eadef48007c8d7d4e37
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 22 13:32:22 2011 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Wed Jun 22 13:32:22 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=ba626dee
[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="2"
+
+inherit eutils
+
+MY_PV="${PV//_alpha/a}"
+MY_PV="${MY_PV//_beta/b}"
+MY_PV="${MY_PV//_rc/rc}"
+MY_PV="${MY_PV//_p/-P}"
+MY_P="${PN}-${MY_PV}"
+DESCRIPTION="ISC Dynamic Host Configuration Protocol (DHCP) client/server"
+HOMEPAGE="http://www.isc.org/products/DHCP"
+SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz"
+
+LICENSE="as-is BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="+client ipv6 kernel_linux ldap selinux +server ssl vim-syntax infiniband"
+
+DEPEND="selinux? ( sec-policy/selinux-dhcp )
+ kernel_linux? ( sys-apps/net-tools )
+ vim-syntax? ( app-vim/dhcpd-syntax )
+ ldap? (
+ net-nds/openldap
+ ssl? ( dev-libs/openssl )
+ )"
+
+S="${WORKDIR}/${MY_P}"
+
+src_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=/s:'$: Gentoo-${PR}':" \
+ configure || die
+
+ # Change the hook script locations of the scripts
+ sed -i \
+ -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
+ -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
+ client/scripts/* || die
+
+ # No need for the linux script to force bash, #158540.
+ sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
+
+ # Quiet the freebsd logger a little
+ sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
+
+ # Remove these options from the sample config
+ sed -i \
+ -e "/\(script\|host-name\|domain-name\) / d" \
+ client/dhclient.conf || die
+
+ if use client && ! use server ; then
+ sed -i -r \
+ -e '/^SUBDIRS/s:\<(dhcpctl|relay|server)\>::g' \
+ Makefile.in || die
+ elif ! use client && use server ; then
+ sed -i -r \
+ -e '/^SUBDIRS/s:\<client\>::' \
+ Makefile.in || die
+ fi
+
+ # Only install different man pages if we don't have en
+ if [[ " ${LINGUAS} " != *" en "* ]]; then
+ # Install Japanese man pages
+ if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
+ einfo "Installing Japanese documention"
+ cp doc/ja_JP.eucJP/dhclient* client
+ cp doc/ja_JP.eucJP/dhcp* common
+ fi
+ fi
+ # Now remove the non-english docs so there are no errors later
+ rm -rf doc/ja_JP.eucJP
+}
+
+src_configure() {
+ econf \
+ --enable-paranoia \
+ --sysconfdir=/etc/dhcp \
+ --with-cli-pid-file=/var/run/dhcp/dhclient.pid \
+ --with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
+ --with-cli6-pid-file=/var/run/dhcp/dhclient6.pid \
+ --with-cli6-lease-file=/var/lib/dhcp/dhclient6.leases \
+ --with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
+ --with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
+ --with-srv6-pid-file=/var/run/dhcp/dhcpd6.pid \
+ --with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
+ --with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
+ $(use_enable ipv6 dhcpv6) \
+ $(use_with ldap) \
+ $(use ldap && use_with ssl ldapcrypto || echo --without-ldapcrypto)
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ dodoc README RELNOTES doc/{api+protocol,IANA-arp-parameters}
+ dohtml doc/References.html
+
+ if [[ -e client/dhclient ]] ; then
+ # move the client to /
+ dodir /sbin
+ mv "${D}"/usr/sbin/dhclient "${D}"/sbin/ || die
+
+ exeinto /sbin
+ if use kernel_linux ; then
+ newexe "${S}"/client/scripts/linux dhclient-script || die
+ else
+ newexe "${S}"/client/scripts/freebsd dhclient-script || die
+ fi
+
+ insinto /etc/dhcp
+ doins client/dhclient.conf || die
+
+ keepdir /var/lib/dhclient
+ fi
+
+ if [[ -e server/dhcpd ]] ; then
+ if use ldap ; then
+ insinto /etc/openldap/schema
+ doins contrib/ldap/dhcp.* || die
+ dosbin contrib/ldap/dhcpd-conf-to-ldap || die
+ fi
+
+ newinitd "${FILESDIR}"/dhcpd.init3 dhcpd
+ newinitd "${FILESDIR}"/dhcrelay.init2 dhcrelay
+ newconfd "${FILESDIR}"/dhcpd.conf dhcpd
+ newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
+
+ insinto /etc/dhcp
+ doins server/dhcpd.conf || die
+
+ keepdir /var/{lib,run}/dhcp
+ fi
+}
+
+pkg_preinst() {
+ enewgroup dhcp
+ enewuser dhcp -1 -1 /var/lib/dhcp dhcp
+
+ # Keep the user files over the sample ones
+ local f
+ for f in dhclient dhcpd ; do
+ f="/etc/dhcp/${f}.conf"
+ if [ -e "${ROOT}"${f} ] ; then
+ cp -p "${ROOT}"${f} "${D}"${f}
+ fi
+ done
+}
+
+pkg_postinst() {
+ chown -R dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
+
+ if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
+ ewarn
+ ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
+ ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
+ ewarn "and dhcp should be removed from the default runlevel"
+ ewarn
+ fi
+
+ einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
+ einfo
+ einfo "If you would like to run dhcpd in a chroot, simply configure the"
+ einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
+ einfo " emerge --config =${PF}"
+}
+
+pkg_config() {
+ local CHROOT="$(
+ sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
+ "${ROOT}"/etc/conf.d/dhcpd
+ )"
+
+ if [[ -z ${CHROOT} ]]; then
+ eerror "CHROOT not defined in /etc/conf.d/dhcpd"
+ return 1
+ fi
+
+ CHROOT="${ROOT}/${CHROOT}"
+
+ if [[ -d ${CHROOT} ]] ; then
+ ewarn "${CHROOT} already exists - aborting"
+ return 0
+ fi
+
+ ebegin "Setting up the chroot directory"
+ mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
+ cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
+ cp -R /etc/dhcp "${CHROOT}"/etc
+ cp -R /var/lib/dhcp "${CHROOT}"/var/lib
+ ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
+ chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
+ eend 0
+
+ local logger="$(best_version virtual/logger)"
+ einfo "To enable logging from the dhcpd server, configure your"
+ einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
+}
diff --git a/net-misc/dhcp/files/dhcp-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);
+
++#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, (int) set_gid);
++#endif /* PARANOIA */
++
+ /* Discover all the network interfaces and initialize them. */
+ discover_interfaces (DISCOVER_SERVER);
+
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 <user>
+ -group <group>
+ -chroot <chroot_dir>
+
+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 <chroot_dir>/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 <chroot_dir>/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 <omapip/omapip_p.h>
+
++#if defined (PARANOIA)
++# include <sys/types.h>
++# include <unistd.h>
++# include <pwd.h>
++/* get around the ISC declaration of group */
++# define group real_group
++# include <grp.h>
++# undef group
++#endif /* PARANOIA */
++
+ static void usage PROTO ((void));
+
+ TIME cur_time;
+@@ -204,6 +214,22 @@
+ omapi_object_dereference (&listener, MDL);
+ }
+
++#if defined (PARANOIA)
++/* to be used in one of two possible scenarios */
++static void setup_chroot (char *chroot_dir) {
++ if (geteuid())
++ log_fatal ("you must be root to use chroot");
++
++ if (chroot(chroot_dir)) {
++ log_fatal ("chroot(\"%s\"): %m", chroot_dir);
++ }
++ if (chdir ("/")) {
++ /* probably permission denied */
++ log_fatal ("chdir(\"/\"): %m");
++ }
++}
++#endif /* PARANOIA */
++
+ int main (argc, argv, envp)
+ int argc;
+ char **argv, **envp;
+@@ -236,6 +262,14 @@
+ char *traceinfile = (char *)0;
+ char *traceoutfile = (char *)0;
+ #endif
++#if defined (PARANOIA)
++ char *set_user = 0;
++ char *set_group = 0;
++ char *set_chroot = 0;
++
++ uid_t set_uid = 0;
++ gid_t set_gid = 0;
++#endif /* PARANOIA */
+
+ /* Make sure we have stdin, stdout and stderr. */
+ status = open ("/dev/null", O_RDWR);
+@@ -298,6 +332,20 @@
+ if (++i == argc)
+ usage ();
+ server = argv [i];
++#if defined (PARANOIA)
++ } else if (!strcmp (argv [i], "-user")) {
++ if (++i == argc)
++ usage ();
++ set_user = argv [i];
++ } else if (!strcmp (argv [i], "-group")) {
++ if (++i == argc)
++ usage ();
++ set_group = argv [i];
++ } else if (!strcmp (argv [i], "-chroot")) {
++ if (++i == argc)
++ usage ();
++ set_chroot = argv [i];
++#endif /* PARANOIA */
+ } else if (!strcmp (argv [i], "-cf")) {
+ if (++i == argc)
+ usage ();
+@@ -397,6 +445,44 @@
+ trace_seed_stop, MDL);
+ #endif
+
++#if defined (PARANOIA)
++ /* get user and group info if those options were given */
++ if (set_user) {
++ struct passwd *tmp_pwd;
++
++ if (geteuid())
++ log_fatal ("you must be root to set user");
++
++ if (!(tmp_pwd = getpwnam(set_user)))
++ log_fatal ("no such user: %s", set_user);
++
++ set_uid = tmp_pwd->pw_uid;
++
++ /* use the user's group as the default gid */
++ if (!set_group)
++ set_gid = tmp_pwd->pw_gid;
++ }
++
++ if (set_group) {
++/* get around the ISC declaration of group */
++#define group real_group
++ struct group *tmp_grp;
++
++ if (geteuid())
++ log_fatal ("you must be root to set group");
++
++ if (!(tmp_grp = getgrnam(set_group)))
++ log_fatal ("no such group: %s", set_group);
++
++ set_gid = tmp_grp->gr_gid;
++#undef group
++ }
++
++# if defined (EARLY_CHROOT)
++ if (set_chroot) setup_chroot (set_chroot);
++# endif /* EARLY_CHROOT */
++#endif /* PARANOIA */
++
+ /* Default to the DHCP/BOOTP port. */
+ if (!local_port)
+ {
+@@ -500,6 +586,10 @@
+
+ postconf_initialization (quiet);
+
++#if defined (PARANOIA) && !defined (EARLY_CHROOT)
++ if (set_chroot) setup_chroot (set_chroot);
++#endif /* PARANOIA && !EARLY_CHROOT */
++
+ /* test option should cause an early exit */
+ if (cftest && !lftest)
+ exit(0);
+@@ -543,6 +633,22 @@
+ exit (0);
+ }
+
++#if defined (PARANOIA)
++ /* change uid to the specified one */
++
++ if (set_gid) {
++ if (setgroups (0, (void *)0))
++ log_fatal ("setgroups: %m");
++ if (setgid (set_gid))
++ log_fatal ("setgid(%d): %m", (int) set_gid);
++ }
++
++ if (set_uid) {
++ if (setuid (set_uid))
++ log_fatal ("setuid(%d): %m", (int) set_uid);
++ }
++#endif /* PARANOIA */
++
+ /* Read previous pid file. */
+ if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
+ status = read (i, pbuf, (sizeof pbuf) - 1);
+@@ -888,6 +994,10 @@
+
+ log_fatal ("Usage: dhcpd [-p <UDP port #>] [-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/files/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
+===================================================================
+--- 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
+
+ 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
+
+ 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
+
+ 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
+
+ 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
+
+ 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
+
+ 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
+
diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch b/net-misc/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 != x -a $exit_status -eq 0 ]; then
++ dbus-send --system --dest=com.redhat.dhcp \
++ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
++ fi
+ exit $exit_status
+ }
+
+--- 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 != x -a $exit_status -eq 0 ]; then
++ dbus-send --system --dest=com.redhat.dhcp \
++ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
++ fi
+ exit $exit_status
+ }
+
+--- 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 != x -a $exit_status -eq 0 ]; then
++ dbus-send --system --dest=com.redhat.dhcp \
++ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
++ fi
+ exit $exit_status
+ }
+
+--- 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 != x -a $exit_status -eq 0 ]; then
++ dbus-send --system --dest=com.redhat.dhcp \
++ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
++ fi
+ exit $exit_status
+ }
+
+--- 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 != x -a $exit_status -eq 0 ]; then
++ dbus-send --system --dest=com.redhat.dhcp \
++ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
++ fi
+ exit $exit_status
+ }
+
+--- 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 != x -a $exit_status -eq 0 ]; then
++ dbus-send --system --dest=com.redhat.dhcp \
++ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
++ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
++ fi
+ exit $exit_status
+ }
+
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 = xREBIND ] || [ x$reason = xREBOOT ]; then
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
++ [ x$current_hostname = "x(none)" ] || \
++ [ x$current_hostname = xlocalhost ] || \
+ [ x$current_hostname = x$old_host_name ]; then
+ if [ x$current_hostname = x ] || \
+ [ x$new_host_name != x$old_host_name ]; then
+- hostname $new_host_name
++ hostname "$new_host_name"
+ fi
+ fi
+
diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch b/net-misc/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 != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -141,7 +144,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ route add $new_ip_address 127.1 >/dev/null 2>&1
+ for router in $new_routers; do
+ route add default $router >/dev/null 2>&1
+@@ -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" != "" ]; then
+ set $new_routers
+--- client/scripts/freebsd
++++ client/scripts/freebsd
+@@ -94,6 +94,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -151,7 +154,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ $LOGGER "New IP Address ($interface): $new_ip_address"
+ $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
+ $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
+@@ -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
+
+-release=`uname -r`
+-release=`expr $release : '\(.*\)\..*'`
+-relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
+-relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
+-
+ if [ x$new_broadcast_address != x ]; then
+ new_broadcast_arg="broadcast $new_broadcast_address"
+ fi
+@@ -106,6 +101,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ # Linux doesn't do mediums (ok, ok, media).
+@@ -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
+
+ # 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 != x ] && [ x$IF_METRIC != x0 ]; then
++ route del -net $new_network_number $new_subnet_arg \
++ dev $interface
++ route add -net $new_network_number $new_subnet_arg $metric_arg \
++ dev $interface
+ fi
+ for router in $new_routers; do
+- route add default gw $router
++ route add default gw $router $metric_arg dev $interface
+ done
+ fi
+ if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
+@@ -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 != x ] && [ x$IF_METRIC != x0 ]; then
++ route del -net $new_network_number $new_subnet_arg \
++ dev $interface
++ route add -net $new_network_number $new_subnet_arg $metric_arg \
++ dev $interface
+ fi
+ for router in $new_routers; do
+- route add default gw $router
++ route add default gw $router $metric_arg dev $interface
+ done
+ make_resolv_conf
+ exit_with_hooks 0
+--- client/scripts/netbsd
++++ client/scripts/netbsd
+@@ -84,6 +84,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -141,7 +144,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ route add $new_ip_address 127.1 >/dev/null 2>&1
+ for router in $new_routers; do
+ route add default $router >/dev/null 2>&1
+@@ -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" != "" ]; then
+ set $new_routers
+--- client/scripts/solaris
++++ client/scripts/solaris
+@@ -79,6 +79,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ ifconfig=/sbin/ifconfig
+
+@@ -141,7 +144,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ route add $new_ip_address 127.1 1 >/dev/null 2>&1
+ for router in $new_routers; do
+ route add default $router 1 >/dev/null 2>&1
+@@ -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 != x ]; then
+ alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++if [ x$new_interface_mtu != x ]; then
++ mtu_arg="mtu $new_interface_mtu"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -138,7 +141,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $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" != "" ]; then
+ set $new_routers
+--- client/scripts/freebsd
++++ client/scripts/freebsd
+@@ -91,6 +91,9 @@
+ if [ x$alias_subnet_mask != x ]; then
+ alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++if [ x$new_interface_mtu != x ]; then
++ mtu_arg="mtu $new_interface_mtu"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -148,7 +151,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $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 != x ]; then
+ alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++if [ x$new_interface_mtu != x ]; then
++ mtu_arg="mtu $new_interface_mtu"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ # Linux doesn't do mediums (ok, ok, media).
+@@ -159,7 +162,7 @@
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+
+ 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 != x ]; then
+ alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++if [ x$new_interface_mtu != x ]; then
++ mtu_arg="mtu $new_interface_mtu"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -138,7 +141,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $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" != "" ]; then
+ set $new_routers
+--- client/scripts/openbsd
++++ client/scripts/openbsd
+@@ -81,6 +81,9 @@
+ if [ x$alias_subnet_mask != x ]; then
+ alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++if [ x$new_interface_mtu != x ]; then
++ mtu_arg="mtu $new_interface_mtu"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -138,7 +141,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $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" != "" ]; then
+ set $new_routers
+--- client/scripts/solaris
++++ client/scripts/solaris
+@@ -76,6 +76,9 @@
+ if [ x$alias_subnet_mask != x ]; then
+ alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++if [ x$new_interface_mtu != x ]; then
++ mtu_arg="mtu $new_interface_mtu"
++fi
+
+ ifconfig=/sbin/ifconfig
+
+@@ -138,7 +141,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $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 = xPREINIT ]; then
+ if [ x$alias_ip_address != 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
+
+ # We need to give the kernel some time to get the interface up.
+ sleep 1
+@@ -145,12 +145,12 @@
+ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
+ [ x$alias_ip_address != 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 != x ] && [ x$old_ip_address != x$new_ip_address ]; then
+ # IP address changed. Bringing down the interface will delete all routes,
+ # and clear the ARP cache.
+- ifconfig $interface inet 0 down
++ ifconfig $interface inet 0.0.0.0
+
+ fi
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+@@ -171,7 +171,7 @@
+ fi
+ if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != 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 = xSTOP ]; then
+ if [ x$alias_ip_address != 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 != 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 != x ]; then
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+@@ -198,7 +198,7 @@
+
+ if [ x$reason = xTIMEOUT ]; then
+ if [ x$alias_ip_address != 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
+
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 = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ x$new_ntp_servers != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- 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
+ }
+
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
++}
++
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+ exit_with_hooks() {
+ exit_status=$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 = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- 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 = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- 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 = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+--- 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 = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
diff --git a/net-misc/dhcp/files/dhcp-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
+
+ install:
++ mkdir -p $(DESTDIR)$(LIBDIR)
++ $(INSTALL) libdst.a $(DESTDIR)$(LIBDIR)
++ $(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libdst.a
++
+
+ 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 <uberlord@gentoo.org>
+
+--- dhcp-3.0.3/omapip/errwarn.c.no_isc_blurb 2004-09-30 16:38:32.000000000 -0400
++++ dhcp-3.0.3/omapip/errwarn.c 2005-04-18 13:45:49.037158000 -0400
+@@ -45,6 +45,8 @@
+ int log_perror = 1;
+ #endif
+ int log_priority;
++int log_isc_blurb=1;
++
+ void (*log_cleanup) (void);
+
+ #define CVT_BUF_MAX 1023
+@@ -76,7 +78,9 @@
+ write (STDERR_FILENO, "\n", 1);
+ }
+
+-#if !defined (NOMINUM)
++#if !defined(NOMINUM)
++ if ( log_isc_blurb )
++ {
+ log_error ("%s", "");
+ log_error ("If you did not get this software from ftp.isc.org, please");
+ log_error ("get the latest from ftp.isc.org and install that before");
+@@ -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.509169000 -0400
++++ dhcp-3.0.3/client/dhclient.c 2005-04-18 13:49:27.574402000 -0400
+@@ -34,7 +34,7 @@
+ static char ocopyright[] =
+ "$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 reserved.\n";
+ #endif /* not lint */
+-
++
+ #include "dhcpd.h"
+ #include "version.h"
+
+@@ -81,6 +81,8 @@
+
+ void do_release(struct client_state *);
+
++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 = 1;
+ quiet_interface_discovery = 1;
++ log_isc_blurb = 0;
+ } else if (!strcmp (argv [i], "-s")) {
+ if (++i == 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;
+
++
++extern int log_isc_blurb;
++
+ #if defined (NSUPDATE)
+
+ /* This stuff is always executed to figure the default values for certain
+@@ -368,6 +371,7 @@
+ } else if (!strcmp (argv [i], "-q")) {
+ quiet = 1;
+ quiet_interface_discovery = 1;
++ log_isc_blurb = 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.000000000 +0000
++++ dhcp-3.0.3/relay/dhcrelay.c 2005-12-08 10:21:50.000000000 +0000
+@@ -102,6 +102,8 @@
+ static char message [] = "Internet Systems Consortium DHCP Relay Agent";
+ static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/";
+
++extern int log_isc_blurb;
++
+ int main (argc, argv, envp)
+ int argc;
+ char **argv, **envp;
+@@ -170,6 +172,7 @@
+ } else if (!strcmp (argv [i], "-q")) {
+ quiet = 1;
+ quiet_interface_discovery = 1;
++ log_isc_blurb = 0;
+ } else if (!strcmp (argv [i], "-a")) {
+ add_agent_options = 1;
+ } else if (!strcmp (argv [i], "-c")) {
diff --git a/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch b/net-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 != -1)
++ if ((*cfile)->file != -1 && (*cfile)->file != fileno(stdin))
+ close((*cfile)->file);
+
+ 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 = 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);
++
+ if (status != ISC_R_SUCCESS) {
+ ;
+ #ifdef LATER
+@@ -148,20 +153,17 @@
+ return status;
+ }
+
+-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,
++ struct interface_info *ip,
++ struct client_config *client)
+ {
+- int file;
+ struct parse *cfile;
+ const char *val;
+ int token;
+ isc_result_t status;
+
+- if ((file = open (name, O_RDONLY)) < 0)
+- return uerr2isc (errno);
+-
+ cfile = (struct parse *)0;
+- new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
++ new_parse (&cfile, file, (char *)0, 0, name , 0);
+
+ do {
+ token = peek_token (&val, (unsigned *)0, cfile);
+@@ -177,6 +179,32 @@
+ return status;
+ }
+
++int read_client_conf_file (const char *name, struct interface_info *ip,
++ struct client_config *client)
++{
++ int file;
++ isc_result_t status;
++
++ if ((file = open (name, O_RDONLY)) < 0)
++ return uerr2isc (errno);
++
++ status = 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 = fileno(stdin);
++ isc_result_t status;
++
++ if (isatty(file)) return ISC_R_NOTFOUND;
++ status = read_client_conf_actual(file, "stdin", ip, client);
++
++ return status;
++}
+
+ /* lease-file :== client-lease-statements END_OF_FILE
+ client-lease-statements :== <nil>
diff --git a/net-misc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch b/net-misc/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;
+
+- 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 @@
+
+ void maybe_setup_fallback ()
+ {
+- isc_result_t status;
+- struct interface_info *fbi = (struct interface_info *)0;
+- if (setup_fallback (&fbi, MDL)) {
+- if_register_fallback (fbi);
+- status = omapi_register_io_object ((omapi_object_t *)fbi,
+- if_readsocket, 0,
+- fallback_discard, 0, 0);
+- if (status != 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. */
+
+-#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
+
+ make_resolv_conf() {
+- if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ "x$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ "x$new_domain_name" != x ]; then
+- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
++ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ if [ "x$new_domain_name" != x ]; then
++ conf="${conf}search $new_domain_name\n"
++ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${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
+
+ make_resolv_conf() {
+- if [ x"$new_domain_name_servers" != x ]; then
+- ( cat /dev/null > /etc/resolv.conf.dhclient )
+- exit_status=$?
+- if [ $exit_status -ne 0 ]; then
+- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
+- else
+- if [ "x$new_domain_search" != x ]; then
+- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
+- exit_status=$?
+- elif [ "x$new_domain_name" != x ]; then
+- # Note that the DHCP 'Domain Name Option' is really just a domain
+- # name, and that this practice of using the domain name option as
+- # a search path is both nonstandard and deprecated.
+- ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
+- exit_status=$?
++ if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then
++ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ if [ "x$new_domain_name" != x ]; then
++ conf="${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=$?
++ conf="${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 = $?
+- 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.
+
+ make_resolv_conf() {
+- if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- chmod 644 /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
+- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
++ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ if [ "x$new_domain_name" != x ]; then
++ conf="${conf}search $new_domain_name\n"
++ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${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
+
+ make_resolv_conf() {
+- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ "x$new_domain_search != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ "x$new_domain_name != x ]; then
+- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
++ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ if [ "x$new_domain_name" != x ]; then
++ conf="${conf}search $new_domain_name\n"
++ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${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
+
+ make_resolv_conf() {
+- if x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
+- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
++ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ if [ "x$new_domain_name" != x ]; then
++ conf="${conf}search $new_domain_name\n"
++ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${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
+
+ make_resolv_conf() {
+- if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
+- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
++ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ if [ "x$new_domain_name" != x ]; then
++ conf="${conf}search $new_domain_name\n"
++ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${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 = xPREINIT ]; then
+ if [ x$alias_ip_address != 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
+
+ # We need to give the kernel some time to get the interface up.
+@@ -155,12 +155,12 @@
+ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
+ [ x$alias_ip_address != 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 != x ] && [ x$old_ip_address != x$new_ip_address ]; then
+ # IP address changed. Bringing down the interface will delete all routes,
+ # and clear the ARP cache.
+- ifconfig $interface inet 0 down
++ ifconfig $interface inet 0.0.0.0
+
+ fi
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+@@ -179,7 +179,7 @@
+ fi
+ if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != 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 = xSTOP ]; then
+ if [ x$alias_ip_address != 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 != 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 != x ]; then
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+@@ -206,7 +206,7 @@
+
+ if [ x$reason = xTIMEOUT ]; then
+ if [ x$alias_ip_address != 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
+
diff --git a/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch b/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch
new file mode 100644
index 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 @@
+
+ struct client_config top_level_config;
+
+-#define NUM_DEFAULT_REQUESTED_OPTS 9
++#define NUM_DEFAULT_REQUESTED_OPTS 10
+ struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1];
+
+ static void parse_client_default_duid(struct parse *cfile);
+@@ -98,15 +98,20 @@
+ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 8 */
+- code = D6O_NAME_SERVERS;
++ code = DHO_NTP_SERVERS;
+ option_code_hash_lookup(&default_requested_options[7],
+- dhcpv6_universe.code_hash, &code, 0, MDL);
++ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 9 */
+- code = D6O_DOMAIN_SEARCH;
++ code = D6O_NAME_SERVERS;
+ option_code_hash_lookup(&default_requested_options[8],
+ dhcpv6_universe.code_hash, &code, 0, MDL);
+
++ /* 10 */
++ code = D6O_DOMAIN_SEARCH;
++ option_code_hash_lookup(&default_requested_options[9],
++ dhcpv6_universe.code_hash, &code, 0, MDL);
++
+ for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
+ if (default_requested_options[code] == NULL)
+ log_fatal("Unable to find option definition for "
+diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos
+--- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 11:38:51.000000000 +0100
++++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 11:39:30.000000000 +0100
+@@ -29,6 +29,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ x$new_ntp_servers != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd
+--- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 11:38:51.000000000 +0100
++++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 11:39:30.000000000 +0100
+@@ -73,6 +73,26 @@
+ fi
+ fi
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
+--- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 11:38:51.000000000 +0100
++++ dhcp-4.0.0/client/scripts/linux 2008-09-01 11:39:30.000000000 +0100
+@@ -55,6 +55,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd
+--- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 11:38:51.000000000 +0100
++++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 11:39:30.000000000 +0100
+@@ -29,6 +29,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+diff -uNr dhcp-4.0.0.ORIG/client/scripts/openbsd dhcp-4.0.0/client/scripts/openbsd
+--- dhcp-4.0.0.ORIG/client/scripts/openbsd 2008-09-01 11:38:51.000000000 +0100
++++ dhcp-4.0.0/client/scripts/openbsd 2008-09-01 11:39:30.000000000 +0100
+@@ -29,6 +29,26 @@
+
+ mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris
+--- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 11:38:51.000000000 +0100
++++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 11:39:30.000000000 +0100
+@@ -17,6 +17,26 @@
+
+ mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ fi
++ # If we're making confs, may as well make an ntp.conf too
++ make_ntp_conf
++}
++
++make_ntp_conf() {
++ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
++ if [ "x$new_ntp_servers" != x ]; then
++ conf="# Generated by dhclient for interface $interface\n"
++ conf="${conf}restrict default noquery notrust nomodify\n"
++ conf="${conf}restrict 127.0.0.1\n"
++ for ntpserver in $new_ntp_servers; do
++ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
++ conf="${conf}server $ntpserver\n"
++ done
++ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
++ conf="${conf}logfile /var/log/ntp.log\n"
++ printf "${conf}" > /etc/ntp.conf
++ chmod 644 /etc/ntp.conf
++ fi
++ fi
+ }
+
+ # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
diff --git a/net-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch b/net-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
+ }
+
++ /* Read any extra configuration from stdin */
++ read_client_conf_stdin ((struct interface_info *)0,
++ &top_level_config);
++
+ /* Set up state and config structures for clients that don't
+ have per-interface configuration statements. */
+ config = (struct client_config *)0;
+@@ -203,23 +207,13 @@
+ return status;
+ }
+
+-int read_client_conf_file (const char *name, struct interface_info *ip,
++int read_client_conf_actual (struct parse *cfile, struct interface_info *ip,
+ struct client_config *client)
+ {
+- int file;
+- struct parse *cfile;
+ const char *val;
+ int token;
+ isc_result_t status;
+
+- if ((file = open (name, O_RDONLY)) < 0)
+- return uerr2isc (errno);
+-
+- cfile = NULL;
+- status = new_parse(&cfile, file, NULL, 0, path_dhclient_conf, 0);
+- if (status != ISC_R_SUCCESS || cfile == NULL)
+- return status;
+-
+ do {
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == END_OF_FILE)
+@@ -230,10 +224,74 @@
+ status = (cfile -> warnings_occurred
+ ? ISC_R_BADPARSE
+ : ISC_R_SUCCESS);
++ return status;
++}
++
++int read_client_conf_file (const char *name, struct interface_info *ip,
++ struct client_config *client)
++{
++ int file;
++ struct parse *cfile;
++ isc_result_t status;
++
++ if ((file = open (name, O_RDONLY)) < 0)
++ return uerr2isc (errno);
++
++ cfile = (struct parse *)0;
++ new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
++ status = read_client_conf_actual(cfile, ip, client);
+ end_parse (&cfile);
+ return status;
+ }
+
++int read_client_conf_stdin (struct interface_info *ip,
++ struct client_config *client)
++{
++ int file;
++ char *buffer = NULL, *p;
++ unsigned buflen, len = 0;
++ struct parse *cfile;
++ size_t bytes;
++ isc_result_t status;
++
++ file = fileno(stdin);
++ if (isatty (file))
++ return ISC_R_NOTFOUND;
++ if (fcntl (file, F_SETFL, O_NONBLOCK) < 0)
++ log_fatal ("could not set stdin to non blocking!");
++
++ buflen = BUFSIZ;
++ buffer = malloc (BUFSIZ + 1);
++ p = buffer;
++ do {
++ bytes = read (file, p, BUFSIZ);
++ if (bytes == 0)
++ break;
++ if (bytes == -1)
++ log_fatal ("failed to read stdin!");
++ if (bytes >= BUFSIZ) {
++ buflen += BUFSIZ;
++ len += BUFSIZ;
++ buffer = realloc (buffer, buflen + 1);
++ if (!buffer)
++ log_fatal ("not enough buffer to read stdin!");
++ p = buffer + len;
++ } else {
++ len += bytes;
++ break;
++ }
++ } while(1);
++ buffer[len] = '\0';
++
++ cfile = (struct parse *)0;
++ status = new_parse (&cfile, -1, buffer, len, "stdin", 0);
++ if (status == ISC_R_SUCCESS) {
++ status = read_client_conf_actual (cfile, ip, client);
++ end_parse (&cfile);
++ }
++ free(buffer);
++ return status;
++}
+
+ /* lease-file :== client-lease-statements END_OF_FILE
+ client-lease-statements :== <nil>
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch b/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch
new file mode 100644
index 0000000..f882a13
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch
@@ -0,0 +1,31 @@
+ripped from Fedora & tweaked
+
+--- dhcp-4.2.0/omapip/errwarn.c
++++ dhcp-4.2.0/omapip/errwarn.c
+@@ -76,20 +76,13 @@
+
+ #if !defined (NOMINUM)
+ log_error ("%s", "");
+- log_error ("If you did not get this software from ftp.isc.org, please");
+- log_error ("get the latest from ftp.isc.org and install that before");
+- log_error ("requesting help.");
++ log_error ("This version of ISC DHCP is based on the release available");
++ log_error ("on ftp.isc.org. Features have been added and other changes");
++ log_error ("have been made to the base software release in order to make");
++ log_error ("it work better with this distribution.");
+ log_error ("%s", "");
+- log_error ("If you did get this software from ftp.isc.org and have not");
+- log_error ("yet read the README, please read it before requesting help.");
+- log_error ("If you intend to request help from the dhcp-server@isc.org");
+- log_error ("mailing list, please read the section on the README about");
+- log_error ("submitting bug reports and requests for help.");
+- log_error ("%s", "");
+- log_error ("Please do not under any circumstances send requests for");
+- log_error ("help directly to the authors of this software - please");
+- log_error ("send them to the appropriate mailing list as described in");
+- log_error ("the README file.");
++ log_error ("Please report for this software via the Gentoo Bugzilla site:");
++ log_error (" http://bugs.gentoo.org/");
+ log_error ("%s", "");
+ log_error ("exiting.");
+ #endif
diff --git a/net-misc/dhcp/files/dhcp-4.2.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) {
+ }
+ }
+
++ /* 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 = 0;
++ for (ip = interfaces; ip; ip = ip -> next) {
++ int junk;
++ if ( ip -> hw_address.hlen <= sizeof seed )
++ continue;
++ memcpy (&junk,
++ &ip -> hw_address.hbuf [ip -> hw_address.hlen -
++ sizeof seed], sizeof seed);
++ backup_seed = 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 = 0;
++ int seed_flag = 0;
+ for (ip = interfaces; ip; ip = ip->next) {
+ int junk;
++ if ( ip -> hw_address.hlen <= sizeof seed )
++ continue;
+ memcpy(&junk,
+ &ip->hw_address.hbuf[ip->hw_address.hlen -
+ sizeof seed], sizeof seed);
+ seed += junk;
++ seed_flag = 1;
+ }
+- srandom(seed + cur_time);
++ if ( seed_flag == 0 ) {
++ if ( backup_seed != 0 ) {
++ seed = backup_seed;
++ log_info ("xid: rand init seed (0x%x) built using all"
++ " available interfaces",seed);
++ }
++ else {
++ seed = 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);
+
+ /* Setup specific Infiniband options */
+ for (ip = interfaces; ip; ip = ip->next) {
+@@ -1310,7 +1352,7 @@ void dhcpack (packet)
+ return;
+ }
+
+- log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
++ log_info ("DHCPACK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
+
+ lease = packet_to_lease (packet, client);
+ if (!lease) {
+@@ -2010,7 +2052,7 @@ void dhcpnak (packet)
+ return;
+ }
+
+- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr));
++ log_info ("DHCPNAK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
+
+ if (!client -> active) {
+ #if defined (DEBUG)
+@@ -2136,10 +2178,10 @@ void send_discover (cpp)
+ client -> packet.secs = htons (65535);
+ client -> secs = client -> packet.secs;
+
+- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld",
++ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=0x%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);
+
+ /* Send out a packet. */
+ result = send_packet (client -> interface, (struct packet *)0,
+@@ -2394,10 +2436,10 @@ void send_request (cpp)
+ client -> packet.secs = htons (65535);
+ }
+
+- log_info ("DHCPREQUEST on %s to %s port %d",
++ log_info ("DHCPREQUEST on %s to %s port %d (xid=0x%x)",
+ client -> name ? client -> name : client -> interface -> name,
+ inet_ntoa (destination.sin_addr),
+- ntohs (destination.sin_port));
++ ntohs (destination.sin_port), client -> xid);
+
+ if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
+ fallback_interface)
+@@ -2427,10 +2469,10 @@ void send_decline (cpp)
+
+ int result;
+
+- log_info ("DHCPDECLINE on %s to %s port %d",
++ log_info ("DHCPDECLINE on %s to %s port %d (xid=0x%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);
+
+ /* Send out a packet. */
+ result = send_packet (client -> interface, (struct packet *)0,
+@@ -2470,10 +2512,10 @@ void send_release (cpp)
+ return;
+ }
+
+- log_info ("DHCPRELEASE on %s to %s port %d",
++ log_info ("DHCPRELEASE on %s to %s port %d (xid=0x%x)",
+ client -> name ? client -> name : client -> interface -> name,
+ inet_ntoa (destination.sin_addr),
+- ntohs (destination.sin_port));
++ ntohs (destination.sin_port), client -> xid);
+
+ if (fallback_interface)
+ result = 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 <net/if.h>
++#include <ifaddrs.h>
+
+ #ifndef PACKET_AUXDATA
+ #define PACKET_AUXDATA 8
+@@ -59,6 +60,15 @@ struct tpacket_auxdata
+ /* Reinitializes the specified interface after an address change. This
+ is not required for packet-filter APIs. */
+
++/* Default broadcast address for IPoIB */
++static unsigned char default_ib_bcast_addr[20] = {
++ 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;
+
+ /* Make an LPF socket. */
+- if ((sock = socket(PF_PACKET, SOCK_RAW,
+- htons((short)ETH_P_ALL))) < 0) {
++ get_hw_addr(info);
++
++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ type = SOCK_DGRAM;
++ protocol = ETHERTYPE_IP;
++ } else {
++ type = SOCK_RAW;
++ protocol = ETH_P_ALL;
++ }
++
++ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ errno == EAFNOSUPPORT || errno == EINVAL) {
+@@ -111,6 +132,7 @@ int if_register_lpf (info)
+ /* Bind to the interface name */
+ memset (&sa, 0, sizeof sa);
+ sa.ll.sll_family = AF_PACKET;
++ sa.ll.sll_protocol = htons(protocol);
+ sa.ll.sll_ifindex = ifr.ifr_ifindex;
+ if (bind (sock, &sa.common, sizeof sa)) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+@@ -126,8 +148,6 @@ int if_register_lpf (info)
+ log_fatal ("Bind socket to interface: %m");
+ }
+
+- 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;
+
+ #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 = if_register_lpf (info);
+
+- val = 1;
+- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
+- sizeof val) < 0) {
+- if (errno != ENOPROTOOPT)
+- log_fatal ("Failed to set auxiliary packet data: %m");
++ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) {
++ val = 1;
++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA,
++ &val, sizeof val) < 0) {
++ if (errno != ENOPROTOOPT)
++ log_fatal ("Failed to set auxiliary packet data: %m");
++ }
+ }
+
+ #if defined (HAVE_TR_SUPPORT)
+@@ -249,15 +273,28 @@ static void lpf_gen_filter_setup (info)
+
+ memset(&p, 0, sizeof(p));
+
+- /* Set up the bpf filter program structure. This is defined in
+- bpf.c */
+- p.len = dhcp_bpf_filter_len;
+- p.filter = 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 = ntohs ((short)local_port);
++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ /* Set up the bpf filter program structure. */
++ p.len = dhcp_ib_bpf_filter_len;
++ p.filter = 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 = ntohs ((short)local_port);
++ } else {
++ /* Set up the bpf filter program structure.
++ This is defined in bpf.c */
++ p.len = dhcp_bpf_filter_len;
++ p.filter = 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 = ntohs ((short)local_port);
++ }
+
+ 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 */
+
+ #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 = 0;
++ double ih [1536 / sizeof (double)];
++ unsigned char *buf = (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 = AF_PACKET;
++ su.sll.sll_protocol = htons(ETHERTYPE_IP);
++
++ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) {
++ errno = ENOENT;
++ log_error ("send_packet_ib: %m - failed to get if index");
++ return -1;
++ }
++
++ su.sll.sll_hatype = htons(HTYPE_INFINIBAND);
++ su.sll.sll_halen = sizeof(interface->bcast_addr);
++ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20);
++
++ result = 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,
+ return send_fallback (interface, packet, raw,
+ len, from, to, hto);
+
++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ return send_packet_ib(interface, packet, raw, len, from,
++ to, hto);
++ }
++
+ if (hto == NULL && interface->anycast_mac_addr.hlen)
+ hto = &interface->anycast_mac_addr;
+
+@@ -355,6 +445,42 @@ ssize_t send_packet (interface, packet,
+ #endif /* USE_LPF_SEND */
+
+ #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 = 0;
++ int offset = 0;
++ unsigned char ibuf [1536];
++ unsigned bufix = 0;
++ unsigned paylen;
++
++ length = read(interface->rfdesc, ibuf, sizeof(ibuf));
++
++ if (length <= 0)
++ return length;
++
++ offset = decode_udp_ip_header(interface, ibuf, bufix, from,
++ (unsigned)length, &paylen, 0);
++
++ if (offset < 0)
++ return 0;
++
++ bufix += offset;
++ length -= 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,
+ };
+ struct cmsghdr *cmsg;
+
++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ return receive_packet_ib(interface, buf, len, from, hfrom);
++ }
++
+ length = recvmsg (interface -> rfdesc, &msg, 0);
+ if (length <= 0)
+ return length;
+@@ -461,33 +591,41 @@ void maybe_setup_fallback ()
+ }
+
+ 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 = &info->hw_address;
++ char *name = info->name;
++ struct ifaddrs *ifaddrs;
++ struct ifaddrs *ifa;
++ struct sockaddr_ll *sll = NULL;
+
+- if (strlen(name) >= sizeof(tmp.ifr_name)) {
+- log_fatal("Device name too long: \"%s\"", name);
+- }
++ if (getifaddrs(&ifaddrs) == -1)
++ log_fatal("Failed to get interfaces");
++
++ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
++
++ if (ifa->ifa_addr->sa_family != AF_PACKET)
++ continue;
+
+- sock = 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) == 0) {
++ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr;
++ break;
++ }
+ }
+
+- 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",
+- name);
++ if (sll == NULL) {
++ freeifaddrs(ifaddrs);
++ log_fatal("Failed to get HW address for %s\n", name);
+ }
+
+- sa = &tmp.ifr_hwaddr;
+- switch (sa->sa_family) {
++ switch (sll->sll_hatype) {
+ case ARPHRD_ETHER:
+ hw->hlen = 7;
+ hw->hbuf[0] = 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 = 7;
+ hw->hbuf[0] = HTYPE_IEEE802;
+- memcpy(&hw->hbuf[1], sa->sa_data, 6);
++ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
+ break;
+ case ARPHRD_FDDI:
+ hw->hlen = 17;
+ hw->hbuf[0] = 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 = (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 = 1;
++ hw->hbuf[0] = 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);
+ }
+
+- 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 */
+
+ /* 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);
+
+ static isc_result_t write_duid(struct data_string *duid);
+
++static void setup_ib_interface(struct interface_info *ip)
++{
++ struct group *g;
++
++ /* Set the broadcast flag */
++ ip->client->config->bootp_broadcast_always = 1;
++
++ /*
++ * Find out if a dhcp-client-identifier option was specified either
++ * in the config file or on the command line
++ */
++ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) {
++ if ((g->statements != NULL) &&
++ (strcmp(g->statements->data.option->option->name,
++ "dhcp-client-identifier") == 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);
+
++ /* Setup specific Infiniband options */
++ for (ip = interfaces; ip; ip = ip->next) {
++ if (ip->client &&
++ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
++ setup_ib_interface(ip);
++ }
++ }
++
+ /* Start a configuration state machine for each interface. */
+ #ifdef DHCPv6
+ if (local_family == 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);
+
+- get_hw_addr(info->name, &info->hw_address);
++ get_hw_addr(info);
+
+ return sock;
+ }
+@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
+ BPF_STMT(BPF_RET+BPF_K, 0),
+ };
+
++/* Packet filter program for DHCP over Infiniband.
++ *
++ * XXX
++ * Changes to the filter program may require changes to the constant offsets
++ * used in lpf_gen_filter_setup to patch the port in the BPF program!
++ * XXX
++ */
++struct bpf_insn dhcp_ib_bpf_filter [] = {
++ /* 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
+
+ int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn);
++int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn);
++
+ #if defined (HAVE_TR_SUPPORT)
+ struct bpf_insn dhcp_bpf_tr_filter [] = {
+ /* accept all token ring packets due to variable length header */
+@@ -552,7 +585,9 @@ void maybe_setup_fallback ()
+ }
+
+ void
+-get_hw_addr(const char *name, struct hardware *hw) {
++get_hw_addr(struct interface_info *info) {
++ struct hardware *hw = &info->hw_address;
++ char *name = 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
+
+ /* If this is a normal IPv4 address, get the hardware address. */
+ if ((local_family == AF_INET) && (strcmp(info->name, "fallback") != 0))
+- get_hw_addr(info->name, &info->hw_address);
++ get_hw_addr(info);
+
+ return sock;
+ }
+@@ -429,7 +429,7 @@ if_register6(struct interface_info *info
+ if (req_multi)
+ if_register_multicast(info);
+
+- get_hw_addr(info->name, &info->hw_address);
++ get_hw_addr(info);
+
+ if (!quiet_interface_discovery) {
+ if (info->shared_network != 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);
+
+-void get_hw_addr(const char *name, struct hardware *hw);
++void get_hw_addr(struct interface_info *info);
+
+ /* 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 */
+
+ void
+-get_hw_addr(const char *name, struct hardware *hw) {
++get_hw_addr(struct interface_info *info) {
++ struct hardware *hw = &info->hw_address;
++ char *name = 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 -0500
++++ 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 = 7200;
++ top_level_config.bootp_broadcast_always = 0;
+
+ 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 */
+
+ void parse_client_statement (cfile, ip, config)
+ struct parse *cfile;
+@@ -717,6 +719,12 @@ void parse_client_statement (cfile, ip,
+ parse_reject_statement (cfile, config);
+ return;
+
++ case BOOTP_BROADCAST_ALWAYS:
++ token = next_token(&val, (unsigned*)0, cfile);
++ config -> bootp_broadcast_always = 1;
++ parse_semi (cfile);
++ return;
++
+ default:
+ lose = 0;
+ stmt = (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 <limits.h>
+ #include <dns/result.h>
+
++/*
++ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
++ * that when building ISC code.
++ */
++extern int asprintf(char **strp, const char *fmt, ...);
++
+ TIME default_lease_time = 43200; /* 12 hours... */
+ TIME max_lease_time = 86400; /* 24 hours... */
+
+@@ -82,6 +88,9 @@ int wanted_ia_na = -1; /* the absolute
+ int wanted_ia_ta = 0;
+ int wanted_ia_pd = 0;
+ char *mockup_relay = NULL;
++int bootp_broadcast_always = 0;
++
++extern u_int32_t default_requested_options[];
+
+ void run_stateless(int exit_mode);
+
+@@ -112,6 +121,15 @@ main(int argc, char **argv) {
+ int local_family_set = 0;
+ #endif /* DHCPv6 */
+ char *s;
++ char *dhcp_client_identifier_arg = NULL;
++ char *dhcp_host_name_arg = NULL;
++ char *dhcp_fqdn_arg = NULL;
++ char *dhcp_vendor_class_identifier_arg = NULL;
++ char *dhclient_request_options = NULL;
++
++ int timeout_arg = 0;
++ char *arg_conf = NULL;
++ int arg_conf_len = 0;
+
+ /* 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 == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_client_identifier_arg = argv[i];
++ } else if (!strcmp(argv[i], "-B")) {
++ bootp_broadcast_always = 1;
++ } else if (!strcmp(argv[i], "-H")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= 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 != NULL) {
++ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_host_name_arg = argv[i];
++ } else if (!strcmp(argv[i], "-F")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= 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 != NULL) {
++ log_error("Only one -F <fqdn> argument can be specified");
++ exit(1);
++ }
++
++ if (dhcp_host_name_arg != NULL) {
++ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_fqdn_arg = argv[i];
++ } else if (!strcmp(argv[i], "-timeout")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if ((timeout_arg = atoi(argv[i])) <= 0) {
++ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
++ exit(1);
++ }
++ } else if (!strcmp(argv[i], "-V")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_vendor_class_identifier_arg = argv[i];
++ } else if (!strcmp(argv[i], "-R")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ dhclient_request_options = argv[i];
+ } else if (argv[i][0] == '-') {
+ usage();
+ } else if (interfaces_requested < 0) {
+@@ -466,6 +566,166 @@ main(int argc, char **argv) {
+ /* Parse the dhclient.conf file. */
+ read_client_conf();
+
++ /* Parse any extra command line configuration arguments: */
++ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
++ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -I option dhcp-client-identifier");
++ }
++
++ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (timeout_arg) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to process -timeout timeout argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len == 0))
++ log_fatal("Unable to process -timeout timeout argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (dhclient_request_options != NULL) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (arg_conf) {
++ if (arg_conf_len == 0)
++ if ((arg_conf_len = strlen(arg_conf)) == 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 = (struct parse *)0;
++ const char *val = NULL;
++ int token;
++
++ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
++
++ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
++ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
++ /* more detailed parse failures will be logged */
++
++ do {
++ token = peek_token(&val, (unsigned *)0, cfile);
++ if (token == 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 arguments !");
++ 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 == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
++ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
++
++ for (ip=interfaces; ip; ip = ip->next) {
++ if (ip->client->config->timeout == 60)
++ ip->client->config->timeout = timeout_arg;
++
++ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
++ ip->client->config->reboot_timeout = ip->client->config->timeout;
++ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
++ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
++ }
++ }
++
++ if ((dhclient_request_options != 0) && (top_level_config.requested_options != (void *) default_requested_options)) {
++ for (ip=interfaces; ip; ip = ip->next) {
++ if (ip->client->config->requested_options == (void *) default_requested_options)
++ ip->client->config->requested_options = top_level_config.requested_options;
++ }
++ }
++
++ free(arg_conf);
++ arg_conf = NULL;
++ arg_conf_len = 0;
++ }
++
+ /* Parse the lease database. */
+ read_client_leases();
+
+@@ -2337,7 +2597,8 @@ void make_discover (client, lease)
+ client -> packet.xid = random ();
+ client -> packet.secs = 0; /* filled in by send_discover. */
+
+- 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 = 0;
+ else
+ client -> packet.flags = 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 = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2483,7 +2746,8 @@ void make_decline (client, lease)
+ client -> packet.hops = 0;
+ client -> packet.xid = client -> xid;
+ client -> packet.secs = 0; /* Filled in by send_request. */
+- 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 = 0;
+ else
+ client -> packet.flags = 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 -0400
++++ 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)
+ 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 -0400
++++ 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_BROADCAST
++ flag in requests */
+ };
+
+ /* Per-interface state used in the dhcp client... */
+diff -up dhcp-4.2.0/includes/dhctoken.h.options dhcp-4.2.0/includes/dhctoken.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 = 660,
+ AUTO_PARTNER_DOWN = 661,
+ GETHOSTNAME = 662,
+- REWIND = 663
++ REWIND = 663,
++ BOOTP_BROADCAST_ALWAYS = 664
+ };
+
+ #define is_identifier(x) ((x) >= 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,
+ offset = decode_udp_ip_header (interface,
+ interface -> rbuf,
+ interface -> rbuf_offset,
+- from, hdr.bh_caplen, &paylen);
++ from, hdr.bh_caplen, &paylen, 0);
+
+ /* 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,
+ length -= offset;
+ #endif
+ offset = decode_udp_ip_header (interface, dbuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /*
+ * 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 <sys/ioctl.h>
++#include <sys/socket.h>
+ #include <sys/uio.h>
+ #include <errno.h>
+
+ #include <asm/types.h>
+ #include <linux/filter.h>
+ #include <linux/if_ether.h>
++#include <linux/if_packet.h>
+ #include <netinet/in_systm.h>
+ #include "includes/netinet/ip.h"
+ #include "includes/netinet/udp.h"
+ #include "includes/netinet/if_ether.h"
+ #include <net/if.h>
+
++#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. This
+ is not required for packet-filter APIs. */
+
+@@ -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;
+
+ /* Make an LPF socket. */
+- if ((sock = socket(PF_PACKET, SOCK_PACKET,
++ if ((sock = socket(PF_PACKET, SOCK_RAW,
+ htons((short)ETH_P_ALL))) < 0) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+@@ -84,11 +103,16 @@ int if_register_lpf (info)
+ log_fatal ("Open a socket for LPF: %m");
+ }
+
++ 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 = AF_PACKET;
+- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
+- if (bind (sock, &sa, sizeof sa)) {
++ sa.ll.sll_family = AF_PACKET;
++ sa.ll.sll_ifindex = ifr.ifr_ifindex;
++ if (bind (sock, &sa.common, sizeof sa)) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ errno == EAFNOSUPPORT || errno == 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 = if_register_lpf (info);
+
++ val = 1;
++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
++ sizeof val) < 0) {
++ if (errno != ENOPROTOOPT)
++ log_fatal ("Failed to set auxiliary packet data: %m");
++ }
++
+ #if defined (HAVE_TR_SUPPORT)
+ if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
+ lpf_tr_filter_setup (info);
+@@ -294,7 +327,6 @@ ssize_t send_packet (interface, packet,
+ double hh [16];
+ double ih [1536 / sizeof (double)];
+ unsigned char *buf = (unsigned char *)ih;
+- struct sockaddr sa;
+ int result;
+ int fudge;
+
+@@ -315,15 +347,7 @@ ssize_t send_packet (interface, packet,
+ (unsigned char *)raw, len);
+ memcpy (buf + ibufp, raw, len);
+
+- /* 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 = AF_PACKET;
+- strncpy (sa.sa_data,
+- (const char *)interface -> ifp, sizeof sa.sa_data);
+-
+- result = sendto (interface -> wfdesc,
+- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
++ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
+ if (result < 0)
+ log_error ("send_packet: %m");
+ return result;
+@@ -340,14 +364,35 @@ ssize_t receive_packet (interface, buf,
+ {
+ int length = 0;
+ int offset = 0;
++ int nocsum = 0;
+ unsigned char ibuf [1536];
+ unsigned bufix = 0;
+ unsigned paylen;
++ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
++ struct iovec iov = {
++ .iov_base = ibuf,
++ .iov_len = sizeof ibuf,
++ };
++ struct msghdr msg = {
++ .msg_iov = &iov,
++ .msg_iovlen = 1,
++ .msg_control = cmsgbuf,
++ .msg_controllen = sizeof(cmsgbuf),
++ };
++ struct cmsghdr *cmsg;
+
+- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
++ length = recvmsg (interface -> rfdesc, &msg, 0);
+ if (length <= 0)
+ return length;
+
++ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
++ if (cmsg->cmsg_level == SOL_PACKET &&
++ cmsg->cmsg_type == PACKET_AUXDATA) {
++ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
++ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
++ }
++ }
++
+ bufix = 0;
+ /* Decode the physical header... */
+ offset = decode_hw_header (interface, ibuf, bufix, hfrom);
+@@ -364,7 +409,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix, from,
+- (unsigned)length, &paylen);
++ (unsigned)length, &paylen, nocsum);
+
+ /* 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,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* 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))));
+
+ udp_packets_seen++;
+- if (usum && usum != sum) {
++ if (!nocsum && usum && usum != 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,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* 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
+ unsigned, struct hardware *));
+ ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
+ unsigned, struct sockaddr_in *,
+- unsigned, unsigned *));
++ unsigned, unsigned *, int));
+
+ /* 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/net-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
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+ if [ "x$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_search}\n"
+ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >> /etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
++
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+ }
+--- a/client/scripts/freebsd
++++ b/client/scripts/freebsd
+@@ -11,68 +11,41 @@
+ fi
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- ( cat /dev/null > /etc/resolv.conf.dhclient )
+- exit_status=$?
+- if [ $exit_status -ne 0 ]; then
+- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
+- else
+- if [ "x$new_domain_search" != x ]; then
+- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
+- exit_status=$?
+- elif [ "x$new_domain_name" != x ]; then
+- # Note that the DHCP 'Domain Name Option' is really just a domain
+- # name, and that this practice of using the domain name option as
+- # a search path is both nonstandard and deprecated.
+- ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
+- exit_status=$?
+- fi
+- for nameserver in $new_domain_name_servers; do
+- if [ $exit_status -ne 0 ]; then
+- break
+- fi
+- ( echo nameserver $nameserver >>/etc/resolv.conf.dhclient )
+- exit_status=$?
+- done
+-
+- # If there were no errors, attempt to mv the new file into place.
+- if [ $exit_status -eq 0 ]; then
+- ( mv /etc/resolv.conf.dhclient /etc/resolv.conf )
+- exit_status=$?
+- fi
+-
+- if [ $exit_status -ne 0 ]; then
+- $LOGGER "Error while writing new /etc/resolv.conf."
+- fi
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
++ # Note that the DHCP 'Domain Name Option' is really just a domain
++ # name, and that this practice of using the domain name option as
++ # a search path is both nonstandard and deprecated.
++ conf="${conf}search ${new_domain_name}\n"
+ fi
++ for nameserver in $new_domain_name_servers; do
++ conf="${conf}nameserver ${nameserver}\n"
++ done
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- ( cat /dev/null > /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- if [ $exit_status -ne 0 ] ; then
+- $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
+- else
+- if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- fi
+- for nameserver in ${new_dhcp6_name_servers} ; do
+- if [ $exit_status -ne 0 ] ; then
+- break
+- fi
+- ( echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 )
+- exit_status=$?
+- done
+-
+- if [ $exit_status -eq 0 ] ; then
+- ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
+- exit_status=$?
+- fi
++ if [ "x${new_dhcp6_domain_search}" != x ] ; then
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
++ fi
++ for nameserver in ${new_dhcp6_name_servers} ; do
++ conf="${conf}nameserver ${nameserver}\n"
++ done
++ fi
+
+- if [ $exit_status -ne 0 ] ; then
+- $LOGGER "Error while writing new /etc/resolv.conf."
+- fi
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
+ fi
+ fi
++
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+ }
+--- a/client/scripts/linux
++++ b/client/scripts/linux
+@@ -26,35 +26,41 @@
+ ip=/sbin/ip
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- chmod 644 /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
++
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+ }
+--- a/client/scripts/netbsd
++++ b/client/scripts/netbsd
+@@ -1,34 +1,41 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
+- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ "x$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ "x$new_domain_name" != x ]; then
++ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
++ if [ x"$new_domain_name_servers" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
++
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+ }
+--- a/client/scripts/openbsd
++++ b/client/scripts/openbsd
+@@ -1,34 +1,41 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
+- if x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
++ if [ x"$new_domain_name_servers" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
+ done
+-
+- mv /etc/ersolv.conf.dhclient /etc/resolv.conf
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+- cat /dev/null > /etc/resolv.conf.dhclient6
+- chmod 644 /etc/resolv.conf.dhclient6
+-
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
++
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+ }
+--- a/client/scripts/solaris
++++ b/client/scripts/solaris
+@@ -1,22 +1,41 @@
+ #!/bin/sh
+
+ make_resolv_conf() {
++ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
++ return 0
++ fi
++ local conf=
+ if [ x"$new_domain_name_servers" != x ]; then
+- cat /dev/null > /etc/resolv.conf.dhclient
+- if [ x"$new_domain_search" != x ]; then
+- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+- elif [ x"$new_domain_name" != x ]; then
++ if [ "x$new_domain_search" != x ]; then
++ conf="${conf}search ${new_domain_search}\n"
++ elif [ "x$new_domain_name" != x ]; then
+ # Note that the DHCP 'Domain Name Option' is really just a domain
+ # name, and that this practice of using the domain name option as
+ # a search path is both nonstandard and deprecated.
+- echo search $new_domain_name >> /etc/resolv.conf.dhclient
++ conf="${conf}search ${new_domain_name}\n"
+ fi
+ for nameserver in $new_domain_name_servers; do
+- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++ conf="${conf}nameserver ${nameserver}\n"
++ done
++ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
++ if [ "x${new_dhcp6_domain_search}" != x ] ; then
++ conf="${conf}search ${new_dhcp6_domain_search}\n"
++ fi
++ for nameserver in ${new_dhcp6_name_servers} ; do
++ conf="${conf}nameserver ${nameserver}\n"
+ done
++ fi
+
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
++ if [ x"$conf" != x ]; then
++ conf="# Generated by dhclient or interface $interface\n${conf}"
++ if type resolvconf >/dev/null 2>&1; then
++ printf "${conf}" | resolvconf -a $interface
++ else
++ printf "${conf}" > /etc/resolv.conf
++ chmod 644 /etc/resolv.conf
++ fi
+ fi
++
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+ }
diff --git a/net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch b/net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch
new file mode 100644
index 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" = "x255.255.255.255" ] ; then
+- route add -host $router dev $interface
+- fi
+- route add default gw $router $metric_arg dev $interface
+- done
++ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
++ for router in $new_routers; do
++ if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
++ route add -host $router dev $interface
++ fi
++ route add default gw $router $metric_arg dev $interface
++ done
++ fi
+ fi
+ if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
+ then
+@@ -244,12 +246,14 @@
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+ route add -host $alias_ip_address dev $interface:0
+ fi
+- for router in $new_routers; do
+- if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+- route add -host $router dev $interface
+- fi
+- route add default gw $router $metric_arg dev $interface
+- done
++ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
++ for router in $new_routers; do
++ if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
++ route add -host $router dev $interface
++ fi
++ route add default gw $router $metric_arg dev $interface
++ done
++ fi
+ make_resolv_conf
+ exit_with_hooks 0
+ fi
diff --git a/net-misc/dhcp/files/dhcpd.conf b/net-misc/dhcp/files/dhcpd.conf
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="/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="/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=""
+
+# Insert any other dhcpd options - see the man page for a full list.
+# DHCPD_OPTS=""
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="configtest"
+
+DHCPD_CONF=${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=$?
+ if [ $ret -ne 0 ]; then
+ eerror "${SVCNAME} has detected a syntax error in your configuration files:"
+ /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 "*)
+ DHCPD_CONF=" ${DHCPD_OPTS} "
+ DHCPD_CONF="${DHCPD_CONF##* -cf }"
+ DHCPD_CONF="${DHCPD_CONF%% *}"
+ ;;
+ *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
+ ;;
+ esac
+
+ if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then
+ eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist"
+ return 1
+ fi
+
+ checkconfig || return 1
+
+ local leasefile="$(get_var lease-file-name)"
+ leasefile="${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="${LD_PRELOAD} /usr/lib/libresolv.so"
+ export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so"
+ fi
+
+ local pidfile="$(get_var pid-file-name)"
+ pidfile="${pidfile:-/var/run/dhcp/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="$(get_options chroot)"
+
+ 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="configtest"
+
+DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/${SVCNAME}.conf}
+
+depend() {
+ need net
+ use logger dns
+}
+
+get_var() {
+ sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \
+ "${DHCPD_CHROOT}/${DHCPD_CONF}"
+}
+
+checkconfig() {
+ dhcpd ${DHCPD_OPTS} ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} -t 1>/dev/null 2>&1
+ local ret=$?
+ if [ $ret -ne 0 ] ; then
+ eerror "${SVCNAME} has detected a syntax error in your configuration files:"
+ dhcpd ${DHCPD_OPTS} ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} -t
+ fi
+
+ return $ret
+}
+
+configtest() {
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+start() {
+ # Work out our cffile if it's in our DHCPD_OPTS
+ case " ${DHCPD_OPTS} " in
+ *" -cf "*)
+ DHCPD_CONF=" ${DHCPD_OPTS} "
+ DHCPD_CONF="${DHCPD_CONF##* -cf }"
+ DHCPD_CONF="${DHCPD_CONF%% *}"
+ ;;
+ *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
+ ;;
+ esac
+
+ if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then
+ eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist"
+ return 1
+ fi
+
+ checkconfig || return 1
+
+ checkpath -d -o dhcp:dhcp /var/run/dhcp /var/lib/dhcp
+
+ local leasefile="$(get_var lease-file-name)"
+ leasefile="${leasefile:-/var/lib/dhcp/${SVCNAME}.leases}"
+ if [ ! -f "${DHCPD_CHROOT}${leasefile}" ] ; then
+ ebegin "Creating ${leasefile}"
+ touch "${DHCPD_CHROOT}${leasefile}"
+ chown dhcp:dhcp "${DHCPD_CHROOT}${leasefile}"
+ eend $? || return 1
+ fi
+
+ # Setup LD_PRELOAD so name resolution works in our chroot.
+ if [ -n "${DHCPD_CHROOT}" ] ; then
+ LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so"
+ export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so"
+ fi
+
+ local pidfile="$(get_var pid-file-name)"
+ pidfile="${pidfile:-/var/run/dhcp/${SVCNAME}.pid}"
+
+ ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/dhcpd \
+ --pidfile "${DHCPD_CHROOT}/${pidfile}" \
+ -- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \
+ -user dhcp -group dhcp \
+ ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} ${DHCPD_IFACE}
+ eend $? \
+ && save_options chroot "${DHCPD_CHROOT}" \
+ && save_options pidfile "${pidfile}"
+}
+
+stop() {
+ local chroot="$(get_options chroot)"
+
+ ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --stop --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/$(get_options pidfile)"
+ eend $?
+}
diff --git a/net-misc/dhcp/files/dhcrelay.conf b/net-misc/dhcp/files/dhcrelay.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=""
+
+# Insert any other options needed. See dhcrelay(8) for details.
+#DHCRELAY_OPTS=""
+
+# Space separated list of IPs to forward BOOTP/DHCP packets to.
+DHCRELAY_SERVERS=""
diff --git a/net-misc/dhcp/files/dhcrelay.init b/net-misc/dhcp/files/dhcrelay.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= i=
+ for i in ${IFACE} ; do
+ IFACES="${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/dhcrelay.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_SERVERS}
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <longdescription lang="en">The ISC DHCP client/server package.</longdescription>
+ <longdescription lang="ja">ISC DHCP クライアント/サーバ・パッケージです。</longdescription>
+ <use>
+ <flag name='client'>Install the dhclient program</flag>
+ <flag name='server'>Install the dhcpd and dhcrelay programs</flag>
+ <flag name='infiniband'>Enable ipoib support</flag>
+ </use>
+</pkgmetadata>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2012-03-15 19:49 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2012-03-15 19:49 UTC (permalink / raw
To: gentoo-commits
commit: a3fa1bc1d4222b496c826fbcfd95fcb8d8782850
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 19:46:56 2012 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 19:49:20 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=a3fa1bc1
[net-misc/dhcp] Enable infiniband in new version
(Portage version: 2.2.0_alpha90/git/Linux x86_64, unsigned Manifest commit)
---
net-misc/dhcp/ChangeLog | 32 +-
...-4.2.1_p1-r1.ebuild => dhcp-4.2.3_p1-r1.ebuild} | 183 ++--
net-misc/dhcp/files/dhcp-3.0-paranoia.patch | 207 ----
net-misc/dhcp/files/dhcp-3.0.2-gmake.patch | 66 --
.../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 ----
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 --
...0-options.patch => dhcp-4.2.0-ib-options.patch} | 821 ++++++++--------
net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch | 287 +++---
net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch | 1074 ++++++++++----------
net-misc/dhcp/files/dhcp-4.2.0-xen-checksum.patch | 245 -----
.../dhcp/files/dhcp-4.2.2-bind-build-flags.patch | 14 +
net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch | 13 +
.../files/dhcp-4.2.2-bind-parallel-build.patch | 14 +
....patch => dhcp-4.2.2-dhclient-resolvconf.patch} | 97 ++-
....patch => dhcp-4.2.2-dhclient-stdin-conf.patch} | 21 +-
...-nogateway.patch => dhcp-4.2.2-nogateway.patch} | 10 +-
net-misc/dhcp/files/{dhcpd.conf => dhcpd.conf2} | 3 +-
net-misc/dhcp/files/dhcpd.init3 | 94 --
net-misc/dhcp/files/dhcpd.init5 | 114 +++
net-misc/dhcp/files/dhcrelay.init | 32 -
net-misc/dhcp/metadata.xml | 5 +-
30 files changed, 1462 insertions(+), 3041 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index d743d00..2888d4c 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -1,11 +1,31 @@
# ChangeLog for net-misc/dhcp
-# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
- 25 Jun 2011; Justin Lecher <jlec@gentoo.org> dhcp-4.2.1_p1-r1.ebuild,
- metadata.xml:
- RDEPEND is not explicitly assigned -> fixed
+*dhcp-4.2.3_p1-r1 (15 Mar 2012)
- 24 Jun 2011; Justin Lecher <jlec@gentoo.org> dhcp-4.2.1_p1-r1.ebuild:
- Sort inherit and/or USE
+ 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org> +dhcp-4.2.3_p1-r1.ebuild,
+ +files/dhcp-4.2.0-ib-options.patch, +files/dhcp-4.2.2-bind-build-flags.patch,
+ +files/dhcp-4.2.2-bind-disable.patch,
+ +files/dhcp-4.2.2-bind-parallel-build.patch,
+ +files/dhcp-4.2.2-dhclient-resolvconf.patch,
+ +files/dhcp-4.2.2-dhclient-stdin-conf.patch,
+ +files/dhcp-4.2.2-nogateway.patch, +files/dhcpd.conf2, +files/dhcpd.init5,
+ -ChangeLog, -dhcp-4.2.1_p1-r1.ebuild, -files/dhcp-3.0-paranoia.patch,
+ -files/dhcp-3.0.2-gmake.patch, -files/dhcp-3.0.3-dhclient-hostname.patch,
+ -files/dhcp-3.0.3-dhclient-metric.patch, -files/dhcp-3.0.3-dhclient-mtu.patch,
+ -files/dhcp-3.0.3-dhclient-ntp.patch, -files/dhcp-3.0.3-libdst.patch,
+ -files/dhcp-3.0.3-no_isc_blurb.patch,
+ -files/dhcp-3.0.4-dhclient-stdin-conf.patch,
+ -files/dhcp-3.0.5-bpf-nofallback.patch,
+ -files/dhcp-3.1.0a1-dhclient-resolvconf.patch,
+ -files/dhcp-3.1.2_p1-CVE-2009-1892.patch,
+ -files/dhcp-3.1.3-dhclient-no-down.patch,
+ -files/dhcp-4.0.1-dhclient-stdin-conf.patch, -files/dhcp-4.2.0-options.patch,
+ -files/dhcp-4.2.0-xen-checksum.patch,
+ -files/dhcp-4.2.1-dhclient-resolvconf.patch,
+ -files/dhcp-4.2.1-nogateway.patch, -files/dhcpd.conf, -files/dhcpd.init3,
+ -files/dhcrelay.init, files/dhcp-4.2.0-improved-xid.patch,
+ files/dhcp-4.2.0-lpf-ib.patch, metadata.xml:
+ [net-misc/dhcp] Enable infiniband in new version
diff --git a/net-misc/dhcp/dhcp-4.2.1_p1-r1.ebuild b/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
similarity index 52%
rename from net-misc/dhcp/dhcp-4.2.1_p1-r1.ebuild
rename to net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
index c7966f9..78b8b37 100644
--- a/net-misc/dhcp/dhcp-4.2.1_p1-r1.ebuild
+++ b/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 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 $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-4.2.3_p1.ebuild,v 1.7 2012/01/01 15:03:13 armin76 Exp $
EAPI="2"
-inherit eutils
+inherit eutils toolchain-funcs
MY_PV="${PV//_alpha/a}"
MY_PV="${MY_PV//_beta/b}"
@@ -13,24 +13,32 @@ MY_PV="${MY_PV//_p/-P}"
MY_P="${PN}-${MY_PV}"
DESCRIPTION="ISC Dynamic Host Configuration Protocol (DHCP) client/server"
HOMEPAGE="http://www.isc.org/products/DHCP"
-SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz"
+SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz
+ ftp://ftp.isc.org/isc/dhcp/${MY_PV}/${MY_P}.tar.gz"
LICENSE="as-is BSD"
SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
-IUSE="+client infiniband ipv6 kernel_linux ldap selinux +server ssl vim-syntax"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="+client ipv6 infiniband kernel_linux ldap selinux +server ssl vim-syntax"
DEPEND="selinux? ( sec-policy/selinux-dhcp )
kernel_linux? ( sys-apps/net-tools )
- vim-syntax? ( app-vim/dhcpd-syntax )
ldap? (
net-nds/openldap
ssl? ( dev-libs/openssl )
)"
-RDEPEND="${DEPEND}"
+RDEPEND="${DEPEND}
+ vim-syntax? ( app-vim/dhcpd-syntax )"
S="${WORKDIR}/${MY_P}"
+src_unpack() {
+ unpack ${A}
+ # handle local bind hell
+ cd "${S}"/bind
+ unpack ./bind.tar.gz
+}
+
src_prepare() {
# Gentoo patches - these will probably never be accepted upstream
# Fix some permission issues
@@ -38,26 +46,25 @@ src_prepare() {
# 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
+ epatch "${FILESDIR}"/${PN}-4.2.2-dhclient-resolvconf.patch
# Stop downing the interface on Linux as that breaks link daemons
# such as wpa_supplicant and netplug
epatch "${FILESDIR}"/${PN}-3.0.3-dhclient-no-down.patch
epatch "${FILESDIR}"/${PN}-4.2.0-errwarn-message.patch
# Enable dhclient to get extra configuration from stdin
- epatch "${FILESDIR}"/${PN}-4.0.1-dhclient-stdin-conf.patch
- epatch "${FILESDIR}"/${PN}-4.2.1-nogateway.patch #265531
+ epatch "${FILESDIR}"/${PN}-4.2.2-dhclient-stdin-conf.patch
+ epatch "${FILESDIR}"/${PN}-4.2.2-nogateway.patch #265531
# NetworkManager support patches
# If they fail to apply to future versions they will be dropped
# Add dbus support to dhclient
epatch "${FILESDIR}"/${PN}-3.0.3-dhclient-dbus.patch
- # Infiniband stuff
+ # infiniband patches
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"
+ epatch "${FILESDIR}"/${PN}-4.2.0-improved-xid.patch
+ epatch "${FILESDIR}"/${PN}-4.2.0-lpf-ib.patch
+ epatch "${FILESDIR}"/${PN}-4.2.0-ib-options.patch
fi
# Brand the version with Gentoo
@@ -71,7 +78,7 @@ src_prepare() {
-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.
+ # 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
@@ -103,24 +110,70 @@ src_prepare() {
fi
# Now remove the non-english docs so there are no errors later
rm -rf doc/ja_JP.eucJP
+
+ # make the bind build work
+ binddir=${S}/bind
+ cd "${binddir}" || die
+ cat <<-EOF > bindvar.tmp
+ binddir=${binddir}
+ GMAKE=${MAKE:-gmake}
+ EOF
+ epatch "${FILESDIR}"/${PN}-4.2.2-bind-disable.patch
+ cd bind-*/
+ epatch "${FILESDIR}"/${PN}-4.2.2-bind-parallel-build.patch #380717
+ epatch "${FILESDIR}"/${PN}-4.2.2-bind-build-flags.patch
}
src_configure() {
+ # bind defaults to stupid `/usr/bin/ar`
+ tc-export AR BUILD_CC
+ export ac_cv_path_AR=${AR}
+
+ # this is tested for by the bind build system, and can cause trouble
+ # when cross-building; since dhcp itself doesn't make use of libcap,
+ # simply disable it.
+ export ac_cv_lib_cap_cap_set_proc=no
+
+ # Use FHS sane paths ... some of these have configure options,
+ # but not all, so just do it all here.
+ local e="/etc/dhcp" r="/var/run/dhcp" l="/var/lib/dhcp"
+ cat <<-EOF >> includes/site.h
+ #define _PATH_DHCPD_CONF "${e}/dhcpd.conf"
+ #define _PATH_DHCLIENT_CONF "${e}/dhclient.conf"
+ #define _PATH_DHCPD_DB "${l}/dhcpd.leases"
+ #define _PATH_DHCPD6_DB "${l}/dhcpd6.leases"
+ #define _PATH_DHCLIENT_DB "${l}/dhclient.leases"
+ #define _PATH_DHCLIENT6_DB "${l}/dhclient6.leases"
+ #define _PATH_DHCPD_PID "${r}/dhcpd.pid"
+ #define _PATH_DHCPD6_PID "${r}/dhcpd6.pid"
+ #define _PATH_DHCLIENT_PID "${r}/dhcpclient.pid"
+ #define _PATH_DHCLIENT6_PID "${r}/dhcpclient6.pid"
+ #define _PATH_DHCRELAY_PID "${r}/dhcrelay.pid"
+ #define _PATH_DHCRELAY6_PID "${r}/dhcrelay6.pid"
+ EOF
+
econf \
--enable-paranoia \
- --sysconfdir=/etc/dhcp \
- --with-cli-pid-file=/var/run/dhcp/dhclient.pid \
- --with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
- --with-cli6-pid-file=/var/run/dhcp/dhclient6.pid \
- --with-cli6-lease-file=/var/lib/dhcp/dhclient6.leases \
- --with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
- --with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
- --with-srv6-pid-file=/var/run/dhcp/dhcpd6.pid \
- --with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
- --with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
+ --enable-early-chroot \
+ --sysconfdir=${e} \
$(use_enable ipv6 dhcpv6) \
$(use_with ldap) \
$(use ldap && use_with ssl ldapcrypto || echo --without-ldapcrypto)
+
+ # configure local bind cruft. symtable option requires
+ # perl and we don't want to require that #383837.
+ cd bind/bind-*/ || die
+ eval econf \
+ $(sed -n '/ [.].configure /{s:^[^-]*::;s:>.*::;p}' ../Makefile) \
+ --disable-symtable \
+ --without-make-clean
+}
+
+src_compile() {
+ # build local bind cruft first
+ emake -C bind/bind-*/lib/export install || die
+ # then build standard dhcp code
+ emake || die
}
src_install() {
@@ -140,11 +193,6 @@ src_install() {
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
@@ -154,35 +202,36 @@ src_install() {
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
+ newinitd "${FILESDIR}"/dhcpd.init5 dhcpd || die
+ newconfd "${FILESDIR}"/dhcpd.conf2 dhcpd || die
+ newinitd "${FILESDIR}"/dhcrelay.init2 dhcrelay || die
+ newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay || die
fi
+
+ # the default config files aren't terribly useful #384087
+ sed -i '/^[^#]/s:^:#:' "${D}"/etc/dhcp/*.conf || die
}
pkg_preinst() {
enewgroup dhcp
enewuser dhcp -1 -1 /var/lib/dhcp dhcp
- # Keep the user files over the sample ones
- local f
- for f in dhclient dhcpd ; do
- f="/etc/dhcp/${f}.conf"
+ # Keep the user files over the sample ones. The
+ # hashing is to ignore the crappy defaults #384087.
+ local f h
+ for f in dhclient:da7c8496a96452190aecf9afceef4510 dhcpd:10979e7b71134bd7f04d2a60bd58f070 ; do
+ h=${f#*:}
+ f="/etc/dhcp/${f%:*}.conf"
if [ -e "${ROOT}"${f} ] ; then
- cp -p "${ROOT}"${f} "${D}"${f}
+ case $(md5sum "${ROOT}"${f}) in
+ ${h}*) ;;
+ *) cp -p "${ROOT}"${f} "${D}"${f};;
+ esac
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"
@@ -190,42 +239,4 @@ pkg_postinst() {
ewarn "and dhcp should be removed from the default runlevel"
ewarn
fi
-
- einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
- einfo
- einfo "If you would like to run dhcpd in a chroot, simply configure the"
- einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
- einfo " emerge --config =${PF}"
-}
-
-pkg_config() {
- local CHROOT="$(
- sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
- "${ROOT}"/etc/conf.d/dhcpd
- )"
-
- if [[ -z ${CHROOT} ]]; then
- eerror "CHROOT not defined in /etc/conf.d/dhcpd"
- return 1
- fi
-
- CHROOT="${ROOT}/${CHROOT}"
-
- if [[ -d ${CHROOT} ]] ; then
- ewarn "${CHROOT} already exists - aborting"
- return 0
- fi
-
- ebegin "Setting up the chroot directory"
- mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
- cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
- cp -R /etc/dhcp "${CHROOT}"/etc
- cp -R /var/lib/dhcp "${CHROOT}"/var/lib
- ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
- chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
- eend 0
-
- local logger="$(best_version virtual/logger)"
- einfo "To enable logging from the dhcpd server, configure your"
- einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
}
diff --git a/net-misc/dhcp/files/dhcp-3.0-paranoia.patch b/net-misc/dhcp/files/dhcp-3.0-paranoia.patch
deleted file mode 100644
index 886f5cb..0000000
--- a/net-misc/dhcp/files/dhcp-3.0-paranoia.patch
+++ /dev/null
@@ -1,207 +0,0 @@
-
-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 <user>
- -group <group>
- -chroot <chroot_dir>
-
-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 <chroot_dir>/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 <chroot_dir>/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 <omapip/omapip_p.h>
-
-+#if defined (PARANOIA)
-+# include <sys/types.h>
-+# include <unistd.h>
-+# include <pwd.h>
-+/* get around the ISC declaration of group */
-+# define group real_group
-+# include <grp.h>
-+# undef group
-+#endif /* PARANOIA */
-+
- static void usage PROTO ((void));
-
- TIME cur_time;
-@@ -204,6 +214,22 @@
- omapi_object_dereference (&listener, MDL);
- }
-
-+#if defined (PARANOIA)
-+/* to be used in one of two possible scenarios */
-+static void setup_chroot (char *chroot_dir) {
-+ if (geteuid())
-+ log_fatal ("you must be root to use chroot");
-+
-+ if (chroot(chroot_dir)) {
-+ log_fatal ("chroot(\"%s\"): %m", chroot_dir);
-+ }
-+ if (chdir ("/")) {
-+ /* probably permission denied */
-+ log_fatal ("chdir(\"/\"): %m");
-+ }
-+}
-+#endif /* PARANOIA */
-+
- int main (argc, argv, envp)
- int argc;
- char **argv, **envp;
-@@ -236,6 +262,14 @@
- char *traceinfile = (char *)0;
- char *traceoutfile = (char *)0;
- #endif
-+#if defined (PARANOIA)
-+ char *set_user = 0;
-+ char *set_group = 0;
-+ char *set_chroot = 0;
-+
-+ uid_t set_uid = 0;
-+ gid_t set_gid = 0;
-+#endif /* PARANOIA */
-
- /* Make sure we have stdin, stdout and stderr. */
- status = open ("/dev/null", O_RDWR);
-@@ -298,6 +332,20 @@
- if (++i == argc)
- usage ();
- server = argv [i];
-+#if defined (PARANOIA)
-+ } else if (!strcmp (argv [i], "-user")) {
-+ if (++i == argc)
-+ usage ();
-+ set_user = argv [i];
-+ } else if (!strcmp (argv [i], "-group")) {
-+ if (++i == argc)
-+ usage ();
-+ set_group = argv [i];
-+ } else if (!strcmp (argv [i], "-chroot")) {
-+ if (++i == argc)
-+ usage ();
-+ set_chroot = argv [i];
-+#endif /* PARANOIA */
- } else if (!strcmp (argv [i], "-cf")) {
- if (++i == argc)
- usage ();
-@@ -397,6 +445,44 @@
- trace_seed_stop, MDL);
- #endif
-
-+#if defined (PARANOIA)
-+ /* get user and group info if those options were given */
-+ if (set_user) {
-+ struct passwd *tmp_pwd;
-+
-+ if (geteuid())
-+ log_fatal ("you must be root to set user");
-+
-+ if (!(tmp_pwd = getpwnam(set_user)))
-+ log_fatal ("no such user: %s", set_user);
-+
-+ set_uid = tmp_pwd->pw_uid;
-+
-+ /* use the user's group as the default gid */
-+ if (!set_group)
-+ set_gid = tmp_pwd->pw_gid;
-+ }
-+
-+ if (set_group) {
-+/* get around the ISC declaration of group */
-+#define group real_group
-+ struct group *tmp_grp;
-+
-+ if (geteuid())
-+ log_fatal ("you must be root to set group");
-+
-+ if (!(tmp_grp = getgrnam(set_group)))
-+ log_fatal ("no such group: %s", set_group);
-+
-+ set_gid = tmp_grp->gr_gid;
-+#undef group
-+ }
-+
-+# if defined (EARLY_CHROOT)
-+ if (set_chroot) setup_chroot (set_chroot);
-+# endif /* EARLY_CHROOT */
-+#endif /* PARANOIA */
-+
- /* Default to the DHCP/BOOTP port. */
- if (!local_port)
- {
-@@ -500,6 +586,10 @@
-
- postconf_initialization (quiet);
-
-+#if defined (PARANOIA) && !defined (EARLY_CHROOT)
-+ if (set_chroot) setup_chroot (set_chroot);
-+#endif /* PARANOIA && !EARLY_CHROOT */
-+
- /* test option should cause an early exit */
- if (cftest && !lftest)
- exit(0);
-@@ -543,6 +633,22 @@
- exit (0);
- }
-
-+#if defined (PARANOIA)
-+ /* change uid to the specified one */
-+
-+ if (set_gid) {
-+ if (setgroups (0, (void *)0))
-+ log_fatal ("setgroups: %m");
-+ if (setgid (set_gid))
-+ log_fatal ("setgid(%d): %m", (int) set_gid);
-+ }
-+
-+ if (set_uid) {
-+ if (setuid (set_uid))
-+ log_fatal ("setuid(%d): %m", (int) set_uid);
-+ }
-+#endif /* PARANOIA */
-+
- /* Read previous pid file. */
- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
- status = read (i, pbuf, (sizeof pbuf) - 1);
-@@ -888,6 +994,10 @@
-
- log_fatal ("Usage: dhcpd [-p <UDP port #>] [-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/files/dhcp-3.0.2-gmake.patch
deleted file mode 100644
index 4ab99a2..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.2-gmake.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-Index: dhcp-3.0.2/Makefile
-===================================================================
---- 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
-
- 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
-
- 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
-
- 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
-
- 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
-
- 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
-
- 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
-
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
deleted file mode 100644
index 9a6e7b9..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-hostname.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- client/scripts/linux
-+++ client/scripts/linux
-@@ -138,10 +138,12 @@
- [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
- current_hostname=`hostname`
- if [ x$current_hostname = x ] || \
-+ [ x$current_hostname = "x(none)" ] || \
-+ [ x$current_hostname = xlocalhost ] || \
- [ x$current_hostname = x$old_host_name ]; then
- if [ x$current_hostname = x ] || \
- [ x$new_host_name != x$old_host_name ]; then
-- hostname $new_host_name
-+ hostname "$new_host_name"
- fi
- fi
-
diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch
deleted file mode 100644
index 040ef77..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-metric.patch
+++ /dev/null
@@ -1,200 +0,0 @@
---- client/scripts/bsdos
-+++ client/scripts/bsdos
-@@ -84,6 +84,9 @@
- if [ x$new_interface_mtu != x ]; then
- mtu_arg="mtu $new_interface_mtu"
- fi
-+if [ x$IF_METRIC != x ]; then
-+ metric_arg="metric $IF_METRIC"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- eval "ifconfig $interface $medium"
-@@ -141,7 +144,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $mtu_arg $medium"
-+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
- route add $new_ip_address 127.1 >/dev/null 2>&1
- for router in $new_routers; do
- route add default $router >/dev/null 2>&1
-@@ -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" != "" ]; then
- set $new_routers
---- client/scripts/freebsd
-+++ client/scripts/freebsd
-@@ -94,6 +94,9 @@
- if [ x$new_interface_mtu != x ]; then
- mtu_arg="mtu $new_interface_mtu"
- fi
-+if [ x$IF_METRIC != x ]; then
-+ metric_arg="metric $IF_METRIC"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- eval "ifconfig $interface $medium"
-@@ -151,7 +154,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $mtu_arg $medium"
-+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
- $LOGGER "New IP Address ($interface): $new_ip_address"
- $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
- $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
-@@ -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
-
--release=`uname -r`
--release=`expr $release : '\(.*\)\..*'`
--relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
--relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
--
- if [ x$new_broadcast_address != x ]; then
- new_broadcast_arg="broadcast $new_broadcast_address"
- fi
-@@ -106,6 +101,9 @@
- if [ x$new_interface_mtu != x ]; then
- mtu_arg="mtu $new_interface_mtu"
- fi
-+if [ x$IF_METRIC != x ]; then
-+ metric_arg="metric $IF_METRIC"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- # Linux doesn't do mediums (ok, ok, media).
-@@ -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
-
- # 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 != x ] && [ x$IF_METRIC != x0 ]; then
-+ route del -net $new_network_number $new_subnet_arg \
-+ dev $interface
-+ route add -net $new_network_number $new_subnet_arg $metric_arg \
-+ dev $interface
- fi
- for router in $new_routers; do
-- route add default gw $router
-+ route add default gw $router $metric_arg dev $interface
- done
- fi
- if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
-@@ -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 != x ] && [ x$IF_METRIC != x0 ]; then
-+ route del -net $new_network_number $new_subnet_arg \
-+ dev $interface
-+ route add -net $new_network_number $new_subnet_arg $metric_arg \
-+ dev $interface
- fi
- for router in $new_routers; do
-- route add default gw $router
-+ route add default gw $router $metric_arg dev $interface
- done
- make_resolv_conf
- exit_with_hooks 0
---- client/scripts/netbsd
-+++ client/scripts/netbsd
-@@ -84,6 +84,9 @@
- if [ x$new_interface_mtu != x ]; then
- mtu_arg="mtu $new_interface_mtu"
- fi
-+if [ x$IF_METRIC != x ]; then
-+ metric_arg="metric $IF_METRIC"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- eval "ifconfig $interface $medium"
-@@ -141,7 +144,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $mtu_arg $medium"
-+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
- route add $new_ip_address 127.1 >/dev/null 2>&1
- for router in $new_routers; do
- route add default $router >/dev/null 2>&1
-@@ -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" != "" ]; then
- set $new_routers
---- client/scripts/solaris
-+++ client/scripts/solaris
-@@ -79,6 +79,9 @@
- if [ x$new_interface_mtu != x ]; then
- mtu_arg="mtu $new_interface_mtu"
- fi
-+if [ x$IF_METRIC != x ]; then
-+ metric_arg="metric $IF_METRIC"
-+fi
-
- ifconfig=/sbin/ifconfig
-
-@@ -141,7 +144,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $mtu_arg $medium"
-+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
- route add $new_ip_address 127.1 1 >/dev/null 2>&1
- for router in $new_routers; do
- route add default $router 1 >/dev/null 2>&1
-@@ -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
deleted file mode 100644
index 5ef4442..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-mtu.patch
+++ /dev/null
@@ -1,180 +0,0 @@
---- client/scripts/bsdos
-+++ client/scripts/bsdos
-@@ -81,6 +81,9 @@
- if [ x$alias_subnet_mask != x ]; then
- alias_subnet_arg="netmask $alias_subnet_mask"
- fi
-+if [ x$new_interface_mtu != x ]; then
-+ mtu_arg="mtu $new_interface_mtu"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- eval "ifconfig $interface $medium"
-@@ -138,7 +141,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $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" != "" ]; then
- set $new_routers
---- client/scripts/freebsd
-+++ client/scripts/freebsd
-@@ -91,6 +91,9 @@
- if [ x$alias_subnet_mask != x ]; then
- alias_subnet_arg="netmask $alias_subnet_mask"
- fi
-+if [ x$new_interface_mtu != x ]; then
-+ mtu_arg="mtu $new_interface_mtu"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- eval "ifconfig $interface $medium"
-@@ -148,7 +151,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $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 != x ]; then
- alias_subnet_arg="netmask $alias_subnet_mask"
- fi
-+if [ x$new_interface_mtu != x ]; then
-+ mtu_arg="mtu $new_interface_mtu"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- # Linux doesn't do mediums (ok, ok, media).
-@@ -159,7 +162,7 @@
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
-
- 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 != x ]; then
- alias_subnet_arg="netmask $alias_subnet_mask"
- fi
-+if [ x$new_interface_mtu != x ]; then
-+ mtu_arg="mtu $new_interface_mtu"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- eval "ifconfig $interface $medium"
-@@ -138,7 +141,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $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" != "" ]; then
- set $new_routers
---- client/scripts/openbsd
-+++ client/scripts/openbsd
-@@ -81,6 +81,9 @@
- if [ x$alias_subnet_mask != x ]; then
- alias_subnet_arg="netmask $alias_subnet_mask"
- fi
-+if [ x$new_interface_mtu != x ]; then
-+ mtu_arg="mtu $new_interface_mtu"
-+fi
-
- if [ x$reason = xMEDIUM ]; then
- eval "ifconfig $interface $medium"
-@@ -138,7 +141,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $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" != "" ]; then
- set $new_routers
---- client/scripts/solaris
-+++ client/scripts/solaris
-@@ -76,6 +76,9 @@
- if [ x$alias_subnet_mask != x ]; then
- alias_subnet_arg="netmask $alias_subnet_mask"
- fi
-+if [ x$new_interface_mtu != x ]; then
-+ mtu_arg="mtu $new_interface_mtu"
-+fi
-
- ifconfig=/sbin/ifconfig
-
-@@ -138,7 +141,7 @@
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
- [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
-- $new_broadcast_arg $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-ntp.patch b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-ntp.patch
deleted file mode 100644
index d84e6f6..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-ntp.patch
+++ /dev/null
@@ -1,186 +0,0 @@
---- 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 = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ x$new_ntp_servers != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
---- 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
- }
-
-+make_ntp_conf() {
-+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
-+}
-+
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
- exit_with_hooks() {
- exit_status=$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 = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
---- 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 = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
---- 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 = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
---- 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 = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
diff --git a/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch b/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch
deleted file mode 100644
index 8e93ac9..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- 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
-
- install:
-+ mkdir -p $(DESTDIR)$(LIBDIR)
-+ $(INSTALL) libdst.a $(DESTDIR)$(LIBDIR)
-+ $(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libdst.a
-+
-
- 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
deleted file mode 100644
index 38f7713..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-no_isc_blurb.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-Patch nobbled from RedHat, and adapted to work with dhclient and dhrelay
-by Roy Marples <uberlord@gentoo.org>
-
---- dhcp-3.0.3/omapip/errwarn.c.no_isc_blurb 2004-09-30 16:38:32.000000000 -0400
-+++ dhcp-3.0.3/omapip/errwarn.c 2005-04-18 13:45:49.037158000 -0400
-@@ -45,6 +45,8 @@
- int log_perror = 1;
- #endif
- int log_priority;
-+int log_isc_blurb=1;
-+
- void (*log_cleanup) (void);
-
- #define CVT_BUF_MAX 1023
-@@ -76,7 +78,9 @@
- write (STDERR_FILENO, "\n", 1);
- }
-
--#if !defined (NOMINUM)
-+#if !defined(NOMINUM)
-+ if ( log_isc_blurb )
-+ {
- log_error ("%s", "");
- log_error ("If you did not get this software from ftp.isc.org, please");
- log_error ("get the latest from ftp.isc.org and install that before");
-@@ -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.509169000 -0400
-+++ dhcp-3.0.3/client/dhclient.c 2005-04-18 13:49:27.574402000 -0400
-@@ -34,7 +34,7 @@
- static char ocopyright[] =
- "$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 reserved.\n";
- #endif /* not lint */
--
-+
- #include "dhcpd.h"
- #include "version.h"
-
-@@ -81,6 +81,8 @@
-
- void do_release(struct client_state *);
-
-+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 = 1;
- quiet_interface_discovery = 1;
-+ log_isc_blurb = 0;
- } else if (!strcmp (argv [i], "-s")) {
- if (++i == 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;
-
-+
-+extern int log_isc_blurb;
-+
- #if defined (NSUPDATE)
-
- /* This stuff is always executed to figure the default values for certain
-@@ -368,6 +371,7 @@
- } else if (!strcmp (argv [i], "-q")) {
- quiet = 1;
- quiet_interface_discovery = 1;
-+ log_isc_blurb = 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.000000000 +0000
-+++ dhcp-3.0.3/relay/dhcrelay.c 2005-12-08 10:21:50.000000000 +0000
-@@ -102,6 +102,8 @@
- static char message [] = "Internet Systems Consortium DHCP Relay Agent";
- static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/";
-
-+extern int log_isc_blurb;
-+
- int main (argc, argv, envp)
- int argc;
- char **argv, **envp;
-@@ -170,6 +172,7 @@
- } else if (!strcmp (argv [i], "-q")) {
- quiet = 1;
- quiet_interface_discovery = 1;
-+ log_isc_blurb = 0;
- } else if (!strcmp (argv [i], "-a")) {
- add_agent_options = 1;
- } else if (!strcmp (argv [i], "-c")) {
diff --git a/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch b/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch
deleted file mode 100644
index 3fedc7c..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch
+++ /dev/null
@@ -1,83 +0,0 @@
---- 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 != -1)
-+ if ((*cfile)->file != -1 && (*cfile)->file != fileno(stdin))
- close((*cfile)->file);
-
- 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 = 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);
-+
- if (status != ISC_R_SUCCESS) {
- ;
- #ifdef LATER
-@@ -148,20 +153,17 @@
- return status;
- }
-
--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,
-+ struct interface_info *ip,
-+ struct client_config *client)
- {
-- int file;
- struct parse *cfile;
- const char *val;
- int token;
- isc_result_t status;
-
-- if ((file = open (name, O_RDONLY)) < 0)
-- return uerr2isc (errno);
--
- cfile = (struct parse *)0;
-- new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
-+ new_parse (&cfile, file, (char *)0, 0, name , 0);
-
- do {
- token = peek_token (&val, (unsigned *)0, cfile);
-@@ -177,6 +179,32 @@
- return status;
- }
-
-+int read_client_conf_file (const char *name, struct interface_info *ip,
-+ struct client_config *client)
-+{
-+ int file;
-+ isc_result_t status;
-+
-+ if ((file = open (name, O_RDONLY)) < 0)
-+ return uerr2isc (errno);
-+
-+ status = 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 = fileno(stdin);
-+ isc_result_t status;
-+
-+ if (isatty(file)) return ISC_R_NOTFOUND;
-+ status = read_client_conf_actual(file, "stdin", ip, client);
-+
-+ return status;
-+}
-
- /* lease-file :== client-lease-statements END_OF_FILE
- client-lease-statements :== <nil>
diff --git a/net-misc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch b/net-misc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch
deleted file mode 100644
index 2fae6f2..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.5-bpf-nofallback.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-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;
-
-- 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 @@
-
- void maybe_setup_fallback ()
- {
-- isc_result_t status;
-- struct interface_info *fbi = (struct interface_info *)0;
-- if (setup_fallback (&fbi, MDL)) {
-- if_register_fallback (fbi);
-- status = omapi_register_io_object ((omapi_object_t *)fbi,
-- if_readsocket, 0,
-- fallback_discard, 0, 0);
-- if (status != 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. */
-
--#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
deleted file mode 100644
index 5c420ae..0000000
--- a/net-misc/dhcp/files/dhcp-3.1.0a1-dhclient-resolvconf.patch
+++ /dev/null
@@ -1,254 +0,0 @@
-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
-
- make_resolv_conf() {
-- if [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- if [ "x$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ "x$new_domain_name" != x ]; then
-- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
-+ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ if [ "x$new_domain_name" != x ]; then
-+ conf="${conf}search $new_domain_name\n"
-+ fi
-+ for nameserver in $new_domain_name_servers; do
-+ conf="${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
-
- make_resolv_conf() {
-- if [ x"$new_domain_name_servers" != x ]; then
-- ( cat /dev/null > /etc/resolv.conf.dhclient )
-- exit_status=$?
-- if [ $exit_status -ne 0 ]; then
-- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
-- else
-- if [ "x$new_domain_search" != x ]; then
-- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
-- exit_status=$?
-- elif [ "x$new_domain_name" != x ]; then
-- # Note that the DHCP 'Domain Name Option' is really just a domain
-- # name, and that this practice of using the domain name option as
-- # a search path is both nonstandard and deprecated.
-- ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
-- exit_status=$?
-+ if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then
-+ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ if [ "x$new_domain_name" != x ]; then
-+ conf="${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=$?
-+ conf="${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 = $?
-- 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.
-
- make_resolv_conf() {
-- if [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- chmod 644 /etc/resolv.conf.dhclient
-- if [ x"$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ x"$new_domain_name" != x ]; then
-- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
-+ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ if [ "x$new_domain_name" != x ]; then
-+ conf="${conf}search $new_domain_name\n"
-+ fi
-+ for nameserver in $new_domain_name_servers; do
-+ conf="${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
-
- make_resolv_conf() {
-- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- if [ "x$new_domain_search != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ "x$new_domain_name != x ]; then
-- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
-+ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ if [ "x$new_domain_name" != x ]; then
-+ conf="${conf}search $new_domain_name\n"
-+ fi
-+ for nameserver in $new_domain_name_servers; do
-+ conf="${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
-
- make_resolv_conf() {
-- if x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- if [ x"$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ x"$new_domain_name" != x ]; then
-- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
-+ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ if [ "x$new_domain_name" != x ]; then
-+ conf="${conf}search $new_domain_name\n"
-+ fi
-+ for nameserver in $new_domain_name_servers; do
-+ conf="${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
-
- make_resolv_conf() {
-- if [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- if [ x"$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ x"$new_domain_name" != x ]; then
-- # 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 = x ] || [ x$PEER_DNS = xyes ]; then
-+ if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ if [ "x$new_domain_name" != x ]; then
-+ conf="${conf}search $new_domain_name\n"
-+ fi
-+ for nameserver in $new_domain_name_servers; do
-+ conf="${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
deleted file mode 100644
index ae1b92a..0000000
--- a/net-misc/dhcp/files/dhcp-3.1.2_p1-CVE-2009-1892.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-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
deleted file mode 100644
index 89935df..0000000
--- a/net-misc/dhcp/files/dhcp-3.1.3-dhclient-no-down.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-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 = xPREINIT ]; then
- if [ x$alias_ip_address != 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
-
- # We need to give the kernel some time to get the interface up.
-@@ -155,12 +155,12 @@
- if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
- [ x$alias_ip_address != 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 != x ] && [ x$old_ip_address != x$new_ip_address ]; then
- # IP address changed. Bringing down the interface will delete all routes,
- # and clear the ARP cache.
-- ifconfig $interface inet 0 down
-+ ifconfig $interface inet 0.0.0.0
-
- fi
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
-@@ -179,7 +179,7 @@
- fi
- if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != 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 = xSTOP ]; then
- if [ x$alias_ip_address != 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 != 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 != x ]; then
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
-@@ -206,7 +206,7 @@
-
- if [ x$reason = xTIMEOUT ]; then
- if [ x$alias_ip_address != 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
-
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-options.patch b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
similarity index 84%
rename from net-misc/dhcp/files/dhcp-4.2.0-options.patch
rename to net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
index 6c2062a..5127f52 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-options.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
@@ -1,401 +1,420 @@
-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 -0500
-+++ 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 = 7200;
-+ top_level_config.bootp_broadcast_always = 0;
-
- 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 */
-
- void parse_client_statement (cfile, ip, config)
- struct parse *cfile;
-@@ -717,6 +719,12 @@ void parse_client_statement (cfile, ip,
- parse_reject_statement (cfile, config);
- return;
-
-+ case BOOTP_BROADCAST_ALWAYS:
-+ token = next_token(&val, (unsigned*)0, cfile);
-+ config -> bootp_broadcast_always = 1;
-+ parse_semi (cfile);
-+ return;
-+
- default:
- lose = 0;
- stmt = (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 <limits.h>
- #include <dns/result.h>
-
-+/*
-+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
-+ * that when building ISC code.
-+ */
-+extern int asprintf(char **strp, const char *fmt, ...);
-+
- TIME default_lease_time = 43200; /* 12 hours... */
- TIME max_lease_time = 86400; /* 24 hours... */
-
-@@ -82,6 +88,9 @@ int wanted_ia_na = -1; /* the absolute
- int wanted_ia_ta = 0;
- int wanted_ia_pd = 0;
- char *mockup_relay = NULL;
-+int bootp_broadcast_always = 0;
-+
-+extern u_int32_t default_requested_options[];
-
- void run_stateless(int exit_mode);
-
-@@ -112,6 +121,15 @@ main(int argc, char **argv) {
- int local_family_set = 0;
- #endif /* DHCPv6 */
- char *s;
-+ char *dhcp_client_identifier_arg = NULL;
-+ char *dhcp_host_name_arg = NULL;
-+ char *dhcp_fqdn_arg = NULL;
-+ char *dhcp_vendor_class_identifier_arg = NULL;
-+ char *dhclient_request_options = NULL;
-+
-+ int timeout_arg = 0;
-+ char *arg_conf = NULL;
-+ int arg_conf_len = 0;
-
- /* 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 == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
-+ exit(1);
-+ }
-+
-+ dhcp_client_identifier_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-B")) {
-+ bootp_broadcast_always = 1;
-+ } else if (!strcmp(argv[i], "-H")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= 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 != NULL) {
-+ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
-+ exit(1);
-+ }
-+
-+ dhcp_host_name_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-F")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= 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 != NULL) {
-+ log_error("Only one -F <fqdn> argument can be specified");
-+ exit(1);
-+ }
-+
-+ if (dhcp_host_name_arg != NULL) {
-+ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
-+ exit(1);
-+ }
-+
-+ dhcp_fqdn_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-timeout")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if ((timeout_arg = atoi(argv[i])) <= 0) {
-+ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
-+ exit(1);
-+ }
-+ } else if (!strcmp(argv[i], "-V")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
-+ exit(1);
-+ }
-+
-+ dhcp_vendor_class_identifier_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-R")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ dhclient_request_options = argv[i];
- } else if (argv[i][0] == '-') {
- usage();
- } else if (interfaces_requested < 0) {
-@@ -466,6 +566,166 @@ main(int argc, char **argv) {
- /* Parse the dhclient.conf file. */
- read_client_conf();
-
-+ /* Parse any extra command line configuration arguments: */
-+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
-+ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -I option dhcp-client-identifier");
-+ }
-+
-+ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -H option host-name");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -H option host-name");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -F option fqdn.fqdn");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -F option fqdn.fqdn");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (timeout_arg) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to process -timeout timeout argument");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len == 0))
-+ log_fatal("Unable to process -timeout timeout argument");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -V option vendor-class-identifier");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -V option vendor-class-identifier");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (dhclient_request_options != NULL) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to parse -R <request options list> argument");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to parse -R <request options list> argument");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (arg_conf) {
-+ if (arg_conf_len == 0)
-+ if ((arg_conf_len = strlen(arg_conf)) == 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 = (struct parse *)0;
-+ const char *val = NULL;
-+ int token;
-+
-+ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
-+
-+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
-+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
-+ /* more detailed parse failures will be logged */
-+
-+ do {
-+ token = peek_token(&val, (unsigned *)0, cfile);
-+ if (token == 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 arguments !");
-+ 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 == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
-+ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
-+
-+ for (ip=interfaces; ip; ip = ip->next) {
-+ if (ip->client->config->timeout == 60)
-+ ip->client->config->timeout = timeout_arg;
-+
-+ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
-+ ip->client->config->reboot_timeout = ip->client->config->timeout;
-+ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
-+ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
-+ }
-+ }
-+
-+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != (void *) default_requested_options)) {
-+ for (ip=interfaces; ip; ip = ip->next) {
-+ if (ip->client->config->requested_options == (void *) default_requested_options)
-+ ip->client->config->requested_options = top_level_config.requested_options;
-+ }
-+ }
-+
-+ free(arg_conf);
-+ arg_conf = NULL;
-+ arg_conf_len = 0;
-+ }
-+
- /* Parse the lease database. */
- read_client_leases();
-
-@@ -2337,7 +2597,8 @@ void make_discover (client, lease)
- client -> packet.xid = random ();
- client -> packet.secs = 0; /* filled in by send_discover. */
-
-- 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 = 0;
- else
- client -> packet.flags = 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 = 0;
- else
- client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2483,7 +2746,8 @@ void make_decline (client, lease)
- client -> packet.hops = 0;
- client -> packet.xid = client -> xid;
- client -> packet.secs = 0; /* Filled in by send_request. */
-- 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 = 0;
- else
- client -> packet.flags = 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 -0400
-+++ 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)
- 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 -0400
-+++ 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_BROADCAST
-+ flag in requests */
- };
-
- /* Per-interface state used in the dhcp client... */
-diff -up dhcp-4.2.0/includes/dhctoken.h.options dhcp-4.2.0/includes/dhctoken.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 = 660,
- AUTO_PARTNER_DOWN = 661,
- GETHOSTNAME = 662,
-- REWIND = 663
-+ REWIND = 663,
-+ BOOTP_BROADCAST_ALWAYS = 664
- };
-
- #define is_identifier(x) ((x) >= FIRST_TOKEN && \
+From 1b23cc04e0c76579eb3657ff93abaa487363a434 Mon Sep 17 00:00:00 2001
+From: Alexey Shvetsov <alexxy@gentoo.org>
+Date: Thu, 15 Mar 2012 23:21:21 +0400
+Subject: [PATCH 3/3] ib options
+
+---
+ client/clparse.c | 10 +-
+ client/dhclient.c | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++-
+ common/conflex.c | 2 +
+ includes/dhcpd.h | 3 +
+ includes/dhctoken.h | 1 +
+ 5 files changed, 282 insertions(+), 4 deletions(-)
+
+diff --git a/client/clparse.c b/client/clparse.c
+index 9de4ce2..890647d 100644
+--- a/client/clparse.c
++++ b/client/clparse.c
+@@ -146,6 +146,7 @@ isc_result_t read_client_conf ()
+ /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
+ */
+ top_level_config.requested_lease = 7200;
++ top_level_config.bootp_broadcast_always = 0;
+
+ group_allocate (&top_level_config.on_receipt, MDL);
+ if (!top_level_config.on_receipt)
+@@ -313,7 +314,8 @@ void read_client_leases ()
+ interface-declaration |
+ LEASE client-lease-statement |
+ ALIAS client-lease-statement |
+- KEY key-definition */
++ KEY key-definition |
++ BOOTP_BROADCAST_ALWAYS */
+
+ void parse_client_statement (cfile, ip, config)
+ struct parse *cfile;
+@@ -732,6 +734,12 @@ void parse_client_statement (cfile, ip, config)
+ parse_reject_statement (cfile, config);
+ return;
+
++ case BOOTP_BROADCAST_ALWAYS:
++ token = next_token(&val, (unsigned*)0, cfile);
++ config -> bootp_broadcast_always = 1;
++ parse_semi (cfile);
++ return;
++
+ default:
+ lose = 0;
+ stmt = (struct executable_statement *)0;
+diff --git a/client/dhclient.c b/client/dhclient.c
+index 138b563..a853bbc 100644
+--- a/client/dhclient.c
++++ b/client/dhclient.c
+@@ -39,6 +39,12 @@
+ #include <limits.h>
+ #include <dns/result.h>
+
++/*
++ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
++ * that when building ISC code.
++ */
++extern int asprintf(char **strp, const char *fmt, ...);
++
+ TIME default_lease_time = 43200; /* 12 hours... */
+ TIME max_lease_time = 86400; /* 24 hours... */
+
+@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute value is the real one. */
+ int wanted_ia_ta = 0;
+ int wanted_ia_pd = 0;
+ char *mockup_relay = NULL;
++int bootp_broadcast_always = 0;
++
++extern u_int32_t default_requested_options[];
+
+ void run_stateless(int exit_mode);
+
+@@ -146,6 +155,15 @@ main(int argc, char **argv) {
+ int local_family_set = 0;
+ #endif /* DHCPv6 */
+ char *s;
++ char *dhcp_client_identifier_arg = NULL;
++ char *dhcp_host_name_arg = NULL;
++ char *dhcp_fqdn_arg = NULL;
++ char *dhcp_vendor_class_identifier_arg = NULL;
++ char *dhclient_request_options = NULL;
++
++ int timeout_arg = 0;
++ char *arg_conf = NULL;
++ int arg_conf_len = 0;
+
+ /* Initialize client globals. */
+ memset(&default_duid, 0, sizeof(default_duid));
+@@ -333,6 +351,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 == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_client_identifier_arg = argv[i];
++ } else if (!strcmp(argv[i], "-B")) {
++ bootp_broadcast_always = 1;
++ } else if (!strcmp(argv[i], "-H")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= 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 != NULL) {
++ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_host_name_arg = argv[i];
++ } else if (!strcmp(argv[i], "-F")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= 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 != NULL) {
++ log_error("Only one -F <fqdn> argument can be specified");
++ exit(1);
++ }
++
++ if (dhcp_host_name_arg != NULL) {
++ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_fqdn_arg = argv[i];
++ } else if (!strcmp(argv[i], "-timeout")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if ((timeout_arg = atoi(argv[i])) <= 0) {
++ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
++ exit(1);
++ }
++ } else if (!strcmp(argv[i], "-V")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_vendor_class_identifier_arg = argv[i];
++ } else if (!strcmp(argv[i], "-R")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ dhclient_request_options = argv[i];
+ } else if (argv[i][0] == '-') {
+ usage();
+ } else if (interfaces_requested < 0) {
+@@ -507,6 +607,166 @@ main(int argc, char **argv) {
+ /* Parse the dhclient.conf file. */
+ read_client_conf();
+
++ /* Parse any extra command line configuration arguments: */
++ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
++ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -I option dhcp-client-identifier");
++ }
++
++ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (timeout_arg) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to process -timeout timeout argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len == 0))
++ log_fatal("Unable to process -timeout timeout argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (dhclient_request_options != NULL) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (arg_conf) {
++ if (arg_conf_len == 0)
++ if ((arg_conf_len = strlen(arg_conf)) == 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 = (struct parse *)0;
++ const char *val = NULL;
++ int token;
++
++ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
++
++ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
++ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
++ /* more detailed parse failures will be logged */
++
++ do {
++ token = peek_token(&val, (unsigned *)0, cfile);
++ if (token == 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 arguments !");
++ 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 == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
++ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
++
++ for (ip=interfaces; ip; ip = ip->next) {
++ if (ip->client->config->timeout == 60)
++ ip->client->config->timeout = timeout_arg;
++
++ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
++ ip->client->config->reboot_timeout = ip->client->config->timeout;
++ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
++ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
++ }
++ }
++
++ if ((dhclient_request_options != 0) && (top_level_config.requested_options != (void *) default_requested_options)) {
++ for (ip=interfaces; ip; ip = ip->next) {
++ if (ip->client->config->requested_options == (void *) default_requested_options)
++ ip->client->config->requested_options = top_level_config.requested_options;
++ }
++ }
++
++ free(arg_conf);
++ arg_conf = NULL;
++ arg_conf_len = 0;
++ }
++
+ /* Parse the lease database. */
+ read_client_leases();
+
+@@ -2468,7 +2728,8 @@ void make_discover (client, lease)
+ client -> packet.xid = random ();
+ client -> packet.secs = 0; /* filled in by send_discover. */
+
+- 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 = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2552,7 +2813,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 = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2614,7 +2877,8 @@ void make_decline (client, lease)
+ client -> packet.hops = 0;
+ client -> packet.xid = client -> xid;
+ client -> packet.secs = 0; /* Filled in by send_request. */
+- 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 = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+diff --git a/common/conflex.c b/common/conflex.c
+index 9c9ed66..028e69c 100644
+--- a/common/conflex.c
++++ b/common/conflex.c
+@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv) {
+ 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 --git a/includes/dhcpd.h b/includes/dhcpd.h
+index 5a137e6..7da8b76 100644
+--- a/includes/dhcpd.h
++++ b/includes/dhcpd.h
+@@ -1147,6 +1147,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_BROADCAST
++ flag in requests */
+ };
+
+ /* Per-interface state used in the dhcp client... */
+diff --git a/includes/dhctoken.h b/includes/dhctoken.h
+index 9911d70..6110b4f 100644
+--- a/includes/dhctoken.h
++++ b/includes/dhctoken.h
+@@ -364,6 +364,7 @@ enum dhcp_token {
+ GETHOSTBYNAME = 665,
+ PRIMARY6 = 666,
+ SECONDARY6 = 667
++ BOOTP_BROADCAST_ALWAYS = 668
+ };
+
+ #define is_identifier(x) ((x) >= FIRST_TOKEN && \
+--
+1.7.9.3
+
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
index 567601f..1fd4dbe 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch
@@ -1,138 +1,149 @@
-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) {
- }
- }
-
-+ /* 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 = 0;
-+ for (ip = interfaces; ip; ip = ip -> next) {
-+ int junk;
-+ if ( ip -> hw_address.hlen <= sizeof seed )
-+ continue;
-+ memcpy (&junk,
-+ &ip -> hw_address.hbuf [ip -> hw_address.hlen -
-+ sizeof seed], sizeof seed);
-+ backup_seed = 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 = 0;
-+ int seed_flag = 0;
- for (ip = interfaces; ip; ip = ip->next) {
- int junk;
-+ if ( ip -> hw_address.hlen <= sizeof seed )
-+ continue;
- memcpy(&junk,
- &ip->hw_address.hbuf[ip->hw_address.hlen -
- sizeof seed], sizeof seed);
- seed += junk;
-+ seed_flag = 1;
- }
-- srandom(seed + cur_time);
-+ if ( seed_flag == 0 ) {
-+ if ( backup_seed != 0 ) {
-+ seed = backup_seed;
-+ log_info ("xid: rand init seed (0x%x) built using all"
-+ " available interfaces",seed);
-+ }
-+ else {
-+ seed = 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);
-
- /* Setup specific Infiniband options */
- for (ip = interfaces; ip; ip = ip->next) {
-@@ -1310,7 +1352,7 @@ void dhcpack (packet)
- return;
- }
-
-- log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
-+ log_info ("DHCPACK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
-
- lease = packet_to_lease (packet, client);
- if (!lease) {
-@@ -2010,7 +2052,7 @@ void dhcpnak (packet)
- return;
- }
-
-- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr));
-+ log_info ("DHCPNAK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
-
- if (!client -> active) {
- #if defined (DEBUG)
-@@ -2136,10 +2178,10 @@ void send_discover (cpp)
- client -> packet.secs = htons (65535);
- client -> secs = client -> packet.secs;
-
-- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld",
-+ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=0x%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);
-
- /* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
-@@ -2394,10 +2436,10 @@ void send_request (cpp)
- client -> packet.secs = htons (65535);
- }
-
-- log_info ("DHCPREQUEST on %s to %s port %d",
-+ log_info ("DHCPREQUEST on %s to %s port %d (xid=0x%x)",
- client -> name ? client -> name : client -> interface -> name,
- inet_ntoa (destination.sin_addr),
-- ntohs (destination.sin_port));
-+ ntohs (destination.sin_port), client -> xid);
-
- if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
- fallback_interface)
-@@ -2427,10 +2469,10 @@ void send_decline (cpp)
-
- int result;
-
-- log_info ("DHCPDECLINE on %s to %s port %d",
-+ log_info ("DHCPDECLINE on %s to %s port %d (xid=0x%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);
-
- /* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
-@@ -2470,10 +2512,10 @@ void send_release (cpp)
- return;
- }
-
-- log_info ("DHCPRELEASE on %s to %s port %d",
-+ log_info ("DHCPRELEASE on %s to %s port %d (xid=0x%x)",
- client -> name ? client -> name : client -> interface -> name,
- inet_ntoa (destination.sin_addr),
-- ntohs (destination.sin_port));
-+ ntohs (destination.sin_port), client -> xid);
-
- if (fallback_interface)
- result = send_packet (fallback_interface,
+From 37a9ded0038fe29f26377c40e080634534d97d0e Mon Sep 17 00:00:00 2001
+From: Alexey Shvetsov <alexxy@gentoo.org>
+Date: Thu, 15 Mar 2012 22:54:15 +0400
+Subject: [PATCH 1/3] improved xid
+
+---
+ client/dhclient.c | 62 +++++++++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 51 insertions(+), 11 deletions(-)
+
+diff --git a/client/dhclient.c b/client/dhclient.c
+index 48707d1..f72e0da 100644
+--- a/client/dhclient.c
++++ b/client/dhclient.c
+@@ -540,6 +540,26 @@ main(int argc, char **argv) {
+ }
+ }
+
++ /* 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 = 0;
++ for (ip = interfaces; ip; ip = ip -> next) {
++ int junk;
++ if ( ip -> hw_address.hlen <= sizeof seed )
++ continue;
++ memcpy (&junk,
++ &ip -> hw_address.hbuf [ip -> hw_address.hlen -
++ sizeof seed], sizeof seed);
++ backup_seed = 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
+@@ -554,14 +574,34 @@ main(int argc, char **argv) {
+ Not much entropy, but we're booting, so we're not likely to
+ find anything better. */
+ seed = 0;
++ int seed_flag = 0;
+ for (ip = interfaces; ip; ip = ip->next) {
+ int junk;
++ if ( ip -> hw_address.hlen <= sizeof seed )
++ continue;
+ memcpy(&junk,
+ &ip->hw_address.hbuf[ip->hw_address.hlen -
+ sizeof seed], sizeof seed);
+ seed += junk;
++ seed_flag = 1;
+ }
+- srandom(seed + cur_time + (unsigned)getpid());
++ if ( seed_flag == 0 ) {
++ if ( backup_seed != 0 ) {
++ seed = backup_seed;
++ log_info ("xid: rand init seed (0x%x) built using all"
++ " available interfaces",seed);
++ } else {
++ seed = 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 + (unsigned)getpid());
+
+ /* Start a configuration state machine for each interface. */
+ #ifdef DHCPv6
+@@ -1053,7 +1093,7 @@ void dhcpack (packet)
+ return;
+ }
+
+- log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
++ log_info ("DHCPACK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
+
+ lease = packet_to_lease (packet, client);
+ if (!lease) {
+@@ -1769,7 +1809,7 @@ void dhcpnak (packet)
+ return;
+ }
+
+- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr));
++ log_info ("DHCPNAK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
+
+ if (!client -> active) {
+ #if defined (DEBUG)
+@@ -1895,10 +1935,10 @@ void send_discover (cpp)
+ client -> packet.secs = htons (65535);
+ client -> secs = client -> packet.secs;
+
+- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld",
++ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=0x%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);
+
+ /* Send out a packet. */
+ result = send_packet (client -> interface, (struct packet *)0,
+@@ -2162,10 +2202,10 @@ void send_request (cpp)
+ client -> packet.secs = htons (65535);
+ }
+
+- log_info ("DHCPREQUEST on %s to %s port %d",
++ log_info ("DHCPREQUEST on %s to %s port %d (xid=0x%x)",
+ client -> name ? client -> name : client -> interface -> name,
+ inet_ntoa (destination.sin_addr),
+- ntohs (destination.sin_port));
++ ntohs (destination.sin_port), client -> xid);
+
+ if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
+ fallback_interface)
+@@ -2196,10 +2236,10 @@ void send_decline (cpp)
+
+ int result;
+
+- log_info ("DHCPDECLINE on %s to %s port %d",
++ log_info ("DHCPDECLINE on %s to %s port %d (xid=0x%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);
+
+ /* Send out a packet. */
+ result = send_packet (client -> interface, (struct packet *)0,
+@@ -2239,10 +2279,10 @@ void send_release (cpp)
+ return;
+ }
+
+- log_info ("DHCPRELEASE on %s to %s port %d",
++ log_info ("DHCPRELEASE on %s to %s port %d (xid=0x%x)",
+ client -> name ? client -> name : client -> interface -> name,
+ inet_ntoa (destination.sin_addr),
+- ntohs (destination.sin_port));
++ ntohs (destination.sin_port), client -> xid);
+
+ if (fallback_interface)
+ result = send_packet (fallback_interface,
+--
+1.7.9.3
+
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
index 52a7aa8..ac5fa83 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch
@@ -1,538 +1,536 @@
-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 <net/if.h>
-+#include <ifaddrs.h>
-
- #ifndef PACKET_AUXDATA
- #define PACKET_AUXDATA 8
-@@ -59,6 +60,15 @@ struct tpacket_auxdata
- /* Reinitializes the specified interface after an address change. This
- is not required for packet-filter APIs. */
-
-+/* Default broadcast address for IPoIB */
-+static unsigned char default_ib_bcast_addr[20] = {
-+ 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;
-
- /* Make an LPF socket. */
-- if ((sock = socket(PF_PACKET, SOCK_RAW,
-- htons((short)ETH_P_ALL))) < 0) {
-+ get_hw_addr(info);
-+
-+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ type = SOCK_DGRAM;
-+ protocol = ETHERTYPE_IP;
-+ } else {
-+ type = SOCK_RAW;
-+ protocol = ETH_P_ALL;
-+ }
-+
-+ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
- errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
- errno == EAFNOSUPPORT || errno == EINVAL) {
-@@ -111,6 +132,7 @@ int if_register_lpf (info)
- /* Bind to the interface name */
- memset (&sa, 0, sizeof sa);
- sa.ll.sll_family = AF_PACKET;
-+ sa.ll.sll_protocol = htons(protocol);
- sa.ll.sll_ifindex = ifr.ifr_ifindex;
- if (bind (sock, &sa.common, sizeof sa)) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
-@@ -126,8 +148,6 @@ int if_register_lpf (info)
- log_fatal ("Bind socket to interface: %m");
- }
-
-- 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;
-
- #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 = if_register_lpf (info);
-
-- val = 1;
-- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
-- sizeof val) < 0) {
-- if (errno != ENOPROTOOPT)
-- log_fatal ("Failed to set auxiliary packet data: %m");
-+ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) {
-+ val = 1;
-+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA,
-+ &val, sizeof val) < 0) {
-+ if (errno != ENOPROTOOPT)
-+ log_fatal ("Failed to set auxiliary packet data: %m");
-+ }
- }
-
- #if defined (HAVE_TR_SUPPORT)
-@@ -249,15 +273,28 @@ static void lpf_gen_filter_setup (info)
-
- memset(&p, 0, sizeof(p));
-
-- /* Set up the bpf filter program structure. This is defined in
-- bpf.c */
-- p.len = dhcp_bpf_filter_len;
-- p.filter = 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 = ntohs ((short)local_port);
-+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ /* Set up the bpf filter program structure. */
-+ p.len = dhcp_ib_bpf_filter_len;
-+ p.filter = 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 = ntohs ((short)local_port);
-+ } else {
-+ /* Set up the bpf filter program structure.
-+ This is defined in bpf.c */
-+ p.len = dhcp_bpf_filter_len;
-+ p.filter = 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 = ntohs ((short)local_port);
-+ }
-
- 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 */
-
- #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 = 0;
-+ double ih [1536 / sizeof (double)];
-+ unsigned char *buf = (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 = AF_PACKET;
-+ su.sll.sll_protocol = htons(ETHERTYPE_IP);
-+
-+ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) {
-+ errno = ENOENT;
-+ log_error ("send_packet_ib: %m - failed to get if index");
-+ return -1;
-+ }
-+
-+ su.sll.sll_hatype = htons(HTYPE_INFINIBAND);
-+ su.sll.sll_halen = sizeof(interface->bcast_addr);
-+ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20);
-+
-+ result = 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,
- return send_fallback (interface, packet, raw,
- len, from, to, hto);
-
-+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ return send_packet_ib(interface, packet, raw, len, from,
-+ to, hto);
-+ }
-+
- if (hto == NULL && interface->anycast_mac_addr.hlen)
- hto = &interface->anycast_mac_addr;
-
-@@ -355,6 +445,42 @@ ssize_t send_packet (interface, packet,
- #endif /* USE_LPF_SEND */
-
- #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 = 0;
-+ int offset = 0;
-+ unsigned char ibuf [1536];
-+ unsigned bufix = 0;
-+ unsigned paylen;
-+
-+ length = read(interface->rfdesc, ibuf, sizeof(ibuf));
-+
-+ if (length <= 0)
-+ return length;
-+
-+ offset = decode_udp_ip_header(interface, ibuf, bufix, from,
-+ (unsigned)length, &paylen, 0);
-+
-+ if (offset < 0)
-+ return 0;
-+
-+ bufix += offset;
-+ length -= 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,
- };
- struct cmsghdr *cmsg;
-
-+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ return receive_packet_ib(interface, buf, len, from, hfrom);
-+ }
-+
- length = recvmsg (interface -> rfdesc, &msg, 0);
- if (length <= 0)
- return length;
-@@ -461,33 +591,41 @@ void maybe_setup_fallback ()
- }
-
- 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 = &info->hw_address;
-+ char *name = info->name;
-+ struct ifaddrs *ifaddrs;
-+ struct ifaddrs *ifa;
-+ struct sockaddr_ll *sll = NULL;
-
-- if (strlen(name) >= sizeof(tmp.ifr_name)) {
-- log_fatal("Device name too long: \"%s\"", name);
-- }
-+ if (getifaddrs(&ifaddrs) == -1)
-+ log_fatal("Failed to get interfaces");
-+
-+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
-+
-+ if (ifa->ifa_addr->sa_family != AF_PACKET)
-+ continue;
-
-- sock = 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) == 0) {
-+ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr;
-+ break;
-+ }
- }
-
-- 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",
-- name);
-+ if (sll == NULL) {
-+ freeifaddrs(ifaddrs);
-+ log_fatal("Failed to get HW address for %s\n", name);
- }
-
-- sa = &tmp.ifr_hwaddr;
-- switch (sa->sa_family) {
-+ switch (sll->sll_hatype) {
- case ARPHRD_ETHER:
- hw->hlen = 7;
- hw->hbuf[0] = 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 = 7;
- hw->hbuf[0] = HTYPE_IEEE802;
-- memcpy(&hw->hbuf[1], sa->sa_data, 6);
-+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
- break;
- case ARPHRD_FDDI:
- hw->hlen = 17;
- hw->hbuf[0] = 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 = (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 = 1;
-+ hw->hbuf[0] = 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);
- }
-
-- 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 */
-
- /* 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);
-
- static isc_result_t write_duid(struct data_string *duid);
-
-+static void setup_ib_interface(struct interface_info *ip)
-+{
-+ struct group *g;
-+
-+ /* Set the broadcast flag */
-+ ip->client->config->bootp_broadcast_always = 1;
-+
-+ /*
-+ * Find out if a dhcp-client-identifier option was specified either
-+ * in the config file or on the command line
-+ */
-+ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) {
-+ if ((g->statements != NULL) &&
-+ (strcmp(g->statements->data.option->option->name,
-+ "dhcp-client-identifier") == 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);
-
-+ /* Setup specific Infiniband options */
-+ for (ip = interfaces; ip; ip = ip->next) {
-+ if (ip->client &&
-+ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
-+ setup_ib_interface(ip);
-+ }
-+ }
-+
- /* Start a configuration state machine for each interface. */
- #ifdef DHCPv6
- if (local_family == 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);
-
-- get_hw_addr(info->name, &info->hw_address);
-+ get_hw_addr(info);
-
- return sock;
- }
-@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
- BPF_STMT(BPF_RET+BPF_K, 0),
- };
-
-+/* Packet filter program for DHCP over Infiniband.
-+ *
-+ * XXX
-+ * Changes to the filter program may require changes to the constant offsets
-+ * used in lpf_gen_filter_setup to patch the port in the BPF program!
-+ * XXX
-+ */
-+struct bpf_insn dhcp_ib_bpf_filter [] = {
-+ /* 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
-
- int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn);
-+int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn);
-+
- #if defined (HAVE_TR_SUPPORT)
- struct bpf_insn dhcp_bpf_tr_filter [] = {
- /* accept all token ring packets due to variable length header */
-@@ -552,7 +585,9 @@ void maybe_setup_fallback ()
- }
-
- void
--get_hw_addr(const char *name, struct hardware *hw) {
-+get_hw_addr(struct interface_info *info) {
-+ struct hardware *hw = &info->hw_address;
-+ char *name = 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
-
- /* If this is a normal IPv4 address, get the hardware address. */
- if ((local_family == AF_INET) && (strcmp(info->name, "fallback") != 0))
-- get_hw_addr(info->name, &info->hw_address);
-+ get_hw_addr(info);
-
- return sock;
- }
-@@ -429,7 +429,7 @@ if_register6(struct interface_info *info
- if (req_multi)
- if_register_multicast(info);
-
-- get_hw_addr(info->name, &info->hw_address);
-+ get_hw_addr(info);
-
- if (!quiet_interface_discovery) {
- if (info->shared_network != 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);
-
--void get_hw_addr(const char *name, struct hardware *hw);
-+void get_hw_addr(struct interface_info *info);
-
- /* 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 */
-
- void
--get_hw_addr(const char *name, struct hardware *hw) {
-+get_hw_addr(struct interface_info *info) {
-+ struct hardware *hw = &info->hw_address;
-+ char *name = info->name;
- int sock, unit;
- long buf[DLPI_MAXDLBUF];
- union DL_primitives *dlp;
+From fbc0a6667fe7ca44a5185b00be2c0cbfae10d61d Mon Sep 17 00:00:00 2001
+From: Alexey Shvetsov <alexxy@gentoo.org>
+Date: Thu, 15 Mar 2012 23:18:21 +0400
+Subject: [PATCH 2/3] lpf ib
+
+---
+ client/dhclient.c | 31 ++++++++
+ common/bpf.c | 39 +++++++++-
+ common/dlpi.c | 4 +-
+ common/lpf.c | 225 ++++++++++++++++++++++++++++++++++++++++++++---------
+ common/socket.c | 4 +-
+ includes/dhcp.h | 1 +
+ includes/dhcpd.h | 3 +-
+ 7 files changed, 266 insertions(+), 41 deletions(-)
+
+diff --git a/client/dhclient.c b/client/dhclient.c
+index f72e0da..138b563 100644
+--- a/client/dhclient.c
++++ b/client/dhclient.c
+@@ -100,6 +100,29 @@ static int check_domain_name_list(const char *ptr, size_t len, int dots);
+ static int check_option_values(struct universe *universe, unsigned int opt,
+ const char *ptr, size_t len);
+
++static void setup_ib_interface(struct interface_info *ip)
++{
++ struct group *g;
++
++ /* Set the broadcast flag */
++ ip->client->config->bootp_broadcast_always = 1;
++
++ /*
++ * Find out if a dhcp-client-identifier option was specified either
++ * in the config file or on the command line
++ */
++ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) {
++ if ((g->statements != NULL) &&
++ (strcmp(g->statements->data.option->option->name,
++ "dhcp-client-identifier") == 0)) {
++ return;
++ }
++ }
++
++ /* No client ID specified */
++ log_fatal("dhcp-client-identifier must be specified for InfiniBand");
++}
++
+ int
+ main(int argc, char **argv) {
+ int fd;
+@@ -603,6 +626,14 @@ main(int argc, char **argv) {
+ } else
+ srandom(seed + cur_time + (unsigned)getpid());
+
++ /* Setup specific Infiniband options */
++ for (ip = interfaces; ip; ip = ip->next) {
++ if (ip->client &&
++ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
++ setup_ib_interface(ip);
++ }
++ }
++
+ /* Start a configuration state machine for each interface. */
+ #ifdef DHCPv6
+ if (local_family == AF_INET6) {
+diff --git a/common/bpf.c b/common/bpf.c
+index b0ef657..90289ec 100644
+--- a/common/bpf.c
++++ b/common/bpf.c
+@@ -116,7 +116,7 @@ int if_register_bpf (info)
+ log_fatal ("Can't attach interface %s to bpf device %s: %m",
+ info -> name, filename);
+
+- get_hw_addr(info->name, &info->hw_address);
++ get_hw_addr(info);
+
+ return sock;
+ }
+@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
+ BPF_STMT(BPF_RET+BPF_K, 0),
+ };
+
++/* Packet filter program for DHCP over Infiniband.
++ *
++ * XXX
++ * Changes to the filter program may require changes to the constant offsets
++ * used in lpf_gen_filter_setup to patch the port in the BPF program!
++ * XXX
++ */
++struct bpf_insn dhcp_ib_bpf_filter [] = {
++ /* 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
+
+ int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn);
++int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn);
++
+ #if defined (HAVE_TR_SUPPORT)
+ struct bpf_insn dhcp_bpf_tr_filter [] = {
+ /* accept all token ring packets due to variable length header */
+@@ -552,7 +585,9 @@ void maybe_setup_fallback ()
+ }
+
+ void
+-get_hw_addr(const char *name, struct hardware *hw) {
++get_hw_addr(struct interface_info *info) {
++ struct hardware *hw = &info->hw_address;
++ char *name = info->name;
+ struct ifaddrs *ifa;
+ struct ifaddrs *p;
+ struct sockaddr_dl *sa;
+diff --git a/common/dlpi.c b/common/dlpi.c
+index 8f2c73d..619271f 100644
+--- a/common/dlpi.c
++++ b/common/dlpi.c
+@@ -1332,7 +1332,9 @@ void maybe_setup_fallback ()
+ #endif /* USE_DLPI_SEND */
+
+ void
+-get_hw_addr(const char *name, struct hardware *hw) {
++get_hw_addr(struct interface_info *info) {
++ struct hardware *hw = &info->hw_address;
++ char *name = info->name;
+ int sock, unit;
+ long buf[DLPI_MAXDLBUF];
+ union DL_primitives *dlp;
+diff --git a/common/lpf.c b/common/lpf.c
+index 16eecc9..488df88 100644
+--- a/common/lpf.c
++++ b/common/lpf.c
+@@ -41,10 +41,20 @@
+ #include "includes/netinet/udp.h"
+ #include "includes/netinet/if_ether.h"
+ #include <net/if.h>
++#include <ifaddrs.h>
+
+ /* Reinitializes the specified interface after an address change. This
+ is not required for packet-filter APIs. */
+
++/* Default broadcast address for IPoIB */
++static unsigned char default_ib_bcast_addr[20] = {
++ 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;
+@@ -67,11 +77,22 @@ int if_register_lpf (info)
+ struct interface_info *info;
+ {
+ int sock;
++ int type;
++ int protocol;
+ struct sockaddr sa;
+
+ /* Make an LPF socket. */
+- if ((sock = socket(PF_PACKET, SOCK_PACKET,
+- htons((short)ETH_P_ALL))) < 0) {
++ get_hw_addr(info);
++
++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ type = SOCK_DGRAM;
++ protocol = ETHERTYPE_IP;
++ } else {
++ type = SOCK_RAW;
++ protocol = ETH_P_ALL;
++ }
++
++ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ errno == EAFNOSUPPORT || errno == EINVAL) {
+@@ -88,6 +109,7 @@ int if_register_lpf (info)
+ /* Bind to the interface name */
+ memset (&sa, 0, sizeof sa);
+ sa.sa_family = AF_PACKET;
++ sa.ll.sll_protocol = htons(protocol);
+ strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
+ if (bind (sock, &sa, sizeof sa)) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+@@ -103,8 +125,6 @@ int if_register_lpf (info)
+ log_fatal ("Bind socket to interface: %m");
+ }
+
+- get_hw_addr(info->name, &info->hw_address);
+-
+ return sock;
+ }
+ #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */
+@@ -159,6 +179,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;
+
+ #if defined (HAVE_TR_SUPPORT)
+ extern struct sock_filter dhcp_bpf_tr_filter [];
+@@ -217,15 +239,28 @@ static void lpf_gen_filter_setup (info)
+
+ memset(&p, 0, sizeof(p));
+
+- /* Set up the bpf filter program structure. This is defined in
+- bpf.c */
+- p.len = dhcp_bpf_filter_len;
+- p.filter = 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 = ntohs ((short)local_port);
++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ /* Set up the bpf filter program structure. */
++ p.len = dhcp_ib_bpf_filter_len;
++ p.filter = 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 = ntohs ((short)local_port);
++ } else {
++ /* Set up the bpf filter program structure.
++ This is defined in bpf.c */
++ p.len = dhcp_bpf_filter_len;
++ p.filter = 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 = ntohs ((short)local_port);
++ }
+
+ if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p,
+ sizeof p) < 0) {
+@@ -282,6 +317,54 @@ static void lpf_tr_filter_setup (info)
+ #endif /* USE_LPF_RECEIVE */
+
+ #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 = 0;
++ double ih [1536 / sizeof (double)];
++ unsigned char *buf = (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 = AF_PACKET;
++ su.sll.sll_protocol = htons(ETHERTYPE_IP);
++
++ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) {
++ errno = ENOENT;
++ log_error ("send_packet_ib: %m - failed to get if index");
++ return -1;
++ }
++
++ su.sll.sll_hatype = htons(HTYPE_INFINIBAND);
++ su.sll.sll_halen = sizeof(interface->bcast_addr);
++ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20);
++
++ result = 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;
+@@ -303,6 +386,11 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
+ return send_fallback (interface, packet, raw,
+ len, from, to, hto);
+
++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ return send_packet_ib(interface, packet, raw, len, from,
++ to, hto);
++ }
++
+ if (hto == NULL && interface->anycast_mac_addr.hlen)
+ hto = &interface->anycast_mac_addr;
+
+@@ -334,6 +422,46 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
+ #endif /* USE_LPF_SEND */
+
+ #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 = 0;
++ int offset = 0;
++ unsigned char ibuf [1536];
++ unsigned bufix = 0;
++ unsigned paylen;
++
++ length = read(interface->rfdesc, ibuf, sizeof(ibuf));
++
++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ return receive_packet_ib(interface, buf, len, from, hfrom);
++ }
++
++ if (length <= 0)
++ return length;
++
++ offset = decode_udp_ip_header(interface, ibuf, bufix, from,
++ (unsigned)length, &paylen, 0);
++
++ if (offset < 0)
++ return 0;
++
++ bufix += offset;
++ length -= 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;
+@@ -419,33 +547,42 @@ void maybe_setup_fallback ()
+ }
+
+ 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 = &info->hw_address;
++ char *name = info->name;
++ struct ifaddrs *ifaddrs;
++ struct ifaddrs *ifa;
++ struct sockaddr_ll *sll = NULL;
+
+- if (strlen(name) >= sizeof(tmp.ifr_name)) {
+- log_fatal("Device name too long: \"%s\"", name);
+- }
++ if (getifaddrs(&ifaddrs) == -1)
++ log_fatal("Failed to get interfaces");
++
++ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+
+- sock = socket(AF_INET, SOCK_DGRAM, 0);
+- if (sock < 0) {
+- log_fatal("Can't create socket for \"%s\": %m", name);
++ if (ifa->ifa_addr->sa_family != AF_PACKET)
++ continue;
++
++ if (ifa->ifa_flags & IFF_LOOPBACK)
++ continue;
++
++ if (strcmp(ifa->ifa_name, name) == 0) {
++ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr;
++ break;
++ }
+ }
+
+- 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",
+- name);
++ if (sll == NULL) {
++ freeifaddrs(ifaddrs);
++ log_fatal("Failed to get HW address for %s\n", name);
++
+ }
+
+- sa = &tmp.ifr_hwaddr;
+- switch (sa->sa_family) {
++ switch (sll->sll_hatype) {
+ case ARPHRD_ETHER:
+ hw->hlen = 7;
+ hw->hbuf[0] = 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
+@@ -453,18 +590,36 @@ get_hw_addr(const char *name, struct hardware *hw) {
+ #endif /* ARPHRD_IEEE802_TR */
+ hw->hlen = 7;
+ hw->hbuf[0] = HTYPE_IEEE802;
+- memcpy(&hw->hbuf[1], sa->sa_data, 6);
++ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
+ break;
+ case ARPHRD_FDDI:
+ hw->hlen = 17;
+ hw->hbuf[0] = 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 = (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 = 1;
++ hw->hbuf[0] = 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);
+ }
+
+- close(sock);
++ freeifaddrs(ifaddrs);
+ }
+ #endif
+diff --git a/common/socket.c b/common/socket.c
+index a48404b..3fe8b75 100644
+--- a/common/socket.c
++++ b/common/socket.c
+@@ -324,7 +324,7 @@ void if_register_send (info)
+ info->wfdesc = if_register_socket(info, AF_INET, 0);
+ /* If this is a normal IPv4 address, get the hardware address. */
+ if (strcmp(info->name, "fallback") != 0)
+- get_hw_addr(info->name, &info->hw_address);
++ get_hw_addr(info);
+ #if defined (USE_SOCKET_FALLBACK)
+ /* Fallback only registers for send, but may need to receive as
+ well. */
+@@ -497,7 +497,7 @@ if_register6(struct interface_info *info, int do_multicast) {
+ if (req_multi)
+ if_register_multicast(info);
+
+- get_hw_addr(info->name, &info->hw_address);
++ get_hw_addr(info);
+
+ if (!quiet_interface_discovery) {
+ if (info->shared_network != NULL) {
+diff --git a/includes/dhcp.h b/includes/dhcp.h
+index 1af2adf..722c661 100644
+--- a/includes/dhcp.h
++++ b/includes/dhcp.h
+@@ -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 */
+
+ /* Magic cookie validating dhcp options field (and bootp vendor
+ extensions field). */
+diff --git a/includes/dhcpd.h b/includes/dhcpd.h
+index 863a149..5a137e6 100644
+--- a/includes/dhcpd.h
++++ b/includes/dhcpd.h
+@@ -1239,6 +1239,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.
+ */
+@@ -2355,7 +2356,7 @@ void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
+ #endif
+ const char *print_time(TIME);
+
+-void get_hw_addr(const char *name, struct hardware *hw);
++void get_hw_addr(struct interface_info *info);
+
+ /* socket.c */
+ #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
+--
+1.7.9.3
+
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
deleted file mode 100644
index fe33bdf..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.0-xen-checksum.patch
+++ /dev/null
@@ -1,245 +0,0 @@
-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,
- offset = decode_udp_ip_header (interface,
- interface -> rbuf,
- interface -> rbuf_offset,
-- from, hdr.bh_caplen, &paylen);
-+ from, hdr.bh_caplen, &paylen, 0);
-
- /* 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,
- length -= offset;
- #endif
- offset = decode_udp_ip_header (interface, dbuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
-
- /*
- * 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 <sys/ioctl.h>
-+#include <sys/socket.h>
- #include <sys/uio.h>
- #include <errno.h>
-
- #include <asm/types.h>
- #include <linux/filter.h>
- #include <linux/if_ether.h>
-+#include <linux/if_packet.h>
- #include <netinet/in_systm.h>
- #include "includes/netinet/ip.h"
- #include "includes/netinet/udp.h"
- #include "includes/netinet/if_ether.h"
- #include <net/if.h>
-
-+#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. This
- is not required for packet-filter APIs. */
-
-@@ -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;
-
- /* Make an LPF socket. */
-- if ((sock = socket(PF_PACKET, SOCK_PACKET,
-+ if ((sock = socket(PF_PACKET, SOCK_RAW,
- htons((short)ETH_P_ALL))) < 0) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
- errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
-@@ -84,11 +103,16 @@ int if_register_lpf (info)
- log_fatal ("Open a socket for LPF: %m");
- }
-
-+ 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 = AF_PACKET;
-- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
-- if (bind (sock, &sa, sizeof sa)) {
-+ sa.ll.sll_family = AF_PACKET;
-+ sa.ll.sll_ifindex = ifr.ifr_ifindex;
-+ if (bind (sock, &sa.common, sizeof sa)) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
- errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
- errno == EAFNOSUPPORT || errno == 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 = if_register_lpf (info);
-
-+ val = 1;
-+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
-+ sizeof val) < 0) {
-+ if (errno != ENOPROTOOPT)
-+ log_fatal ("Failed to set auxiliary packet data: %m");
-+ }
-+
- #if defined (HAVE_TR_SUPPORT)
- if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
- lpf_tr_filter_setup (info);
-@@ -294,7 +327,6 @@ ssize_t send_packet (interface, packet,
- double hh [16];
- double ih [1536 / sizeof (double)];
- unsigned char *buf = (unsigned char *)ih;
-- struct sockaddr sa;
- int result;
- int fudge;
-
-@@ -315,15 +347,7 @@ ssize_t send_packet (interface, packet,
- (unsigned char *)raw, len);
- memcpy (buf + ibufp, raw, len);
-
-- /* 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 = AF_PACKET;
-- strncpy (sa.sa_data,
-- (const char *)interface -> ifp, sizeof sa.sa_data);
--
-- result = sendto (interface -> wfdesc,
-- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
-+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
- if (result < 0)
- log_error ("send_packet: %m");
- return result;
-@@ -340,14 +364,35 @@ ssize_t receive_packet (interface, buf,
- {
- int length = 0;
- int offset = 0;
-+ int nocsum = 0;
- unsigned char ibuf [1536];
- unsigned bufix = 0;
- unsigned paylen;
-+ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
-+ struct iovec iov = {
-+ .iov_base = ibuf,
-+ .iov_len = sizeof ibuf,
-+ };
-+ struct msghdr msg = {
-+ .msg_iov = &iov,
-+ .msg_iovlen = 1,
-+ .msg_control = cmsgbuf,
-+ .msg_controllen = sizeof(cmsgbuf),
-+ };
-+ struct cmsghdr *cmsg;
-
-- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
-+ length = recvmsg (interface -> rfdesc, &msg, 0);
- if (length <= 0)
- return length;
-
-+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-+ if (cmsg->cmsg_level == SOL_PACKET &&
-+ cmsg->cmsg_type == PACKET_AUXDATA) {
-+ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
-+ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
-+ }
-+ }
-+
- bufix = 0;
- /* Decode the physical header... */
- offset = decode_hw_header (interface, ibuf, bufix, hfrom);
-@@ -364,7 +409,7 @@ ssize_t receive_packet (interface, buf,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix, from,
-- (unsigned)length, &paylen);
-+ (unsigned)length, &paylen, nocsum);
-
- /* 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,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
-
- /* 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))));
-
- udp_packets_seen++;
-- if (usum && usum != sum) {
-+ if (!nocsum && usum && usum != 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,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
-
- /* 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
- unsigned, struct hardware *));
- ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- unsigned, struct sockaddr_in *,
-- unsigned, unsigned *));
-+ unsigned, unsigned *, int));
-
- /* ethernet.c */
- void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch
new file mode 100644
index 0000000..ae33638
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch
@@ -0,0 +1,14 @@
+bind sets up BUILD_XXX vars for building native tools, but then
+doesn't use them for the "gen" tool
+
+--- a/bind/lib/export/dns/Makefile.in
++++ b/bind/lib/export/dns/Makefile.in
+@@ -166,7 +166,7 @@
+ ./gen -s ${srcdir} > code.h
+
+ gen: ${srcdir}/gen.c
+- ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS}
++ ${BUILD_CC} ${BUILD_CFLAGS} ${CINCLUDES} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c ${BUILD_LIBS}
+
+ #We don't need rbtdb64 for this library
+ #rbtdb64.@O@: rbtdb.c
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch
new file mode 100644
index 0000000..4c7810e
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch
@@ -0,0 +1,13 @@
+we take care of building this ourselves in the ebuild so
+build settings are properly respected
+
+--- dhcp-4.2.2/bind/Makefile
++++ dhcp-4.2.2/bind/Makefile
+@@ -29,6 +29,7 @@
+ bindsrcdir=bind-${version}
+
+ all:
++disable:
+ # Extract the source from the tarball, if it hasn't been already.
+ @if test -d ${bindsrcdir} ; then \
+ echo ${bindsrcdir} already unpacked... ; \
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch
new file mode 100644
index 0000000..6136154
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch
@@ -0,0 +1,14 @@
+fix the bind subdir parallel builds
+
+https://bugs.gentoo.org/380717
+
+--- a/bind/lib/export/isc/Makefile.in
++++ b/bind/lib/export/isc/Makefile.in
+@@ -114,6 +114,7 @@
+ -DLIBAGE=${LIBAGE} \
+ -c ${srcdir}/version.c
+
++${OBJS}: | subdirs
+ libisc.@SA@: ${OBJS}
+ ${AR} ${ARFLAGS} $@ ${OBJS}
+ ${RANLIB} $@
diff --git a/net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch
similarity index 85%
rename from net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch
rename to net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch
index 6d8caec..95a0d65 100644
--- a/net-misc/dhcp/files/dhcp-4.2.1-dhclient-resolvconf.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch
@@ -1,6 +1,6 @@
--- a/client/scripts/bsdos
+++ b/client/scripts/bsdos
-@@ -1,34 +1,41 @@
+@@ -1,40 +1,46 @@
#!/bin/sh
make_resolv_conf() {
@@ -35,8 +35,15 @@
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
fi
for nameserver in ${new_dhcp6_name_servers} ; do
-- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}\n"
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id='';;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
done
+ fi
@@ -50,13 +57,11 @@
+ 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 @@
+@@ -11,73 +11,45 @@
fi
make_resolv_conf() {
@@ -122,7 +127,14 @@
- if [ $exit_status -ne 0 ] ; then
- break
- fi
-- ( echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 )
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id='';;
+ esac
+- ( echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6 )
- exit_status=$?
- done
-
@@ -134,7 +146,7 @@
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
-+ conf="${conf}nameserver ${nameserver}\n"
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
+ done
+ fi
@@ -150,13 +162,10 @@
+ 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 @@
+@@ -26,44 +26,49 @@
ip=/sbin/ip
make_resolv_conf() {
@@ -193,10 +202,20 @@
- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
fi
+ shopt -s nocasematch
for nameserver in ${new_dhcp6_name_servers} ; do
-- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}\n"
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ if [[ "$nameserver" =~ ^fe80:: ]]
+ then
+ zone_id="%$interface"
+ else
+ zone_id=
+ fi
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
done
+ shopt -u nocasematch
+ fi
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
@@ -209,13 +228,11 @@
+ 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 @@
+@@ -1,40 +1,46 @@
#!/bin/sh
make_resolv_conf() {
@@ -253,8 +270,15 @@
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
fi
for nameserver in ${new_dhcp6_name_servers} ; do
-- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}\n"
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id='';;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
done
+ fi
@@ -268,17 +292,15 @@
+ 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 @@
+@@ -1,40 +1,46 @@
#!/bin/sh
make_resolv_conf() {
-- if x"$new_domain_name_servers" != x ]; then
+- if [ x"$new_domain_name_servers" != x ]; then
- cat /dev/null > /etc/resolv.conf.dhclient
- if [ x"$new_domain_search" != x ]; then
- echo search $new_domain_search >> /etc/resolv.conf.dhclient
@@ -302,7 +324,7 @@
+ conf="${conf}nameserver ${nameserver}\n"
done
-
-- mv /etc/ersolv.conf.dhclient /etc/resolv.conf
+- mv /etc/resolv.conf.dhclient /etc/resolv.conf
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
- cat /dev/null > /etc/resolv.conf.dhclient6
- chmod 644 /etc/resolv.conf.dhclient6
@@ -312,8 +334,15 @@
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
fi
for nameserver in ${new_dhcp6_name_servers} ; do
-- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}\n"
+ # If the nameserver has a link-local address
+ # add a <zone_id> (interface name) to it.
+ case $nameserver in
+ fe80:*) zone_id="%$interface";;
+ FE80:*) zone_id="%$interface";;
+ *) zone_id='';;
+ esac
+- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
++ conf="${conf}nameserver ${nameserver}$zone_id\n"
done
+ fi
@@ -327,13 +356,11 @@
+ 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 @@
+@@ -1,21 +1,39 @@
#!/bin/sh
make_resolv_conf() {
@@ -378,7 +405,5 @@
+ chmod 644 /etc/resolv.conf
+ fi
fi
-+
- # If we're making confs, may as well make an ntp.conf too
- make_ntp_conf
}
+
diff --git a/net-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
similarity index 83%
rename from net-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch
rename to net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
index ddbe4a3..bf5a54c 100644
--- a/net-misc/dhcp/files/dhcp-4.0.1-dhclient-stdin-conf.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
@@ -1,18 +1,17 @@
-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 @@
+--- dhcp-4.2.2/client/clparse.c
++++ dhcp-4.2.2/client/clparse.c
+@@ -182,6 +182,10 @@ isc_result_t read_client_conf ()
#endif
}
-+ /* Read any extra configuration from stdin */
-+ read_client_conf_stdin ((struct interface_info *)0,
-+ &top_level_config);
++ /* Read any extra configuration from stdin */
++ extern int read_client_conf_stdin (struct interface_info *ip, struct client_config *client);
++ read_client_conf_stdin (NULL, &top_level_config);
+
/* Set up state and config structures for clients that don't
have per-interface configuration statements. */
config = (struct client_config *)0;
-@@ -203,23 +207,13 @@
+@@ -211,23 +215,13 @@ isc_result_t read_client_conf ()
return status;
}
@@ -25,7 +24,7 @@ diff -uNr dhcp-4.0.1.ORIG/client/clparse.c dhcp-4.0.1/client/clparse.c
const char *val;
int token;
isc_result_t status;
-
+
- if ((file = open (name, O_RDONLY)) < 0)
- return uerr2isc (errno);
-
@@ -37,9 +36,9 @@ diff -uNr dhcp-4.0.1.ORIG/client/clparse.c dhcp-4.0.1/client/clparse.c
do {
token = peek_token (&val, (unsigned *)0, cfile);
if (token == END_OF_FILE)
-@@ -230,10 +224,74 @@
+@@ -238,10 +232,74 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
status = (cfile -> warnings_occurred
- ? ISC_R_BADPARSE
+ ? DHCP_R_BADPARSE
: ISC_R_SUCCESS);
+ return status;
+}
diff --git a/net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch b/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch
similarity index 88%
rename from net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch
rename to net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch
index 11aaace..27fb2b0 100644
--- a/net-misc/dhcp/files/dhcp-4.2.1-nogateway.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch
@@ -1,7 +1,7 @@
http://bugs.gentoo.org/265531
---- dhcp-4.2.1/client/scripts/linux
-+++ dhcp-4.2.1/client/scripts/linux
+--- dhcp-4.2.2/client/scripts/linux
++++ dhcp-4.2.2/client/scripts/linux
@@ -193,12 +193,14 @@
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg $mtu_arg
@@ -20,9 +20,9 @@ http://bugs.gentoo.org/265531
+ route add default gw $router $metric_arg dev $interface
+ done
+ fi
- fi
- if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
- then
+ else
+ # we haven't changed the address, have we changed other options
+ # that we wish to update?
@@ -244,12 +246,14 @@
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address dev $interface:0
diff --git a/net-misc/dhcp/files/dhcpd.conf b/net-misc/dhcp/files/dhcpd.conf2
similarity index 94%
rename from net-misc/dhcp/files/dhcpd.conf
rename to net-misc/dhcp/files/dhcpd.conf2
index 1672633..5cd2eec 100644
--- a/net-misc/dhcp/files/dhcpd.conf
+++ b/net-misc/dhcp/files/dhcpd.conf2
@@ -11,9 +11,8 @@
# 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="/chroot/dhcp"
+# DHCPD_CHROOT="/var/lib/dhcp/chroot"
-# 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.
diff --git a/net-misc/dhcp/files/dhcpd.init3 b/net-misc/dhcp/files/dhcpd.init3
deleted file mode 100755
index 3b00531..0000000
--- a/net-misc/dhcp/files/dhcpd.init3
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init3,v 1.1 2011/03/05 23:59:20 vapier Exp $
-
-opts="configtest"
-
-DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/${SVCNAME}.conf}
-
-depend() {
- need net
- use logger dns
-}
-
-get_var() {
- sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \
- "${DHCPD_CHROOT}/${DHCPD_CONF}"
-}
-
-checkconfig() {
- dhcpd ${DHCPD_OPTS} ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} -t 1>/dev/null 2>&1
- local ret=$?
- if [ $ret -ne 0 ] ; then
- eerror "${SVCNAME} has detected a syntax error in your configuration files:"
- dhcpd ${DHCPD_OPTS} ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} -t
- fi
-
- return $ret
-}
-
-configtest() {
- ebegin "Checking ${SVCNAME} configuration"
- checkconfig
- eend $?
-}
-
-start() {
- # Work out our cffile if it's in our DHCPD_OPTS
- case " ${DHCPD_OPTS} " in
- *" -cf "*)
- DHCPD_CONF=" ${DHCPD_OPTS} "
- DHCPD_CONF="${DHCPD_CONF##* -cf }"
- DHCPD_CONF="${DHCPD_CONF%% *}"
- ;;
- *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
- ;;
- esac
-
- if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then
- eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist"
- return 1
- fi
-
- checkconfig || return 1
-
- checkpath -d -o dhcp:dhcp /var/run/dhcp /var/lib/dhcp
-
- local leasefile="$(get_var lease-file-name)"
- leasefile="${leasefile:-/var/lib/dhcp/${SVCNAME}.leases}"
- if [ ! -f "${DHCPD_CHROOT}${leasefile}" ] ; then
- ebegin "Creating ${leasefile}"
- touch "${DHCPD_CHROOT}${leasefile}"
- chown dhcp:dhcp "${DHCPD_CHROOT}${leasefile}"
- eend $? || return 1
- fi
-
- # Setup LD_PRELOAD so name resolution works in our chroot.
- if [ -n "${DHCPD_CHROOT}" ] ; then
- LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so"
- export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so"
- fi
-
- local pidfile="$(get_var pid-file-name)"
- pidfile="${pidfile:-/var/run/dhcp/${SVCNAME}.pid}"
-
- ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}"
- start-stop-daemon --start --exec /usr/sbin/dhcpd \
- --pidfile "${DHCPD_CHROOT}/${pidfile}" \
- -- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \
- -user dhcp -group dhcp \
- ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} ${DHCPD_IFACE}
- eend $? \
- && save_options chroot "${DHCPD_CHROOT}" \
- && save_options pidfile "${pidfile}"
-}
-
-stop() {
- local chroot="$(get_options chroot)"
-
- ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
- start-stop-daemon --stop --exec /usr/sbin/dhcpd \
- --pidfile "${chroot}/$(get_options pidfile)"
- eend $?
-}
diff --git a/net-misc/dhcp/files/dhcpd.init5 b/net-misc/dhcp/files/dhcpd.init5
new file mode 100755
index 0000000..79c7f2b
--- /dev/null
+++ b/net-misc/dhcp/files/dhcpd.init5
@@ -0,0 +1,114 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init5,v 1.1 2011/12/04 22:45:07 vapier Exp $
+
+extra_commands="configtest"
+
+: ${DHCPD_CONF:=/etc/dhcp/${SVCNAME}.conf}
+
+depend() {
+ need net
+ use logger dns
+}
+
+get_var() {
+ local var="$(sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' "${chroot}${DHCPD_CONF}")"
+ echo ${var:-$2}
+}
+
+checkconfig() {
+ set -- ${DHCPD_OPTS} ${chroot:+-chroot} ${chroot} -t
+
+ dhcpd "$@" 1>/dev/null 2>&1
+ local ret=$?
+ if [ ${ret} -ne 0 ] ; then
+ eerror "${SVCNAME} has detected a syntax error in your configuration files:"
+ dhcpd "$@"
+ fi
+
+ return ${ret}
+}
+
+configtest() {
+ local chroot=${DHCPD_CHROOT%/}
+
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+start() {
+ local chroot=${DHCPD_CHROOT%/}
+
+ # Work out our cffile if it's in our DHCPD_OPTS
+ case " ${DHCPD_OPTS} " in
+ *" -cf "*)
+ DHCPD_CONF=" ${DHCPD_OPTS} "
+ DHCPD_CONF="${DHCPD_CONF##* -cf }"
+ DHCPD_CONF="${DHCPD_CONF%% *}"
+ ;;
+ *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
+ ;;
+ esac
+
+ if [ -n "${chroot}" ] ; then
+ # the config test want's these to exist
+ mkdir -p \
+ "${chroot}"/var/run/dhcp \
+ "${chroot}"/var/lib/dhcp \
+ "${chroot}"/etc/dhcp
+ fi
+
+ # see comment in get_var() above
+ if [ ! -f "${chroot}${DHCPD_CONF}" ] ; then
+ eerror "${chroot}${DHCPD_CONF} does not exist"
+ return 1
+ fi
+
+ checkconfig || return 1
+
+ checkpath -d -o dhcp:dhcp "${chroot}"/var/run/dhcp "${chroot}"/var/lib/dhcp
+
+ local leasefile="$(get_var lease-file-name /var/lib/dhcp/${SVCNAME}.leases)"
+ checkpath -f -o dhcp:dhcp "${chroot}${leasefile}"
+
+ # Setup LD_PRELOAD so name resolution works in our chroot.
+ if [ -n "${chroot}" ] ; then
+ checkpath -d -o root:root -m 755 "${chroot}"/dev "${chroot}"/etc "${chroot}"/proc
+ cp -pP /etc/localtime /etc/resolv.conf "${chroot}"/etc/
+ export LD_PRELOAD="${LD_PRELOAD} libresolv.so libnss_dns.so"
+ if ! mountinfo -q "${chroot}/proc" ; then
+ mount --bind /proc "${chroot}/proc"
+ fi
+ fi
+
+ local pidfile="$(get_var pid-file-name /var/run/dhcp/${SVCNAME}.pid)"
+
+ ebegin "Starting ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/${pidfile}" \
+ -- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \
+ -user dhcp -group dhcp \
+ ${chroot:+-chroot} ${chroot} ${DHCPD_IFACE}
+ eend $? \
+ && save_options chroot "${chroot}" \
+ && save_options pidfile "${pidfile}"
+}
+
+stop() {
+ local chroot="$(get_options chroot)"
+
+ ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --stop --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/$(get_options pidfile)"
+ res=$?
+
+ if [ ${res} -eq 0 ] && [ -n "${chroot}" ] ; then
+ if mountinfo -q "${chroot}/proc" ; then
+ umount "${chroot}/proc"
+ fi
+ fi
+
+ eend $res
+}
diff --git a/net-misc/dhcp/files/dhcrelay.init b/net-misc/dhcp/files/dhcrelay.init
deleted file mode 100644
index 2f92956..0000000
--- a/net-misc/dhcp/files/dhcrelay.init
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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= i=
- for i in ${IFACE} ; do
- IFACES="${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/metadata.xml b/net-misc/dhcp/metadata.xml
index de6dcfd..667e06d 100644
--- a/net-misc/dhcp/metadata.xml
+++ b/net-misc/dhcp/metadata.xml
@@ -5,8 +5,7 @@
<longdescription lang="en">The ISC DHCP client/server package.</longdescription>
<longdescription lang="ja">ISC DHCP クライアント/サーバ・パッケージです。</longdescription>
<use>
- <flag name="client">Install the dhclient program</flag>
- <flag name="server">Install the dhcpd and dhcrelay programs</flag>
- <flag name="infiniband">Enable ipoib support</flag>
+ <flag name='client'>Install the dhclient program</flag>
+ <flag name='server'>Install the dhcpd and dhcrelay programs</flag>
</use>
</pkgmetadata>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2012-03-15 19:55 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2012-03-15 19:55 UTC (permalink / raw
To: gentoo-commits
commit: ec667cff63b0c050fe9cbd909ec4450d850de676
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 19:55:02 2012 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 19:55:02 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=ec667cff
[net-misc/dhcp] Opps fix patch
(Portage version: 2.2.0_alpha90/git/Linux x86_64, unsigned Manifest commit)
---
net-misc/dhcp/ChangeLog | 4 ++++
net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch | 3 ++-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index 2888d4c..83e47f1 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -2,6 +2,10 @@
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
+ files/dhcp-4.2.0-ib-options.patch:
+ [net-misc/dhcp] Opps fix patch
+
*dhcp-4.2.3_p1-r1 (15 Mar 2012)
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org> +dhcp-4.2.3_p1-r1.ebuild,
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
index 5127f52..383e54b 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
@@ -410,7 +410,8 @@ index 9911d70..6110b4f 100644
@@ -364,6 +364,7 @@ enum dhcp_token {
GETHOSTBYNAME = 665,
PRIMARY6 = 666,
- SECONDARY6 = 667
+- SECONDARY6 = 667
++ SECONDARY6 = 667,
+ BOOTP_BROADCAST_ALWAYS = 668
};
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2012-03-15 19:58 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2012-03-15 19:58 UTC (permalink / raw
To: gentoo-commits
commit: e420339c677f3ca81a4c391497acf56b929fa4f2
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 19:57:32 2012 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 19:57:32 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=e420339c
[net-misc/dhcp] wrong one =D
(Portage version: 2.2.0_alpha90/git/Linux x86_64, unsigned Manifest commit)
---
net-misc/dhcp/ChangeLog | 4 ++++
net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch | 5 ++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index 83e47f1..2c7d737 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -4,6 +4,10 @@
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
files/dhcp-4.2.0-ib-options.patch:
+ [net-misc/dhcp] wrong one =D
+
+ 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
+ files/dhcp-4.2.0-ib-options.patch:
[net-misc/dhcp] Opps fix patch
*dhcp-4.2.3_p1-r1 (15 Mar 2012)
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
index 383e54b..2efd6bb 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
@@ -1,7 +1,7 @@
From 1b23cc04e0c76579eb3657ff93abaa487363a434 Mon Sep 17 00:00:00 2001
From: Alexey Shvetsov <alexxy@gentoo.org>
Date: Thu, 15 Mar 2012 23:21:21 +0400
-Subject: [PATCH 3/3] ib options
+Subject: [PATCH] ib options
---
client/clparse.c | 10 +-
@@ -410,8 +410,7 @@ index 9911d70..6110b4f 100644
@@ -364,6 +364,7 @@ enum dhcp_token {
GETHOSTBYNAME = 665,
PRIMARY6 = 666,
-- SECONDARY6 = 667
-+ SECONDARY6 = 667,
+ SECONDARY6 = 667
+ BOOTP_BROADCAST_ALWAYS = 668
};
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2012-03-15 20:03 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2012-03-15 20:03 UTC (permalink / raw
To: gentoo-commits
commit: 4edcb1c3c72df74805de7f35301b6aebe0baafef
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 20:03:11 2012 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 20:03:11 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=4edcb1c3
[net-misc/dhcp] once again
(Portage version: 2.2.0_alpha90/git/Linux x86_64, unsigned Manifest commit)
---
net-misc/dhcp/ChangeLog | 4 ++++
net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index 2c7d737..7a86018 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -4,6 +4,10 @@
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
files/dhcp-4.2.0-ib-options.patch:
+ [net-misc/dhcp] once again
+
+ 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
+ files/dhcp-4.2.0-ib-options.patch:
[net-misc/dhcp] wrong one =D
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
index 2efd6bb..caa3614 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
@@ -1,4 +1,4 @@
-From 1b23cc04e0c76579eb3657ff93abaa487363a434 Mon Sep 17 00:00:00 2001
+From adb006f9d22b9001c89e0adda8c48e34c2773b16 Mon Sep 17 00:00:00 2001
From: Alexey Shvetsov <alexxy@gentoo.org>
Date: Thu, 15 Mar 2012 23:21:21 +0400
Subject: [PATCH] ib options
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2012-03-15 20:05 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2012-03-15 20:05 UTC (permalink / raw
To: gentoo-commits
commit: a229ec739461c3896a892dd04f2dc7185969dd92
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 20:05:19 2012 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 20:05:19 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=a229ec73
[net-misc/dhcp] once again
(Portage version: 2.2.0_alpha90/git/Linux x86_64, unsigned Manifest commit)
---
net-misc/dhcp/ChangeLog | 4 ++++
net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch | 14 ++++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index 7a86018..c6dc101 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -8,6 +8,10 @@
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
files/dhcp-4.2.0-ib-options.patch:
+ [net-misc/dhcp] once again
+
+ 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
+ files/dhcp-4.2.0-ib-options.patch:
[net-misc/dhcp] wrong one =D
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
index caa3614..a412fbf 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
@@ -1,4 +1,4 @@
-From adb006f9d22b9001c89e0adda8c48e34c2773b16 Mon Sep 17 00:00:00 2001
+From eb2ec733aa64bf9da9e64364dbbbde3411eaf90a Mon Sep 17 00:00:00 2001
From: Alexey Shvetsov <alexxy@gentoo.org>
Date: Thu, 15 Mar 2012 23:21:21 +0400
Subject: [PATCH] ib options
@@ -8,8 +8,8 @@ Subject: [PATCH] ib options
client/dhclient.c | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++-
common/conflex.c | 2 +
includes/dhcpd.h | 3 +
- includes/dhctoken.h | 1 +
- 5 files changed, 282 insertions(+), 4 deletions(-)
+ includes/dhctoken.h | 3 +-
+ 5 files changed, 283 insertions(+), 5 deletions(-)
diff --git a/client/clparse.c b/client/clparse.c
index 9de4ce2..890647d 100644
@@ -404,13 +404,15 @@ index 5a137e6..7da8b76 100644
/* Per-interface state used in the dhcp client... */
diff --git a/includes/dhctoken.h b/includes/dhctoken.h
-index 9911d70..6110b4f 100644
+index 9911d70..3fdda93 100644
--- a/includes/dhctoken.h
+++ b/includes/dhctoken.h
-@@ -364,6 +364,7 @@ enum dhcp_token {
+@@ -363,7 +363,8 @@ enum dhcp_token {
+ INITIAL_DELAY = 664,
GETHOSTBYNAME = 665,
PRIMARY6 = 666,
- SECONDARY6 = 667
+- SECONDARY6 = 667
++ SECONDARY6 = 667,
+ BOOTP_BROADCAST_ALWAYS = 668
};
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2012-03-15 21:00 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2012-03-15 21:00 UTC (permalink / raw
To: gentoo-commits
commit: 050f4f7739b731d78eaab234999663213e9fb4e2
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 20:58:57 2012 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 20:59:35 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=050f4f77
[net-misc/dhcp] Import patches from F17
(Portage version: 2.2.0_alpha90/git/Linux x86_64, unsigned Manifest commit)
---
net-misc/dhcp/ChangeLog | 7 +
net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild | 6 +-
net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch | 422 --------------------
net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch | 132 ++++++
...ved-xid.patch => dhcp-4.2.2-improved-xid.patch} | 69 ++--
...-4.2.0-lpf-ib.patch => dhcp-4.2.2-lpf-ib.patch} | 272 +++++++-------
6 files changed, 308 insertions(+), 600 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index c6dc101..0b47c0a 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -3,6 +3,13 @@
# $Header: $
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
+ +files/dhcp-4.2.2-gpxe-cid.patch, +files/dhcp-4.2.2-improved-xid.patch,
+ +files/dhcp-4.2.2-lpf-ib.patch, -files/dhcp-4.2.0-ib-options.patch,
+ -files/dhcp-4.2.0-improved-xid.patch, -files/dhcp-4.2.0-lpf-ib.patch,
+ dhcp-4.2.3_p1-r1.ebuild:
+ [net-misc/dhcp] Import patches from F17
+
+ 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
files/dhcp-4.2.0-ib-options.patch:
[net-misc/dhcp] once again
diff --git a/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild b/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
index 78b8b37..22d7587 100644
--- a/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
+++ b/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
@@ -62,9 +62,9 @@ src_prepare() {
# infiniband patches
if use infiniband; then
- epatch "${FILESDIR}"/${PN}-4.2.0-improved-xid.patch
- epatch "${FILESDIR}"/${PN}-4.2.0-lpf-ib.patch
- epatch "${FILESDIR}"/${PN}-4.2.0-ib-options.patch
+ epatch "${FILESDIR}"/${PN}-4.2.2-lpf-ib.patch
+ epatch "${FILESDIR}"/${PN}-4.2.2-improved-xid.patch
+ epatch "${FILESDIR}"/${PN}-4.2.2-gpxe-cid.patch
fi
# Brand the version with Gentoo
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch b/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
deleted file mode 100644
index a412fbf..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.0-ib-options.patch
+++ /dev/null
@@ -1,422 +0,0 @@
-From eb2ec733aa64bf9da9e64364dbbbde3411eaf90a Mon Sep 17 00:00:00 2001
-From: Alexey Shvetsov <alexxy@gentoo.org>
-Date: Thu, 15 Mar 2012 23:21:21 +0400
-Subject: [PATCH] ib options
-
----
- client/clparse.c | 10 +-
- client/dhclient.c | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++-
- common/conflex.c | 2 +
- includes/dhcpd.h | 3 +
- includes/dhctoken.h | 3 +-
- 5 files changed, 283 insertions(+), 5 deletions(-)
-
-diff --git a/client/clparse.c b/client/clparse.c
-index 9de4ce2..890647d 100644
---- a/client/clparse.c
-+++ b/client/clparse.c
-@@ -146,6 +146,7 @@ isc_result_t read_client_conf ()
- /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
- */
- top_level_config.requested_lease = 7200;
-+ top_level_config.bootp_broadcast_always = 0;
-
- group_allocate (&top_level_config.on_receipt, MDL);
- if (!top_level_config.on_receipt)
-@@ -313,7 +314,8 @@ void read_client_leases ()
- interface-declaration |
- LEASE client-lease-statement |
- ALIAS client-lease-statement |
-- KEY key-definition */
-+ KEY key-definition |
-+ BOOTP_BROADCAST_ALWAYS */
-
- void parse_client_statement (cfile, ip, config)
- struct parse *cfile;
-@@ -732,6 +734,12 @@ void parse_client_statement (cfile, ip, config)
- parse_reject_statement (cfile, config);
- return;
-
-+ case BOOTP_BROADCAST_ALWAYS:
-+ token = next_token(&val, (unsigned*)0, cfile);
-+ config -> bootp_broadcast_always = 1;
-+ parse_semi (cfile);
-+ return;
-+
- default:
- lose = 0;
- stmt = (struct executable_statement *)0;
-diff --git a/client/dhclient.c b/client/dhclient.c
-index 138b563..a853bbc 100644
---- a/client/dhclient.c
-+++ b/client/dhclient.c
-@@ -39,6 +39,12 @@
- #include <limits.h>
- #include <dns/result.h>
-
-+/*
-+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
-+ * that when building ISC code.
-+ */
-+extern int asprintf(char **strp, const char *fmt, ...);
-+
- TIME default_lease_time = 43200; /* 12 hours... */
- TIME max_lease_time = 86400; /* 24 hours... */
-
-@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute value is the real one. */
- int wanted_ia_ta = 0;
- int wanted_ia_pd = 0;
- char *mockup_relay = NULL;
-+int bootp_broadcast_always = 0;
-+
-+extern u_int32_t default_requested_options[];
-
- void run_stateless(int exit_mode);
-
-@@ -146,6 +155,15 @@ main(int argc, char **argv) {
- int local_family_set = 0;
- #endif /* DHCPv6 */
- char *s;
-+ char *dhcp_client_identifier_arg = NULL;
-+ char *dhcp_host_name_arg = NULL;
-+ char *dhcp_fqdn_arg = NULL;
-+ char *dhcp_vendor_class_identifier_arg = NULL;
-+ char *dhclient_request_options = NULL;
-+
-+ int timeout_arg = 0;
-+ char *arg_conf = NULL;
-+ int arg_conf_len = 0;
-
- /* Initialize client globals. */
- memset(&default_duid, 0, sizeof(default_duid));
-@@ -333,6 +351,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 == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
-+ exit(1);
-+ }
-+
-+ dhcp_client_identifier_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-B")) {
-+ bootp_broadcast_always = 1;
-+ } else if (!strcmp(argv[i], "-H")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= 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 != NULL) {
-+ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
-+ exit(1);
-+ }
-+
-+ dhcp_host_name_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-F")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= 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 != NULL) {
-+ log_error("Only one -F <fqdn> argument can be specified");
-+ exit(1);
-+ }
-+
-+ if (dhcp_host_name_arg != NULL) {
-+ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
-+ exit(1);
-+ }
-+
-+ dhcp_fqdn_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-timeout")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if ((timeout_arg = atoi(argv[i])) <= 0) {
-+ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
-+ exit(1);
-+ }
-+ } else if (!strcmp(argv[i], "-V")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
-+ exit(1);
-+ }
-+
-+ dhcp_vendor_class_identifier_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-R")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ dhclient_request_options = argv[i];
- } else if (argv[i][0] == '-') {
- usage();
- } else if (interfaces_requested < 0) {
-@@ -507,6 +607,166 @@ main(int argc, char **argv) {
- /* Parse the dhclient.conf file. */
- read_client_conf();
-
-+ /* Parse any extra command line configuration arguments: */
-+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
-+ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -I option dhcp-client-identifier");
-+ }
-+
-+ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -H option host-name");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -H option host-name");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -F option fqdn.fqdn");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -F option fqdn.fqdn");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (timeout_arg) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to process -timeout timeout argument");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len == 0))
-+ log_fatal("Unable to process -timeout timeout argument");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -V option vendor-class-identifier");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -V option vendor-class-identifier");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (dhclient_request_options != NULL) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to parse -R <request options list> argument");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to parse -R <request options list> argument");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (arg_conf) {
-+ if (arg_conf_len == 0)
-+ if ((arg_conf_len = strlen(arg_conf)) == 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 = (struct parse *)0;
-+ const char *val = NULL;
-+ int token;
-+
-+ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
-+
-+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
-+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
-+ /* more detailed parse failures will be logged */
-+
-+ do {
-+ token = peek_token(&val, (unsigned *)0, cfile);
-+ if (token == 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 arguments !");
-+ 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 == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
-+ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
-+
-+ for (ip=interfaces; ip; ip = ip->next) {
-+ if (ip->client->config->timeout == 60)
-+ ip->client->config->timeout = timeout_arg;
-+
-+ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
-+ ip->client->config->reboot_timeout = ip->client->config->timeout;
-+ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
-+ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
-+ }
-+ }
-+
-+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != (void *) default_requested_options)) {
-+ for (ip=interfaces; ip; ip = ip->next) {
-+ if (ip->client->config->requested_options == (void *) default_requested_options)
-+ ip->client->config->requested_options = top_level_config.requested_options;
-+ }
-+ }
-+
-+ free(arg_conf);
-+ arg_conf = NULL;
-+ arg_conf_len = 0;
-+ }
-+
- /* Parse the lease database. */
- read_client_leases();
-
-@@ -2468,7 +2728,8 @@ void make_discover (client, lease)
- client -> packet.xid = random ();
- client -> packet.secs = 0; /* filled in by send_discover. */
-
-- 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 = 0;
- else
- client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2552,7 +2813,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 = 0;
- else
- client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2614,7 +2877,8 @@ void make_decline (client, lease)
- client -> packet.hops = 0;
- client -> packet.xid = client -> xid;
- client -> packet.secs = 0; /* Filled in by send_request. */
-- 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 = 0;
- else
- client -> packet.flags = htons (BOOTP_BROADCAST);
-diff --git a/common/conflex.c b/common/conflex.c
-index 9c9ed66..028e69c 100644
---- a/common/conflex.c
-+++ b/common/conflex.c
-@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv) {
- 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 --git a/includes/dhcpd.h b/includes/dhcpd.h
-index 5a137e6..7da8b76 100644
---- a/includes/dhcpd.h
-+++ b/includes/dhcpd.h
-@@ -1147,6 +1147,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_BROADCAST
-+ flag in requests */
- };
-
- /* Per-interface state used in the dhcp client... */
-diff --git a/includes/dhctoken.h b/includes/dhctoken.h
-index 9911d70..3fdda93 100644
---- a/includes/dhctoken.h
-+++ b/includes/dhctoken.h
-@@ -363,7 +363,8 @@ enum dhcp_token {
- INITIAL_DELAY = 664,
- GETHOSTBYNAME = 665,
- PRIMARY6 = 666,
-- SECONDARY6 = 667
-+ SECONDARY6 = 667,
-+ BOOTP_BROADCAST_ALWAYS = 668
- };
-
- #define is_identifier(x) ((x) >= FIRST_TOKEN && \
---
-1.7.9.3
-
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch b/net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch
new file mode 100644
index 0000000..c0be4c2
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch
@@ -0,0 +1,132 @@
+diff -up dhcp-4.2.2/client/dhclient.c.gpxe-cid dhcp-4.2.2/client/dhclient.c
+--- dhcp-4.2.2/client/dhclient.c.gpxe-cid 2011-09-16 18:23:20.190453902 +0200
++++ dhcp-4.2.2/client/dhclient.c 2011-09-16 18:27:15.568463599 +0200
+@@ -58,6 +58,13 @@ const char *path_dhclient_pid = NULL;
+ static char path_dhclient_script_array[] = _PATH_DHCLIENT_SCRIPT;
+ char *path_dhclient_script = path_dhclient_script_array;
+
++/* Default Prefix */
++static unsigned char default_prefix[12] = {
++ 0xff, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x02, 0x00,
++ 0x00, 0x02, 0xc9, 0x00
++};
++
+ /* False (default) => we write and use a pid file */
+ isc_boolean_t no_pid_file = ISC_FALSE;
+
+@@ -1250,6 +1257,12 @@ int find_subnet (struct subnet **sp,
+ static void setup_ib_interface(struct interface_info *ip)
+ {
+ struct group *g;
++ struct hardware *hw = &ip->hw_address;
++ char client_id[64];
++ char *arg_conf = NULL;
++ int arg_conf_len = 0;
++ isc_result_t status;
++ struct parse *cfile = (struct parse *)0;
+
+ /* Set the broadcast flag */
+ ip->client->config->bootp_broadcast_always = 1;
+@@ -1266,8 +1279,39 @@ static void setup_ib_interface(struct in
+ }
+ }
+
+- /* No client ID specified */
+- log_fatal("dhcp-client-identifier must be specified for InfiniBand");
++ /*
++ * No client ID specified, make up one based on a default
++ * "prefix" and the port GUID.
++ *
++ * NOTE: This is compatible with what gpxe does.
++ */
++ sprintf(client_id, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
++ default_prefix[0], default_prefix[1], default_prefix[2],
++ default_prefix[3], default_prefix[4], default_prefix[5],
++ default_prefix[6], default_prefix[7], default_prefix[8],
++ default_prefix[9], default_prefix[10], default_prefix[11],
++ hw->hbuf[1], hw->hbuf[2], hw->hbuf[3], hw->hbuf[4],
++ hw->hbuf[5], hw->hbuf[6], hw->hbuf[7], hw->hbuf[8]);
++
++ arg_conf_len = asprintf(&arg_conf,
++ "send dhcp-client-identifier %s;",
++ client_id);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send option dhcp-client-identifier");
++
++ status = new_parse(&cfile, -1, arg_conf, arg_conf_len,
++ "Automatic Infiniband client identifier", 0);
++
++ if ((status != ISC_R_SUCCESS) || (cfile->warnings_occurred))
++ log_fatal("Failed to parse Infiniband client identifier");
++
++ parse_client_statement(cfile, NULL, ip->client->config);
++
++ if (cfile->warnings_occurred)
++ log_fatal("Failed to parse Infiniband client identifier");
++
++ end_parse(&cfile);
+ }
+
+ /* Individual States:
+diff -up dhcp-4.2.2/common/lpf.c.gpxe-cid dhcp-4.2.2/common/lpf.c
+--- dhcp-4.2.2/common/lpf.c.gpxe-cid 2011-09-16 18:23:20.183453996 +0200
++++ dhcp-4.2.2/common/lpf.c 2011-09-16 18:25:28.235804421 +0200
+@@ -591,6 +591,37 @@ void maybe_setup_fallback ()
+ }
+ }
+
++static unsigned char * get_ib_hw_addr(char * name)
++{
++ struct ifaddrs *ifaddrs;
++ struct ifaddrs *ifa;
++ struct sockaddr_ll *sll = NULL;
++ static unsigned char hw_addr[8];
++
++ if (getifaddrs(&ifaddrs) == -1)
++ return NULL;
++
++ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
++ if (ifa->ifa_addr == NULL)
++ continue;
++ if (ifa->ifa_addr->sa_family != AF_PACKET)
++ continue;
++ if (ifa->ifa_flags & IFF_LOOPBACK)
++ continue;
++ if (strcmp(ifa->ifa_name, name) == 0) {
++ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr;
++ break;
++ }
++ }
++ if (sll == NULL) {
++ freeifaddrs(ifaddrs);
++ return NULL;
++ }
++ memcpy(hw_addr, &sll->sll_addr[sll->sll_halen - 8], 8);
++ freeifaddrs(ifaddrs);
++ return (unsigned char *)&hw_addr;
++}
++
+ void
+ get_hw_addr(struct interface_info *info)
+ {
+@@ -599,6 +630,7 @@ get_hw_addr(struct interface_info *info)
+ struct ifaddrs *ifaddrs;
+ struct ifaddrs *ifa;
+ struct sockaddr_ll *sll = NULL;
++ unsigned char *hw_addr;
+
+ if (getifaddrs(&ifaddrs) == -1)
+ log_fatal("Failed to get interfaces");
+@@ -660,6 +692,10 @@ get_hw_addr(struct interface_info *info)
+
+ hw->hlen = 1;
+ hw->hbuf[0] = HTYPE_INFINIBAND;
++ hw_addr = get_ib_hw_addr(name);
++ if (!hw_addr)
++ log_fatal("Failed getting %s hw addr", name);
++ memcpy (&hw->hbuf [1], hw_addr, 8);
+ break;
+ #if defined(ARPHRD_PPP)
+ case ARPHRD_PPP:
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch b/net-misc/dhcp/files/dhcp-4.2.2-improved-xid.patch
similarity index 71%
rename from net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch
rename to net-misc/dhcp/files/dhcp-4.2.2-improved-xid.patch
index 1fd4dbe..f49fc78 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-improved-xid.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.2-improved-xid.patch
@@ -1,17 +1,7 @@
-From 37a9ded0038fe29f26377c40e080634534d97d0e Mon Sep 17 00:00:00 2001
-From: Alexey Shvetsov <alexxy@gentoo.org>
-Date: Thu, 15 Mar 2012 22:54:15 +0400
-Subject: [PATCH 1/3] improved xid
-
----
- client/dhclient.c | 62 +++++++++++++++++++++++++++++++++++++++++++----------
- 1 file changed, 51 insertions(+), 11 deletions(-)
-
-diff --git a/client/dhclient.c b/client/dhclient.c
-index 48707d1..f72e0da 100644
---- a/client/dhclient.c
-+++ b/client/dhclient.c
-@@ -540,6 +540,26 @@ main(int argc, char **argv) {
+diff -up dhcp-4.2.2/client/dhclient.c.improved-xid dhcp-4.2.2/client/dhclient.c
+--- dhcp-4.2.2/client/dhclient.c.improved-xid 2011-09-16 18:18:00.649730661 +0200
++++ dhcp-4.2.2/client/dhclient.c 2011-09-16 18:22:36.815035513 +0200
+@@ -898,6 +898,26 @@ main(int argc, char **argv) {
}
}
@@ -38,7 +28,7 @@ index 48707d1..f72e0da 100644
/* 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
-@@ -554,14 +574,34 @@ main(int argc, char **argv) {
+@@ -912,14 +932,36 @@ main(int argc, char **argv) {
Not much entropy, but we're booting, so we're not likely to
find anything better. */
seed = 0;
@@ -46,7 +36,7 @@ index 48707d1..f72e0da 100644
for (ip = interfaces; ip; ip = ip->next) {
int junk;
+ if ( ip -> hw_address.hlen <= sizeof seed )
-+ continue;
++ continue;
memcpy(&junk,
&ip->hw_address.hbuf[ip->hw_address.hlen -
sizeof seed], sizeof seed);
@@ -56,25 +46,27 @@ index 48707d1..f72e0da 100644
- srandom(seed + cur_time + (unsigned)getpid());
+ if ( seed_flag == 0 ) {
+ if ( backup_seed != 0 ) {
-+ seed = backup_seed;
-+ log_info ("xid: rand init seed (0x%x) built using all"
-+ " available interfaces",seed);
-+ } else {
-+ seed = 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);
++ seed = backup_seed;
++ log_info ("xid: rand init seed (0x%x) built using all"
++ " available interfaces",seed);
++ }
++ else {
++ seed = 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 */
++ /* 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 + (unsigned)getpid());
++ }
++ else
++ srandom(seed + cur_time + (unsigned)getpid());
- /* Start a configuration state machine for each interface. */
- #ifdef DHCPv6
-@@ -1053,7 +1093,7 @@ void dhcpack (packet)
+ /* Setup specific Infiniband options */
+ for (ip = interfaces; ip; ip = ip->next) {
+@@ -1457,7 +1499,7 @@ void dhcpack (packet)
return;
}
@@ -83,7 +75,7 @@ index 48707d1..f72e0da 100644
lease = packet_to_lease (packet, client);
if (!lease) {
-@@ -1769,7 +1809,7 @@ void dhcpnak (packet)
+@@ -2174,7 +2216,7 @@ void dhcpnak (packet)
return;
}
@@ -92,7 +84,7 @@ index 48707d1..f72e0da 100644
if (!client -> active) {
#if defined (DEBUG)
-@@ -1895,10 +1935,10 @@ void send_discover (cpp)
+@@ -2300,10 +2342,10 @@ void send_discover (cpp)
client -> packet.secs = htons (65535);
client -> secs = client -> packet.secs;
@@ -105,7 +97,7 @@ index 48707d1..f72e0da 100644
/* Send out a packet. */
result = send_packet (client -> interface, (struct packet *)0,
-@@ -2162,10 +2202,10 @@ void send_request (cpp)
+@@ -2584,10 +2626,10 @@ void send_request (cpp)
client -> packet.secs = htons (65535);
}
@@ -118,7 +110,7 @@ index 48707d1..f72e0da 100644
if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
fallback_interface)
-@@ -2196,10 +2236,10 @@ void send_decline (cpp)
+@@ -2618,10 +2660,10 @@ void send_decline (cpp)
int result;
@@ -131,7 +123,7 @@ index 48707d1..f72e0da 100644
/* Send out a packet. */
result = send_packet (client -> interface, (struct packet *)0,
-@@ -2239,10 +2279,10 @@ void send_release (cpp)
+@@ -2661,10 +2703,10 @@ void send_release (cpp)
return;
}
@@ -144,6 +136,3 @@ index 48707d1..f72e0da 100644
if (fallback_interface)
result = send_packet (fallback_interface,
---
-1.7.9.3
-
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch b/net-misc/dhcp/files/dhcp-4.2.2-lpf-ib.patch
similarity index 73%
rename from net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch
rename to net-misc/dhcp/files/dhcp-4.2.2-lpf-ib.patch
index ac5fa83..4034028 100644
--- a/net-misc/dhcp/files/dhcp-4.2.0-lpf-ib.patch
+++ b/net-misc/dhcp/files/dhcp-4.2.2-lpf-ib.patch
@@ -1,26 +1,34 @@
-From fbc0a6667fe7ca44a5185b00be2c0cbfae10d61d Mon Sep 17 00:00:00 2001
-From: Alexey Shvetsov <alexxy@gentoo.org>
-Date: Thu, 15 Mar 2012 23:18:21 +0400
-Subject: [PATCH 2/3] lpf ib
-
----
- client/dhclient.c | 31 ++++++++
- common/bpf.c | 39 +++++++++-
- common/dlpi.c | 4 +-
- common/lpf.c | 225 ++++++++++++++++++++++++++++++++++++++++++++---------
- common/socket.c | 4 +-
- includes/dhcp.h | 1 +
- includes/dhcpd.h | 3 +-
- 7 files changed, 266 insertions(+), 41 deletions(-)
-
-diff --git a/client/dhclient.c b/client/dhclient.c
-index f72e0da..138b563 100644
---- a/client/dhclient.c
-+++ b/client/dhclient.c
-@@ -100,6 +100,29 @@ static int check_domain_name_list(const char *ptr, size_t len, int dots);
+diff -up dhcp-4.2.2/client/dhclient.c.lpf-ib dhcp-4.2.2/client/dhclient.c
+--- dhcp-4.2.2/client/dhclient.c.lpf-ib 2011-09-19 11:24:08.693775799 +0200
++++ dhcp-4.2.2/client/dhclient.c 2011-09-19 11:24:08.703775541 +0200
+@@ -113,6 +113,8 @@ static int check_domain_name_list(const
static int check_option_values(struct universe *universe, unsigned int opt,
const char *ptr, size_t len);
++static void setup_ib_interface(struct interface_info *ip);
++
+ int
+ main(int argc, char **argv) {
+ int fd;
+@@ -919,6 +921,14 @@ main(int argc, char **argv) {
+ }
+ srandom(seed + cur_time + (unsigned)getpid());
+
++ /* Setup specific Infiniband options */
++ for (ip = interfaces; ip; ip = ip->next) {
++ if (ip->client &&
++ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
++ setup_ib_interface(ip);
++ }
++ }
++
+ /* Start a configuration state machine for each interface. */
+ #ifdef DHCPv6
+ if (local_family == AF_INET6) {
+@@ -1195,6 +1205,29 @@ int find_subnet (struct subnet **sp,
+ return 0;
+ }
+
+static void setup_ib_interface(struct interface_info *ip)
+{
+ struct group *g;
@@ -44,37 +52,12 @@ index f72e0da..138b563 100644
+ log_fatal("dhcp-client-identifier must be specified for InfiniBand");
+}
+
- int
- main(int argc, char **argv) {
- int fd;
-@@ -603,6 +626,14 @@ main(int argc, char **argv) {
- } else
- srandom(seed + cur_time + (unsigned)getpid());
-
-+ /* Setup specific Infiniband options */
-+ for (ip = interfaces; ip; ip = ip->next) {
-+ if (ip->client &&
-+ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
-+ setup_ib_interface(ip);
-+ }
-+ }
-+
- /* Start a configuration state machine for each interface. */
- #ifdef DHCPv6
- if (local_family == AF_INET6) {
-diff --git a/common/bpf.c b/common/bpf.c
-index b0ef657..90289ec 100644
---- a/common/bpf.c
-+++ b/common/bpf.c
-@@ -116,7 +116,7 @@ int if_register_bpf (info)
- log_fatal ("Can't attach interface %s to bpf device %s: %m",
- info -> name, filename);
-
-- get_hw_addr(info->name, &info->hw_address);
-+ get_hw_addr(info);
-
- return sock;
- }
+ /* Individual States:
+ *
+ * Each routine is called from the dhclient_state_machine() in one of
+diff -up dhcp-4.2.2/common/bpf.c.lpf-ib dhcp-4.2.2/common/bpf.c
+--- dhcp-4.2.2/common/bpf.c.lpf-ib 2011-09-19 11:24:08.694775773 +0200
++++ dhcp-4.2.2/common/bpf.c 2011-09-19 11:24:08.704775516 +0200
@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
BPF_STMT(BPF_RET+BPF_K, 0),
};
@@ -120,42 +103,18 @@ index b0ef657..90289ec 100644
#if defined (HAVE_TR_SUPPORT)
struct bpf_insn dhcp_bpf_tr_filter [] = {
/* accept all token ring packets due to variable length header */
-@@ -552,7 +585,9 @@ void maybe_setup_fallback ()
- }
-
- void
--get_hw_addr(const char *name, struct hardware *hw) {
-+get_hw_addr(struct interface_info *info) {
-+ struct hardware *hw = &info->hw_address;
-+ char *name = info->name;
- struct ifaddrs *ifa;
- struct ifaddrs *p;
- struct sockaddr_dl *sa;
-diff --git a/common/dlpi.c b/common/dlpi.c
-index 8f2c73d..619271f 100644
---- a/common/dlpi.c
-+++ b/common/dlpi.c
-@@ -1332,7 +1332,9 @@ void maybe_setup_fallback ()
- #endif /* USE_DLPI_SEND */
-
- void
--get_hw_addr(const char *name, struct hardware *hw) {
-+get_hw_addr(struct interface_info *info) {
-+ struct hardware *hw = &info->hw_address;
-+ char *name = info->name;
- int sock, unit;
- long buf[DLPI_MAXDLBUF];
- union DL_primitives *dlp;
-diff --git a/common/lpf.c b/common/lpf.c
-index 16eecc9..488df88 100644
---- a/common/lpf.c
-+++ b/common/lpf.c
-@@ -41,10 +41,20 @@
+diff -up dhcp-4.2.2/common/lpf.c.lpf-ib dhcp-4.2.2/common/lpf.c
+--- dhcp-4.2.2/common/lpf.c.lpf-ib 2011-09-19 11:24:08.694775773 +0200
++++ dhcp-4.2.2/common/lpf.c 2011-09-19 11:26:15.107109935 +0200
+@@ -42,6 +42,7 @@
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
#include <net/if.h>
+#include <ifaddrs.h>
+ #ifndef PACKET_AUXDATA
+ #define PACKET_AUXDATA 8
+@@ -59,6 +60,15 @@ struct tpacket_auxdata
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
@@ -171,24 +130,23 @@ index 16eecc9..488df88 100644
#ifdef USE_LPF_SEND
void if_reinitialize_send (info)
struct interface_info *info;
-@@ -67,11 +77,22 @@ int if_register_lpf (info)
- struct interface_info *info;
- {
- int sock;
+@@ -86,10 +96,21 @@ int if_register_lpf (info)
+ struct sockaddr common;
+ } sa;
+ struct ifreq ifr;
+ int type;
+ int protocol;
- struct sockaddr sa;
/* Make an LPF socket. */
-- if ((sock = socket(PF_PACKET, SOCK_PACKET,
+- if ((sock = socket(PF_PACKET, SOCK_RAW,
- htons((short)ETH_P_ALL))) < 0) {
+ get_hw_addr(info);
+
+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ type = SOCK_DGRAM;
++ type = SOCK_DGRAM;
+ protocol = ETHERTYPE_IP;
+ } else {
-+ type = SOCK_RAW;
++ type = SOCK_RAW;
+ protocol = ETH_P_ALL;
+ }
+
@@ -196,15 +154,15 @@ index 16eecc9..488df88 100644
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
-@@ -88,6 +109,7 @@ int if_register_lpf (info)
+@@ -112,6 +133,7 @@ int if_register_lpf (info)
/* Bind to the interface name */
memset (&sa, 0, sizeof sa);
- sa.sa_family = AF_PACKET;
+ sa.ll.sll_family = AF_PACKET;
+ sa.ll.sll_protocol = htons(protocol);
- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
- if (bind (sock, &sa, sizeof sa)) {
+ sa.ll.sll_ifindex = ifr.ifr_ifindex;
+ if (bind (sock, &sa.common, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
-@@ -103,8 +125,6 @@ int if_register_lpf (info)
+@@ -127,8 +149,6 @@ int if_register_lpf (info)
log_fatal ("Bind socket to interface: %m");
}
@@ -213,7 +171,7 @@ index 16eecc9..488df88 100644
return sock;
}
#endif /* USE_LPF_SEND || USE_LPF_RECEIVE */
-@@ -159,6 +179,8 @@ void if_deregister_send (info)
+@@ -183,6 +203,8 @@ void if_deregister_send (info)
in bpf includes... */
extern struct sock_filter dhcp_bpf_filter [];
extern int dhcp_bpf_filter_len;
@@ -222,7 +180,26 @@ index 16eecc9..488df88 100644
#if defined (HAVE_TR_SUPPORT)
extern struct sock_filter dhcp_bpf_tr_filter [];
-@@ -217,15 +239,28 @@ static void lpf_gen_filter_setup (info)
+@@ -200,11 +222,13 @@ void if_register_receive (info)
+ /* Open a LPF device and hang it on this interface... */
+ info -> rfdesc = if_register_lpf (info);
+
+- val = 1;
+- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
+- sizeof val) < 0) {
+- if (errno != ENOPROTOOPT)
+- log_fatal ("Failed to set auxiliary packet data: %m");
++ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) {
++ val = 1;
++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA,
++ &val, sizeof val) < 0) {
++ if (errno != ENOPROTOOPT)
++ log_fatal ("Failed to set auxiliary packet data: %m");
++ }
+ }
+
+ #if defined (HAVE_TR_SUPPORT)
+@@ -250,15 +274,28 @@ static void lpf_gen_filter_setup (info)
memset(&p, 0, sizeof(p));
@@ -260,7 +237,7 @@ index 16eecc9..488df88 100644
if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p,
sizeof p) < 0) {
-@@ -282,6 +317,54 @@ static void lpf_tr_filter_setup (info)
+@@ -315,6 +352,54 @@ static void lpf_tr_filter_setup (info)
#endif /* USE_LPF_RECEIVE */
#ifdef USE_LPF_SEND
@@ -315,7 +292,7 @@ index 16eecc9..488df88 100644
ssize_t send_packet (interface, packet, raw, len, from, to, hto)
struct interface_info *interface;
struct packet *packet;
-@@ -303,6 +386,11 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
+@@ -335,6 +420,11 @@ ssize_t send_packet (interface, packet,
return send_fallback (interface, packet, raw,
len, from, to, hto);
@@ -327,7 +304,7 @@ index 16eecc9..488df88 100644
if (hto == NULL && interface->anycast_mac_addr.hlen)
hto = &interface->anycast_mac_addr;
-@@ -334,6 +422,46 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
+@@ -356,6 +446,42 @@ ssize_t send_packet (interface, packet,
#endif /* USE_LPF_SEND */
#ifdef USE_LPF_RECEIVE
@@ -346,10 +323,6 @@ index 16eecc9..488df88 100644
+
+ length = read(interface->rfdesc, ibuf, sizeof(ibuf));
+
-+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ return receive_packet_ib(interface, buf, len, from, hfrom);
-+ }
-+
+ if (length <= 0)
+ return length;
+
@@ -374,7 +347,18 @@ index 16eecc9..488df88 100644
ssize_t receive_packet (interface, buf, len, from, hfrom)
struct interface_info *interface;
unsigned char *buf;
-@@ -419,33 +547,42 @@ void maybe_setup_fallback ()
+@@ -382,6 +508,10 @@ ssize_t receive_packet (interface, buf,
+ };
+ struct cmsghdr *cmsg;
+
++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
++ return receive_packet_ib(interface, buf, len, from, hfrom);
++ }
++
+ length = recvmsg (interface -> rfdesc, &msg, 0);
+ if (length <= 0)
+ return length;
+@@ -462,33 +592,44 @@ void maybe_setup_fallback ()
}
void
@@ -395,12 +379,15 @@ index 16eecc9..488df88 100644
- }
+ if (getifaddrs(&ifaddrs) == -1)
+ log_fatal("Failed to get interfaces");
-+
-+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
- sock = socket(AF_INET, SOCK_DGRAM, 0);
- if (sock < 0) {
- log_fatal("Can't create socket for \"%s\": %m", name);
++ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
++
++ if (ifa->ifa_addr == NULL)
++ continue;
++
+ if (ifa->ifa_addr->sa_family != AF_PACKET)
+ continue;
+
@@ -421,7 +408,6 @@ index 16eecc9..488df88 100644
+ if (sll == NULL) {
+ freeifaddrs(ifaddrs);
+ log_fatal("Failed to get HW address for %s\n", name);
-+
}
- sa = &tmp.ifr_hwaddr;
@@ -435,7 +421,7 @@ index 16eecc9..488df88 100644
break;
case ARPHRD_IEEE802:
#ifdef ARPHRD_IEEE802_TR
-@@ -453,18 +590,36 @@ get_hw_addr(const char *name, struct hardware *hw) {
+@@ -496,18 +637,35 @@ get_hw_addr(const char *name, struct har
#endif /* ARPHRD_IEEE802_TR */
hw->hlen = 7;
hw->hbuf[0] = HTYPE_IEEE802;
@@ -465,6 +451,19 @@ index 16eecc9..488df88 100644
+ hw->hlen = 1;
+ hw->hbuf[0] = HTYPE_INFINIBAND;
break;
+ #if defined(ARPHRD_PPP)
+ case ARPHRD_PPP:
+ if (local_family != AF_INET6)
+- log_fatal("Unsupported device type %d for \"%s\"",
+- sa->sa_family, name);
++ log_fatal("Unsupported device type %ld for \"%s\"",
++ (long int)sll->sll_family, name);
+ hw->hlen = 0;
+ hw->hbuf[0] = HTYPE_RESERVED;
+ /* 0xdeadbeef should never occur on the wire,
+@@ -520,10 +678,11 @@ get_hw_addr(const char *name, struct har
+ break;
+ #endif
default:
+ freeifaddrs(ifaddrs);
log_fatal("Unsupported device type %ld for \"%s\"",
@@ -476,10 +475,9 @@ index 16eecc9..488df88 100644
+ freeifaddrs(ifaddrs);
}
#endif
-diff --git a/common/socket.c b/common/socket.c
-index a48404b..3fe8b75 100644
---- a/common/socket.c
-+++ b/common/socket.c
+diff -up dhcp-4.2.2/common/socket.c.lpf-ib dhcp-4.2.2/common/socket.c
+--- dhcp-4.2.2/common/socket.c.lpf-ib 2011-06-27 18:18:20.000000000 +0200
++++ dhcp-4.2.2/common/socket.c 2011-09-19 11:24:08.705775490 +0200
@@ -324,7 +324,7 @@ void if_register_send (info)
info->wfdesc = if_register_socket(info, AF_INET, 0);
/* If this is a normal IPv4 address, get the hardware address. */
@@ -489,7 +487,16 @@ index a48404b..3fe8b75 100644
#if defined (USE_SOCKET_FALLBACK)
/* Fallback only registers for send, but may need to receive as
well. */
-@@ -497,7 +497,7 @@ if_register6(struct interface_info *info, int do_multicast) {
+@@ -387,7 +387,7 @@ void if_register_receive (info)
+ #endif /* IP_PKTINFO... */
+ /* If this is a normal IPv4 address, get the hardware address. */
+ if (strcmp(info->name, "fallback") != 0)
+- get_hw_addr(info->name, &info->hw_address);
++ get_hw_addr(info);
+
+ if (!quiet_interface_discovery)
+ log_info ("Listening on Socket/%s%s%s",
+@@ -497,7 +497,7 @@ if_register6(struct interface_info *info
if (req_multi)
if_register_multicast(info);
@@ -498,23 +505,10 @@ index a48404b..3fe8b75 100644
if (!quiet_interface_discovery) {
if (info->shared_network != NULL) {
-diff --git a/includes/dhcp.h b/includes/dhcp.h
-index 1af2adf..722c661 100644
---- a/includes/dhcp.h
-+++ b/includes/dhcp.h
-@@ -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 */
-
- /* Magic cookie validating dhcp options field (and bootp vendor
- extensions field). */
-diff --git a/includes/dhcpd.h b/includes/dhcpd.h
-index 863a149..5a137e6 100644
---- a/includes/dhcpd.h
-+++ b/includes/dhcpd.h
-@@ -1239,6 +1239,7 @@ struct interface_info {
+diff -up dhcp-4.2.2/includes/dhcpd.h.lpf-ib dhcp-4.2.2/includes/dhcpd.h
+--- dhcp-4.2.2/includes/dhcpd.h.lpf-ib 2011-09-19 11:24:08.696775721 +0200
++++ dhcp-4.2.2/includes/dhcpd.h 2011-09-19 11:24:08.707775438 +0200
+@@ -1243,6 +1243,7 @@ struct interface_info {
struct shared_network *shared_network;
/* Networks connected to this interface. */
struct hardware hw_address; /* Its physical address. */
@@ -522,7 +516,7 @@ index 863a149..5a137e6 100644
struct in_addr *addresses; /* Addresses associated with this
* interface.
*/
-@@ -2355,7 +2356,7 @@ void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
+@@ -2356,7 +2357,7 @@ void print_dns_status (int, struct dhcp_
#endif
const char *print_time(TIME);
@@ -531,6 +525,14 @@ index 863a149..5a137e6 100644
/* socket.c */
#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
---
-1.7.9.3
-
+diff -up dhcp-4.2.2/includes/dhcp.h.lpf-ib dhcp-4.2.2/includes/dhcp.h
+--- dhcp-4.2.2/includes/dhcp.h.lpf-ib 2011-09-19 11:24:08.696775721 +0200
++++ dhcp-4.2.2/includes/dhcp.h 2011-09-19 11:24:08.707775438 +0200
+@@ -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 */
+
+ #define HTYPE_RESERVED 0 /* RFC 5494 */
+
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2012-03-15 21:42 Alexey Shvetsov
0 siblings, 0 replies; 9+ messages in thread
From: Alexey Shvetsov @ 2012-03-15 21:42 UTC (permalink / raw
To: gentoo-commits
commit: 725d9c01fda0f3598aabcadd272c13fdf6770cd2
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 21:41:19 2012 +0000
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 21:41:51 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=725d9c01
[net-misc/dhcp] Import more patches to make also client work
(Portage version: 2.2.0_alpha90/git/Linux x86_64, unsigned Manifest commit)
---
net-misc/dhcp/ChangeLog | 7 +
...-4.2.3_p1-r1.ebuild => dhcp-4.2.3_p2-r1.ebuild} | 4 +
net-misc/dhcp/files/dhcp-4.2.0-PPP.patch | 150 ++++++++
net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch | 249 +++++++++++++
net-misc/dhcp/files/dhcp-4.2.3-options.patch | 391 ++++++++++++++++++++
5 files changed, 801 insertions(+), 0 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index 0b47c0a..0b811b8 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -2,6 +2,13 @@
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+*dhcp-4.2.3_p2-r1 (15 Mar 2012)
+
+ 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org> +dhcp-4.2.3_p2-r1.ebuild,
+ +files/dhcp-4.2.0-PPP.patch, +files/dhcp-4.2.2-xen-checksum.patch,
+ +files/dhcp-4.2.3-options.patch, -dhcp-4.2.3_p1-r1.ebuild:
+ [net-misc/dhcp] Import more patches to make also client work
+
15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
+files/dhcp-4.2.2-gpxe-cid.patch, +files/dhcp-4.2.2-improved-xid.patch,
+files/dhcp-4.2.2-lpf-ib.patch, -files/dhcp-4.2.0-ib-options.patch,
diff --git a/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild b/net-misc/dhcp/dhcp-4.2.3_p2-r1.ebuild
similarity index 98%
rename from net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
rename to net-misc/dhcp/dhcp-4.2.3_p2-r1.ebuild
index 22d7587..35069f7 100644
--- a/net-misc/dhcp/dhcp-4.2.3_p1-r1.ebuild
+++ b/net-misc/dhcp/dhcp-4.2.3_p2-r1.ebuild
@@ -62,11 +62,15 @@ src_prepare() {
# infiniband patches
if use infiniband; then
+ epatch "${FILESDIR}"/${PN}-4.2.3-options.patch
+ epatch "${FILESDIR}"/${PN}-4.2.2-xen-checksum.patch
+ epatch "${FILESDIR}"/${PN}-4.2.0-PPP.patch
epatch "${FILESDIR}"/${PN}-4.2.2-lpf-ib.patch
epatch "${FILESDIR}"/${PN}-4.2.2-improved-xid.patch
epatch "${FILESDIR}"/${PN}-4.2.2-gpxe-cid.patch
fi
+
# Brand the version with Gentoo
sed -i \
-e "/VERSION=/s:'$: Gentoo-${PR}':" \
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-PPP.patch b/net-misc/dhcp/files/dhcp-4.2.0-PPP.patch
new file mode 100644
index 0000000..bef2be7
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.0-PPP.patch
@@ -0,0 +1,150 @@
+diff -up dhcp-4.2.0-P1/client/dhc6.c.PPP dhcp-4.2.0-P1/client/dhc6.c
+--- dhcp-4.2.0-P1/client/dhc6.c.PPP 2010-11-05 10:47:37.000000000 +0100
++++ dhcp-4.2.0-P1/client/dhc6.c 2010-11-09 15:54:12.000000000 +0100
+@@ -129,7 +129,7 @@ extern int stateless;
+ * is not how it is intended. Upcoming rearchitecting the client should
+ * address this "one daemon model."
+ */
+-void
++isc_result_t
+ form_duid(struct data_string *duid, const char *file, int line)
+ {
+ struct interface_info *ip;
+@@ -141,6 +141,15 @@ form_duid(struct data_string *duid, cons
+ if (ip == NULL)
+ log_fatal("Impossible condition at %s:%d.", MDL);
+
++ while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) {
++ /* Try the other interfaces */
++ log_debug("Cannot form default DUID from interface %s.", ip->name);
++ ip = ip->next;
++ }
++ if (ip == NULL) {
++ return ISC_R_UNEXPECTED;
++ }
++
+ if ((ip->hw_address.hlen == 0) ||
+ (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf)))
+ log_fatal("Impossible hardware address length at %s:%d.", MDL);
+@@ -176,6 +185,8 @@ form_duid(struct data_string *duid, cons
+ memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1,
+ ip->hw_address.hlen - 1);
+ }
++
++ return ISC_R_SUCCESS;
+ }
+
+ /*
+@@ -5289,7 +5300,8 @@ make_client6_options(struct client_state
+ */
+ if ((oc = lookup_option(&dhcpv6_universe, *op,
+ D6O_CLIENTID)) == NULL) {
+- if (!option_cache(&oc, &default_duid, NULL, clientid_option,
++ if (default_duid.len == 0 ||
++ !option_cache(&oc, &default_duid, NULL, clientid_option,
+ MDL))
+ log_fatal("Failure assembling a DUID.");
+
+diff -up dhcp-4.2.0-P1/client/dhclient.c.PPP dhcp-4.2.0-P1/client/dhclient.c
+--- dhcp-4.2.0-P1/client/dhclient.c.PPP 2010-11-05 10:47:37.000000000 +0100
++++ dhcp-4.2.0-P1/client/dhclient.c 2010-11-09 15:37:26.000000000 +0100
+@@ -911,8 +911,8 @@ main(int argc, char **argv) {
+ if (default_duid.buffer != NULL)
+ data_string_forget(&default_duid, MDL);
+
+- form_duid(&default_duid, MDL);
+- write_duid(&default_duid);
++ if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS)
++ write_duid(&default_duid);
+ }
+
+ for (ip = interfaces ; ip != NULL ; ip = ip->next) {
+diff -up dhcp-4.2.0-P1/common/bpf.c.PPP dhcp-4.2.0-P1/common/bpf.c
+--- dhcp-4.2.0-P1/common/bpf.c.PPP 2010-11-05 10:47:37.000000000 +0100
++++ dhcp-4.2.0-P1/common/bpf.c 2010-11-09 15:42:42.000000000 +0100
+@@ -599,6 +599,22 @@ get_hw_addr(const char *name, struct har
+ memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen);
+ break;
+ #endif /* IFT_FDDI */
++#if defined(IFT_PPP)
++ case IFT_PPP:
++ if (local_family != AF_INET6)
++ log_fatal("Unsupported device type %d for \"%s\"",
++ sa->sdl_type, name);
++ hw->hlen = 0;
++ hw->hbuf[0] = HTYPE_RESERVED;
++ /* 0xdeadbeef should never occur on the wire,
++ * and is a signature that something went wrong.
++ */
++ hw->hbuf[1] = 0xde;
++ hw->hbuf[2] = 0xad;
++ hw->hbuf[3] = 0xbe;
++ hw->hbuf[4] = 0xef;
++ break;
++#endif
+ default:
+ log_fatal("Unsupported device type %d for \"%s\"",
+ sa->sdl_type, name);
+diff -up dhcp-4.2.0-P1/common/lpf.c.PPP dhcp-4.2.0-P1/common/lpf.c
+--- dhcp-4.2.0-P1/common/lpf.c.PPP 2010-11-05 10:47:37.000000000 +0100
++++ dhcp-4.2.0-P1/common/lpf.c 2010-11-09 15:45:40.000000000 +0100
+@@ -502,6 +502,22 @@ get_hw_addr(const char *name, struct har
+ hw->hbuf[0] = HTYPE_FDDI;
+ memcpy(&hw->hbuf[1], sa->sa_data, 16);
+ break;
++#if defined(ARPHRD_PPP)
++ case ARPHRD_PPP:
++ if (local_family != AF_INET6)
++ log_fatal("Unsupported device type %d for \"%s\"",
++ sa->sa_family, name);
++ hw->hlen = 0;
++ hw->hbuf[0] = HTYPE_RESERVED;
++ /* 0xdeadbeef should never occur on the wire,
++ * and is a signature that something went wrong.
++ */
++ hw->hbuf[1] = 0xde;
++ hw->hbuf[2] = 0xad;
++ hw->hbuf[3] = 0xbe;
++ hw->hbuf[4] = 0xef;
++ break;
++#endif
+ default:
+ log_fatal("Unsupported device type %ld for \"%s\"",
+ (long int)sa->sa_family, name);
+diff -up dhcp-4.2.0-P1/includes/dhcpd.h.PPP dhcp-4.2.0-P1/includes/dhcpd.h
+--- dhcp-4.2.0-P1/includes/dhcpd.h.PPP 2010-11-05 10:47:37.000000000 +0100
++++ dhcp-4.2.0-P1/includes/dhcpd.h 2010-11-09 15:46:58.000000000 +0100
+@@ -2733,7 +2733,7 @@ void dhcpv4_client_assignments(void);
+ void dhcpv6_client_assignments(void);
+
+ /* dhc6.c */
+-void form_duid(struct data_string *duid, const char *file, int line);
++isc_result_t form_duid(struct data_string *duid, const char *file, int line);
+ void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line);
+ void start_init6(struct client_state *client);
+ void start_info_request6(struct client_state *client);
+diff -up dhcp-4.2.0-P1/includes/dhcp.h.PPP dhcp-4.2.0-P1/includes/dhcp.h
+--- dhcp-4.2.0-P1/includes/dhcp.h.PPP 2010-11-05 10:47:37.000000000 +0100
++++ dhcp-4.2.0-P1/includes/dhcp.h 2010-11-09 15:48:53.000000000 +0100
+@@ -80,6 +80,8 @@ struct dhcp_packet {
+ #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */
+ #define HTYPE_FDDI 8 /* FDDI... */
+
++#define HTYPE_RESERVED 0 /* RFC 5494 */
++
+ /* Magic cookie validating dhcp options field (and bootp vendor
+ extensions field). */
+ #define DHCP_OPTIONS_COOKIE "\143\202\123\143"
+diff -up dhcp-4.2.0-P1/server/dhcpv6.c.PPP dhcp-4.2.0-P1/server/dhcpv6.c
+--- dhcp-4.2.0-P1/server/dhcpv6.c.PPP 2010-11-05 10:47:37.000000000 +0100
++++ dhcp-4.2.0-P1/server/dhcpv6.c 2010-11-09 15:50:17.000000000 +0100
+@@ -300,6 +300,9 @@ generate_new_server_duid(void) {
+ if (p->hw_address.hlen > 0) {
+ break;
+ }
++ if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) {
++ log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!");
++ }
+ }
+ if (p == NULL) {
+ return ISC_R_UNEXPECTED;
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch b/net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch
new file mode 100644
index 0000000..038d346
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch
@@ -0,0 +1,249 @@
+diff -up dhcp-4.2.2b1/common/bpf.c.xen dhcp-4.2.2b1/common/bpf.c
+--- dhcp-4.2.2b1/common/bpf.c.xen 2009-11-20 02:48:59.000000000 +0100
++++ dhcp-4.2.2b1/common/bpf.c 2011-07-01 14:00:16.936959001 +0200
+@@ -485,7 +485,7 @@ ssize_t receive_packet (interface, buf,
+ offset = decode_udp_ip_header (interface,
+ interface -> rbuf,
+ interface -> rbuf_offset,
+- from, hdr.bh_caplen, &paylen);
++ from, hdr.bh_caplen, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0) {
+diff -up dhcp-4.2.2b1/common/dlpi.c.xen dhcp-4.2.2b1/common/dlpi.c
+--- dhcp-4.2.2b1/common/dlpi.c.xen 2011-05-11 16:20:59.000000000 +0200
++++ dhcp-4.2.2b1/common/dlpi.c 2011-07-01 14:00:16.937958997 +0200
+@@ -693,7 +693,7 @@ ssize_t receive_packet (interface, buf,
+ length -= offset;
+ #endif
+ offset = decode_udp_ip_header (interface, dbuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /*
+ * If the IP or UDP checksum was bad, skip the packet...
+diff -up dhcp-4.2.2b1/common/lpf.c.xen dhcp-4.2.2b1/common/lpf.c
+--- dhcp-4.2.2b1/common/lpf.c.xen 2011-05-10 16:38:58.000000000 +0200
++++ dhcp-4.2.2b1/common/lpf.c 2011-07-01 14:11:24.725748028 +0200
+@@ -29,19 +29,33 @@
+ #include "dhcpd.h"
+ #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
+ #include <sys/ioctl.h>
++#include <sys/socket.h>
+ #include <sys/uio.h>
+ #include <errno.h>
+
+ #include <asm/types.h>
+ #include <linux/filter.h>
+ #include <linux/if_ether.h>
++#include <linux/if_packet.h>
+ #include <netinet/in_systm.h>
+-#include <net/if_packet.h>
+ #include "includes/netinet/ip.h"
+ #include "includes/netinet/udp.h"
+ #include "includes/netinet/if_ether.h"
+ #include <net/if.h>
+
++#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. This
+ is not required for packet-filter APIs. */
+
+@@ -67,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;
+
+ /* Make an LPF socket. */
+- if ((sock = socket(PF_PACKET, SOCK_PACKET,
++ if ((sock = socket(PF_PACKET, SOCK_RAW,
+ htons((short)ETH_P_ALL))) < 0) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+@@ -85,11 +103,17 @@ int if_register_lpf (info)
+ log_fatal ("Open a socket for LPF: %m");
+ }
+
++ memset (&ifr, 0, sizeof ifr);
++ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
++ ifr.ifr_name[IFNAMSIZ-1] = '\0';
++ 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 = AF_PACKET;
+- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
+- if (bind (sock, &sa, sizeof sa)) {
++ sa.ll.sll_family = AF_PACKET;
++ sa.ll.sll_ifindex = ifr.ifr_ifindex;
++ if (bind (sock, &sa.common, sizeof sa)) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ errno == EAFNOSUPPORT || errno == EINVAL) {
+@@ -171,9 +195,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 = if_register_lpf (info);
+
++ val = 1;
++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
++ sizeof val) < 0) {
++ if (errno != ENOPROTOOPT)
++ log_fatal ("Failed to set auxiliary packet data: %m");
++ }
++
+ #if defined (HAVE_TR_SUPPORT)
+ if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
+ lpf_tr_filter_setup (info);
+@@ -295,7 +328,6 @@ ssize_t send_packet (interface, packet,
+ double hh [16];
+ double ih [1536 / sizeof (double)];
+ unsigned char *buf = (unsigned char *)ih;
+- struct sockaddr_pkt sa;
+ int result;
+ int fudge;
+
+@@ -316,17 +348,7 @@ ssize_t send_packet (interface, packet,
+ (unsigned char *)raw, len);
+ memcpy (buf + ibufp, raw, len);
+
+- /* 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.spkt_family = AF_PACKET;
+- strncpy ((char *)sa.spkt_device,
+- (const char *)interface -> ifp, sizeof sa.spkt_device);
+- sa.spkt_protocol = htons(ETH_P_IP);
+-
+- result = sendto (interface -> wfdesc,
+- buf + fudge, ibufp + len - fudge, 0,
+- (const struct sockaddr *)&sa, sizeof sa);
++ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
+ if (result < 0)
+ log_error ("send_packet: %m");
+ return result;
+@@ -343,14 +365,35 @@ ssize_t receive_packet (interface, buf,
+ {
+ int length = 0;
+ int offset = 0;
++ int nocsum = 0;
+ unsigned char ibuf [1536];
+ unsigned bufix = 0;
+ unsigned paylen;
++ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
++ struct iovec iov = {
++ .iov_base = ibuf,
++ .iov_len = sizeof ibuf,
++ };
++ struct msghdr msg = {
++ .msg_iov = &iov,
++ .msg_iovlen = 1,
++ .msg_control = cmsgbuf,
++ .msg_controllen = sizeof(cmsgbuf),
++ };
++ struct cmsghdr *cmsg;
+
+- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
++ length = recvmsg (interface -> rfdesc, &msg, 0);
+ if (length <= 0)
+ return length;
+
++ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
++ if (cmsg->cmsg_level == SOL_PACKET &&
++ cmsg->cmsg_type == PACKET_AUXDATA) {
++ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
++ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
++ }
++ }
++
+ bufix = 0;
+ /* Decode the physical header... */
+ offset = decode_hw_header (interface, ibuf, bufix, hfrom);
+@@ -367,7 +410,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix, from,
+- (unsigned)length, &paylen);
++ (unsigned)length, &paylen, nocsum);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-4.2.2b1/common/nit.c.xen dhcp-4.2.2b1/common/nit.c
+--- dhcp-4.2.2b1/common/nit.c.xen 2009-11-20 02:49:01.000000000 +0100
++++ dhcp-4.2.2b1/common/nit.c 2011-07-01 14:00:16.939958989 +0200
+@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-4.2.2b1/common/packet.c.xen dhcp-4.2.2b1/common/packet.c
+--- dhcp-4.2.2b1/common/packet.c.xen 2009-07-23 20:52:20.000000000 +0200
++++ dhcp-4.2.2b1/common/packet.c 2011-07-01 14:00:16.939958989 +0200
+@@ -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))));
+
+ udp_packets_seen++;
+- if (usum && usum != sum) {
++ if (!nocsum && usum && usum != sum) {
+ udp_packets_bad_checksum++;
+ if (udp_packets_seen > 4 &&
+ (udp_packets_seen / udp_packets_bad_checksum) < 2) {
+diff -up dhcp-4.2.2b1/common/upf.c.xen dhcp-4.2.2b1/common/upf.c
+--- dhcp-4.2.2b1/common/upf.c.xen 2009-11-20 02:49:01.000000000 +0100
++++ dhcp-4.2.2b1/common/upf.c 2011-07-01 14:00:16.940958986 +0200
+@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-4.2.2b1/includes/dhcpd.h.xen dhcp-4.2.2b1/includes/dhcpd.h
+--- dhcp-4.2.2b1/includes/dhcpd.h.xen 2011-07-01 14:00:16.000000000 +0200
++++ dhcp-4.2.2b1/includes/dhcpd.h 2011-07-01 14:12:18.069642470 +0200
+@@ -2796,7 +2796,7 @@ ssize_t decode_hw_header (struct interfa
+ unsigned, struct hardware *);
+ ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *,
+ unsigned, struct sockaddr_in *,
+- unsigned, unsigned *);
++ unsigned, unsigned *, int);
+
+ /* ethernet.c */
+ void assemble_ethernet_header (struct interface_info *, unsigned char *,
diff --git a/net-misc/dhcp/files/dhcp-4.2.3-options.patch b/net-misc/dhcp/files/dhcp-4.2.3-options.patch
new file mode 100644
index 0000000..c902e62
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.2.3-options.patch
@@ -0,0 +1,391 @@
+diff -up dhcp-4.2.3-P2/client/clparse.c.options dhcp-4.2.3-P2/client/clparse.c
+--- dhcp-4.2.3-P2/client/clparse.c.options 2011-04-21 16:08:14.000000000 +0200
++++ dhcp-4.2.3-P2/client/clparse.c 2012-02-13 18:21:32.233471518 +0100
+@@ -146,6 +146,7 @@ isc_result_t read_client_conf ()
+ /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
+ */
+ top_level_config.requested_lease = 7200;
++ top_level_config.bootp_broadcast_always = 0;
+
+ group_allocate (&top_level_config.on_receipt, MDL);
+ if (!top_level_config.on_receipt)
+@@ -313,7 +314,8 @@ void read_client_leases ()
+ interface-declaration |
+ LEASE client-lease-statement |
+ ALIAS client-lease-statement |
+- KEY key-definition */
++ KEY key-definition |
++ BOOTP_BROADCAST_ALWAYS */
+
+ void parse_client_statement (cfile, ip, config)
+ struct parse *cfile;
+@@ -732,6 +734,12 @@ void parse_client_statement (cfile, ip,
+ parse_reject_statement (cfile, config);
+ return;
+
++ case BOOTP_BROADCAST_ALWAYS:
++ token = next_token(&val, (unsigned*)0, cfile);
++ config -> bootp_broadcast_always = 1;
++ parse_semi (cfile);
++ return;
++
+ default:
+ lose = 0;
+ stmt = (struct executable_statement *)0;
+diff -up dhcp-4.2.3-P2/client/dhclient.c.options dhcp-4.2.3-P2/client/dhclient.c
+--- dhcp-4.2.3-P2/client/dhclient.c.options 2011-12-31 01:55:21.000000000 +0100
++++ dhcp-4.2.3-P2/client/dhclient.c 2012-02-13 18:22:11.554979930 +0100
+@@ -39,6 +39,12 @@
+ #include <limits.h>
+ #include <dns/result.h>
+
++/*
++ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
++ * that when building ISC code.
++ */
++extern int asprintf(char **strp, const char *fmt, ...);
++
+ TIME default_lease_time = 43200; /* 12 hours... */
+ TIME max_lease_time = 86400; /* 24 hours... */
+
+@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute
+ int wanted_ia_ta = 0;
+ int wanted_ia_pd = 0;
+ char *mockup_relay = NULL;
++int bootp_broadcast_always = 0;
++
++extern u_int32_t default_requested_options[];
+
+ void run_stateless(int exit_mode);
+
+@@ -123,6 +132,15 @@ main(int argc, char **argv) {
+ int local_family_set = 0;
+ #endif /* DHCPv6 */
+ char *s;
++ char *dhcp_client_identifier_arg = NULL;
++ char *dhcp_host_name_arg = NULL;
++ char *dhcp_fqdn_arg = NULL;
++ char *dhcp_vendor_class_identifier_arg = NULL;
++ char *dhclient_request_options = NULL;
++
++ int timeout_arg = 0;
++ char *arg_conf = NULL;
++ int arg_conf_len = 0;
+
+ /* Initialize client globals. */
+ memset(&default_duid, 0, sizeof(default_duid));
+@@ -310,6 +328,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 == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_client_identifier_arg = argv[i];
++ } else if (!strcmp(argv[i], "-B")) {
++ bootp_broadcast_always = 1;
++ } else if (!strcmp(argv[i], "-H")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= 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 != NULL) {
++ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_host_name_arg = argv[i];
++ } else if (!strcmp(argv[i], "-F")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= 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 != NULL) {
++ log_error("Only one -F <fqdn> argument can be specified");
++ exit(1);
++ }
++
++ if (dhcp_host_name_arg != NULL) {
++ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_fqdn_arg = argv[i];
++ } else if (!strcmp(argv[i], "-timeout")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if ((timeout_arg = atoi(argv[i])) <= 0) {
++ log_error("timeout option must be > 0 - bad value: %s",argv[i]);
++ exit(1);
++ }
++ } else if (!strcmp(argv[i], "-V")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_vendor_class_identifier_arg = argv[i];
++ } else if (!strcmp(argv[i], "-R")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage();
++ exit(1);
++ }
++
++ dhclient_request_options = argv[i];
+ } else if (argv[i][0] == '-') {
+ usage();
+ } else if (interfaces_requested < 0) {
+@@ -484,6 +584,156 @@ main(int argc, char **argv) {
+ /* Parse the dhclient.conf file. */
+ read_client_conf();
+
++ /* Parse any extra command line configuration arguments: */
++ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
++ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -I option dhcp-client-identifier");
++ }
++
++ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (timeout_arg) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to process -timeout timeout argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len == 0))
++ log_fatal("Unable to process -timeout timeout argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (dhclient_request_options != NULL) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (arg_conf) {
++ if (arg_conf_len == 0)
++ if ((arg_conf_len = strlen(arg_conf)) == 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 = (struct parse *)0;
++ const char *val = NULL;
++ int token;
++
++ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
++
++ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
++ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
++ /* more detailed parse failures will be logged */
++
++ do {
++ token = peek_token(&val, (unsigned *)0, cfile);
++ if (token == 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 arguments !");
++ end_parse(&cfile);
++
++ if (timeout_arg) {
++ /* we just set the toplevel timeout, but per-client
++ * timeouts may still be at defaults.
++ */
++ for (ip=interfaces; ip; ip = ip->next) {
++ if (ip->client->config->timeout == 60)
++ ip->client->config->timeout = timeout_arg;
++ }
++ }
++
++ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
++ for (ip=interfaces; ip; ip = ip->next) {
++ if (ip->client->config->requested_options == default_requested_options)
++ ip->client->config->requested_options = top_level_config.requested_options;
++ }
++ }
++
++ free(arg_conf);
++ arg_conf = NULL;
++ arg_conf_len = 0;
++ }
++
+ /* Parse the lease database. */
+ read_client_leases();
+
+@@ -2397,7 +2647,8 @@ void make_discover (client, lease)
+ client -> packet.xid = random ();
+ client -> packet.secs = 0; /* filled in by send_discover. */
+
+- 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 = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2481,7 +2732,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 = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2543,7 +2796,8 @@ void make_decline (client, lease)
+ client -> packet.hops = 0;
+ client -> packet.xid = client -> xid;
+ client -> packet.secs = 0; /* Filled in by send_request. */
+- 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 = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+diff -up dhcp-4.2.3-P2/common/conflex.c.options dhcp-4.2.3-P2/common/conflex.c
+--- dhcp-4.2.3-P2/common/conflex.c.options 2011-09-21 22:43:10.000000000 +0200
++++ dhcp-4.2.3-P2/common/conflex.c 2012-02-13 18:21:32.335470243 +0100
+@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
+ 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.3-P2/includes/dhcpd.h.options dhcp-4.2.3-P2/includes/dhcpd.h
+--- dhcp-4.2.3-P2/includes/dhcpd.h.options 2011-12-31 00:17:04.000000000 +0100
++++ dhcp-4.2.3-P2/includes/dhcpd.h 2012-02-13 18:21:32.542467656 +0100
+@@ -1147,6 +1147,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_BROADCAST
++ flag in requests */
+ };
+
+ /* Per-interface state used in the dhcp client... */
+diff -up dhcp-4.2.3-P2/includes/dhctoken.h.options dhcp-4.2.3-P2/includes/dhctoken.h
+--- dhcp-4.2.3-P2/includes/dhctoken.h.options 2011-09-21 22:43:10.000000000 +0200
++++ dhcp-4.2.3-P2/includes/dhctoken.h 2012-02-13 18:21:32.644466377 +0100
+@@ -363,7 +363,8 @@ enum dhcp_token {
+ INITIAL_DELAY = 664,
+ GETHOSTBYNAME = 665,
+ PRIMARY6 = 666,
+- SECONDARY6 = 667
++ SECONDARY6 = 667,
++ BOOTP_BROADCAST_ALWAYS = 668
+ };
+
+ #define is_identifier(x) ((x) >= FIRST_TOKEN && \
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/
@ 2013-06-13 16:42 Justin Lecher
0 siblings, 0 replies; 9+ messages in thread
From: Justin Lecher @ 2013-06-13 16:42 UTC (permalink / raw
To: gentoo-commits
commit: 8a86115f1ba95df631c27109752fc7c7070d36c6
Author: Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 13 12:57:18 2013 +0000
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Thu Jun 13 12:57:18 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=8a86115f
Obsolete package
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>
---
net-misc/dhcp/ChangeLog | 61 ---
net-misc/dhcp/dhcp-4.2.3_p2-r1.ebuild | 245 ----------
net-misc/dhcp/files/dhcp-3.0-fix-perms.patch | 15 -
net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch | 84 ----
.../dhcp/files/dhcp-3.0.3-dhclient-no-down.patch | 70 ---
net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch | 216 ---------
net-misc/dhcp/files/dhcp-4.2.0-PPP.patch | 150 ------
.../dhcp/files/dhcp-4.2.0-errwarn-message.patch | 31 --
.../dhcp/files/dhcp-4.2.2-bind-build-flags.patch | 14 -
net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch | 13 -
.../files/dhcp-4.2.2-bind-parallel-build.patch | 14 -
.../files/dhcp-4.2.2-dhclient-resolvconf.patch | 409 ----------------
.../files/dhcp-4.2.2-dhclient-stdin-conf.patch | 113 -----
net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch | 132 -----
net-misc/dhcp/files/dhcp-4.2.2-improved-xid.patch | 138 ------
net-misc/dhcp/files/dhcp-4.2.2-lpf-ib.patch | 538 ---------------------
net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch | 46 --
net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch | 249 ----------
net-misc/dhcp/files/dhcp-4.2.3-options.patch | 391 ---------------
net-misc/dhcp/files/dhcpd.conf2 | 28 --
net-misc/dhcp/files/dhcpd.init2 | 94 ----
net-misc/dhcp/files/dhcpd.init5 | 114 -----
net-misc/dhcp/files/dhcrelay.conf | 13 -
net-misc/dhcp/files/dhcrelay.init2 | 29 --
net-misc/dhcp/metadata.xml | 10 -
25 files changed, 3217 deletions(-)
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
deleted file mode 100644
index 0b811b8..0000000
--- a/net-misc/dhcp/ChangeLog
+++ /dev/null
@@ -1,61 +0,0 @@
-# ChangeLog for net-misc/dhcp
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: $
-
-*dhcp-4.2.3_p2-r1 (15 Mar 2012)
-
- 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org> +dhcp-4.2.3_p2-r1.ebuild,
- +files/dhcp-4.2.0-PPP.patch, +files/dhcp-4.2.2-xen-checksum.patch,
- +files/dhcp-4.2.3-options.patch, -dhcp-4.2.3_p1-r1.ebuild:
- [net-misc/dhcp] Import more patches to make also client work
-
- 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
- +files/dhcp-4.2.2-gpxe-cid.patch, +files/dhcp-4.2.2-improved-xid.patch,
- +files/dhcp-4.2.2-lpf-ib.patch, -files/dhcp-4.2.0-ib-options.patch,
- -files/dhcp-4.2.0-improved-xid.patch, -files/dhcp-4.2.0-lpf-ib.patch,
- dhcp-4.2.3_p1-r1.ebuild:
- [net-misc/dhcp] Import patches from F17
-
- 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
- files/dhcp-4.2.0-ib-options.patch:
- [net-misc/dhcp] once again
-
- 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
- files/dhcp-4.2.0-ib-options.patch:
- [net-misc/dhcp] once again
-
- 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
- files/dhcp-4.2.0-ib-options.patch:
- [net-misc/dhcp] wrong one =D
-
- 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org>
- files/dhcp-4.2.0-ib-options.patch:
- [net-misc/dhcp] Opps fix patch
-
-*dhcp-4.2.3_p1-r1 (15 Mar 2012)
-
- 15 Mar 2012; Alexey Shvetsov <alexxy@gentoo.org> +dhcp-4.2.3_p1-r1.ebuild,
- +files/dhcp-4.2.0-ib-options.patch, +files/dhcp-4.2.2-bind-build-flags.patch,
- +files/dhcp-4.2.2-bind-disable.patch,
- +files/dhcp-4.2.2-bind-parallel-build.patch,
- +files/dhcp-4.2.2-dhclient-resolvconf.patch,
- +files/dhcp-4.2.2-dhclient-stdin-conf.patch,
- +files/dhcp-4.2.2-nogateway.patch, +files/dhcpd.conf2, +files/dhcpd.init5,
- -ChangeLog, -dhcp-4.2.1_p1-r1.ebuild, -files/dhcp-3.0-paranoia.patch,
- -files/dhcp-3.0.2-gmake.patch, -files/dhcp-3.0.3-dhclient-hostname.patch,
- -files/dhcp-3.0.3-dhclient-metric.patch, -files/dhcp-3.0.3-dhclient-mtu.patch,
- -files/dhcp-3.0.3-dhclient-ntp.patch, -files/dhcp-3.0.3-libdst.patch,
- -files/dhcp-3.0.3-no_isc_blurb.patch,
- -files/dhcp-3.0.4-dhclient-stdin-conf.patch,
- -files/dhcp-3.0.5-bpf-nofallback.patch,
- -files/dhcp-3.1.0a1-dhclient-resolvconf.patch,
- -files/dhcp-3.1.2_p1-CVE-2009-1892.patch,
- -files/dhcp-3.1.3-dhclient-no-down.patch,
- -files/dhcp-4.0.1-dhclient-stdin-conf.patch, -files/dhcp-4.2.0-options.patch,
- -files/dhcp-4.2.0-xen-checksum.patch,
- -files/dhcp-4.2.1-dhclient-resolvconf.patch,
- -files/dhcp-4.2.1-nogateway.patch, -files/dhcpd.conf, -files/dhcpd.init3,
- -files/dhcrelay.init, files/dhcp-4.2.0-improved-xid.patch,
- files/dhcp-4.2.0-lpf-ib.patch, metadata.xml:
- [net-misc/dhcp] Enable infiniband in new version
-
diff --git a/net-misc/dhcp/dhcp-4.2.3_p2-r1.ebuild b/net-misc/dhcp/dhcp-4.2.3_p2-r1.ebuild
deleted file mode 100644
index e0d8625..0000000
--- a/net-misc/dhcp/dhcp-4.2.3_p2-r1.ebuild
+++ /dev/null
@@ -1,245 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-4.2.3_p1.ebuild,v 1.7 2012/01/01 15:03:13 armin76 Exp $
-
-EAPI="2"
-
-inherit eutils user toolchain-funcs
-
-MY_PV="${PV//_alpha/a}"
-MY_PV="${MY_PV//_beta/b}"
-MY_PV="${MY_PV//_rc/rc}"
-MY_PV="${MY_PV//_p/-P}"
-MY_P="${PN}-${MY_PV}"
-DESCRIPTION="ISC Dynamic Host Configuration Protocol (DHCP) client/server"
-HOMEPAGE="http://www.isc.org/products/DHCP"
-SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz
- ftp://ftp.isc.org/isc/dhcp/${MY_PV}/${MY_P}.tar.gz"
-
-LICENSE="as-is BSD"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
-IUSE="+client ipv6 infiniband kernel_linux ldap selinux +server ssl vim-syntax"
-
-DEPEND="selinux? ( sec-policy/selinux-dhcp )
- kernel_linux? ( sys-apps/net-tools )
- ldap? (
- net-nds/openldap
- ssl? ( dev-libs/openssl )
- )"
-RDEPEND="${DEPEND}
- vim-syntax? ( app-vim/dhcpd-syntax )"
-
-S="${WORKDIR}/${MY_P}"
-
-src_unpack() {
- unpack ${A}
- # handle local bind hell
- cd "${S}"/bind
- unpack ./bind.tar.gz
-}
-
-src_prepare() {
- # Gentoo patches - these will probably never be accepted upstream
- # Fix some permission issues
- epatch "${FILESDIR}"/${PN}-3.0-fix-perms.patch
- # Enable dhclient to equery NTP servers
- epatch "${FILESDIR}"/${PN}-4.0-dhclient-ntp.patch
- # resolvconf support in dhclient-script
- epatch "${FILESDIR}"/${PN}-4.2.2-dhclient-resolvconf.patch
- # Stop downing the interface on Linux as that breaks link daemons
- # such as wpa_supplicant and netplug
- epatch "${FILESDIR}"/${PN}-3.0.3-dhclient-no-down.patch
- epatch "${FILESDIR}"/${PN}-4.2.0-errwarn-message.patch
- # Enable dhclient to get extra configuration from stdin
- epatch "${FILESDIR}"/${PN}-4.2.2-dhclient-stdin-conf.patch
- epatch "${FILESDIR}"/${PN}-4.2.2-nogateway.patch #265531
-
- # NetworkManager support patches
- # If they fail to apply to future versions they will be dropped
- # Add dbus support to dhclient
- epatch "${FILESDIR}"/${PN}-3.0.3-dhclient-dbus.patch
-
- # infiniband patches
- if use infiniband; then
- epatch "${FILESDIR}"/${PN}-4.2.3-options.patch
- epatch "${FILESDIR}"/${PN}-4.2.2-xen-checksum.patch
- epatch "${FILESDIR}"/${PN}-4.2.0-PPP.patch
- epatch "${FILESDIR}"/${PN}-4.2.2-lpf-ib.patch
- epatch "${FILESDIR}"/${PN}-4.2.2-improved-xid.patch
- epatch "${FILESDIR}"/${PN}-4.2.2-gpxe-cid.patch
- fi
-
- # Brand the version with Gentoo
- sed -i \
- -e "/VERSION=/s:'$: Gentoo-${PR}':" \
- configure || die
-
- # Change the hook script locations of the scripts
- sed -i \
- -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
- -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
- client/scripts/* || die
-
- # No need for the linux script to force bash #158540
- sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
-
- # Quiet the freebsd logger a little
- sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
-
- # Remove these options from the sample config
- sed -i \
- -e "/\(script\|host-name\|domain-name\) / d" \
- client/dhclient.conf || die
-
- if use client && ! use server ; then
- sed -i -r \
- -e '/^SUBDIRS/s:\<(dhcpctl|relay|server)\>::g' \
- Makefile.in || die
- elif ! use client && use server ; then
- sed -i -r \
- -e '/^SUBDIRS/s:\<client\>::' \
- Makefile.in || die
- fi
-
- # Only install different man pages if we don't have en
- if [[ " ${LINGUAS} " != *" en "* ]]; then
- # Install Japanese man pages
- if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
- einfo "Installing Japanese documention"
- cp doc/ja_JP.eucJP/dhclient* client
- cp doc/ja_JP.eucJP/dhcp* common
- fi
- fi
- # Now remove the non-english docs so there are no errors later
- rm -rf doc/ja_JP.eucJP
-
- # make the bind build work
- binddir=${S}/bind
- cd "${binddir}" || die
- cat <<-EOF > bindvar.tmp
- binddir=${binddir}
- GMAKE=${MAKE:-gmake}
- EOF
- epatch "${FILESDIR}"/${PN}-4.2.2-bind-disable.patch
- cd bind-*/
- epatch "${FILESDIR}"/${PN}-4.2.2-bind-parallel-build.patch #380717
- epatch "${FILESDIR}"/${PN}-4.2.2-bind-build-flags.patch
-}
-
-src_configure() {
- # bind defaults to stupid `/usr/bin/ar`
- tc-export AR BUILD_CC
- export ac_cv_path_AR=${AR}
-
- # this is tested for by the bind build system, and can cause trouble
- # when cross-building; since dhcp itself doesn't make use of libcap,
- # simply disable it.
- export ac_cv_lib_cap_cap_set_proc=no
-
- # Use FHS sane paths ... some of these have configure options,
- # but not all, so just do it all here.
- local e="/etc/dhcp" r="/var/run/dhcp" l="/var/lib/dhcp"
- cat <<-EOF >> includes/site.h
- #define _PATH_DHCPD_CONF "${e}/dhcpd.conf"
- #define _PATH_DHCLIENT_CONF "${e}/dhclient.conf"
- #define _PATH_DHCPD_DB "${l}/dhcpd.leases"
- #define _PATH_DHCPD6_DB "${l}/dhcpd6.leases"
- #define _PATH_DHCLIENT_DB "${l}/dhclient.leases"
- #define _PATH_DHCLIENT6_DB "${l}/dhclient6.leases"
- #define _PATH_DHCPD_PID "${r}/dhcpd.pid"
- #define _PATH_DHCPD6_PID "${r}/dhcpd6.pid"
- #define _PATH_DHCLIENT_PID "${r}/dhcpclient.pid"
- #define _PATH_DHCLIENT6_PID "${r}/dhcpclient6.pid"
- #define _PATH_DHCRELAY_PID "${r}/dhcrelay.pid"
- #define _PATH_DHCRELAY6_PID "${r}/dhcrelay6.pid"
- EOF
-
- econf \
- --enable-paranoia \
- --enable-early-chroot \
- --sysconfdir=${e} \
- $(use_enable ipv6 dhcpv6) \
- $(use_with ldap) \
- $(use ldap && use_with ssl ldapcrypto || echo --without-ldapcrypto)
-
- # configure local bind cruft. symtable option requires
- # perl and we don't want to require that #383837.
- cd bind/bind-*/ || die
- eval econf \
- $(sed -n '/ [.].configure /{s:^[^-]*::;s:>.*::;p}' ../Makefile) \
- --disable-symtable \
- --without-make-clean
-}
-
-src_compile() {
- # build local bind cruft first
- emake -C bind/bind-*/lib/export install || die
- # then build standard dhcp code
- emake || die
-}
-
-src_install() {
- emake install DESTDIR="${D}" || die
-
- dodoc README RELNOTES doc/{api+protocol,IANA-arp-parameters}
- dohtml doc/References.html
-
- if [[ -e client/dhclient ]] ; then
- # move the client to /
- dodir /sbin
- mv "${D}"/usr/sbin/dhclient "${D}"/sbin/ || die
-
- exeinto /sbin
- if use kernel_linux ; then
- newexe "${S}"/client/scripts/linux dhclient-script || die
- else
- newexe "${S}"/client/scripts/freebsd dhclient-script || die
- fi
- 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.init5 dhcpd || die
- newconfd "${FILESDIR}"/dhcpd.conf2 dhcpd || die
- newinitd "${FILESDIR}"/dhcrelay.init2 dhcrelay || die
- newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay || die
- fi
-
- # the default config files aren't terribly useful #384087
- sed -i '/^[^#]/s:^:#:' "${D}"/etc/dhcp/*.conf || die
-}
-
-pkg_preinst() {
- enewgroup dhcp
- enewuser dhcp -1 -1 /var/lib/dhcp dhcp
-
- # Keep the user files over the sample ones. The
- # hashing is to ignore the crappy defaults #384087.
- local f h
- for f in dhclient:da7c8496a96452190aecf9afceef4510 dhcpd:10979e7b71134bd7f04d2a60bd58f070 ; do
- h=${f#*:}
- f="/etc/dhcp/${f%:*}.conf"
- if [ -e "${ROOT}"${f} ] ; then
- case $(md5sum "${ROOT}"${f}) in
- ${h}*) ;;
- *) cp -p "${ROOT}"${f} "${D}"${f};;
- esac
- fi
- done
-}
-
-pkg_postinst() {
- 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
-}
diff --git a/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch b/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch
deleted file mode 100644
index 13debb2..0000000
--- a/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- 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);
-
-+#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, (int) set_gid);
-+#endif /* PARANOIA */
-+
- /* Discover all the network interfaces and initialize them. */
- discover_interfaces (DISCOVER_SERVER);
-
diff --git a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch b/net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch
deleted file mode 100644
index 579d72f..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-dbus.patch
+++ /dev/null
@@ -1,84 +0,0 @@
---- 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 != x -a $exit_status -eq 0 ]; then
-+ dbus-send --system --dest=com.redhat.dhcp \
-+ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
-+ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
-+ fi
- exit $exit_status
- }
-
---- 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 != x -a $exit_status -eq 0 ]; then
-+ dbus-send --system --dest=com.redhat.dhcp \
-+ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
-+ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
-+ fi
- exit $exit_status
- }
-
---- 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 != x -a $exit_status -eq 0 ]; then
-+ dbus-send --system --dest=com.redhat.dhcp \
-+ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
-+ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
-+ fi
- exit $exit_status
- }
-
---- 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 != x -a $exit_status -eq 0 ]; then
-+ dbus-send --system --dest=com.redhat.dhcp \
-+ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
-+ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
-+ fi
- exit $exit_status
- }
-
---- 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 != x -a $exit_status -eq 0 ]; then
-+ dbus-send --system --dest=com.redhat.dhcp \
-+ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
-+ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
-+ fi
- exit $exit_status
- }
-
---- 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 != x -a $exit_status -eq 0 ]; then
-+ dbus-send --system --dest=com.redhat.dhcp \
-+ --type=method_call /com/redhat/dhcp/$interface com.redhat.dhcp.set \
-+ 'string:'"`env | grep -Ev '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`"
-+ fi
- exit $exit_status
- }
-
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
deleted file mode 100644
index 518efec..0000000
--- a/net-misc/dhcp/files/dhcp-3.0.3-dhclient-no-down.patch
+++ /dev/null
@@ -1,70 +0,0 @@
---- client/scripts/linux
-+++ client/scripts/linux
-@@ -118,9 +118,9 @@
- if [ x$reason = xPREINIT ]; then
- if [ x$alias_ip_address != 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
-
- # We need to give the kernel some time to get the interface up.
- sleep 1
-@@ -145,12 +145,12 @@
- if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
- [ x$alias_ip_address != 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 != x ] && [ x$old_ip_address != x$new_ip_address ]; then
- # IP address changed. Bringing down the interface will delete all routes,
- # and clear the ARP cache.
-- ifconfig $interface inet 0 down
-+ ifconfig $interface inet 0.0.0.0
-
- fi
- if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
-@@ -171,7 +171,7 @@
- fi
- if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != 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 = xSTOP ]; then
- if [ x$alias_ip_address != 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 != 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 != x ]; then
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
-@@ -198,7 +198,7 @@
-
- if [ x$reason = xTIMEOUT ]; then
- if [ x$alias_ip_address != 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
-
diff --git a/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch b/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch
deleted file mode 100644
index d3f2971..0000000
--- a/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch
+++ /dev/null
@@ -1,216 +0,0 @@
-diff -uNr dhcp-4.0.0.ORIG/client/clparse.c dhcp-4.0.0/client/clparse.c
---- dhcp-4.0.0.ORIG/client/clparse.c 2008-09-01 11:38:51.000000000 +0100
-+++ dhcp-4.0.0/client/clparse.c 2008-09-01 11:48:17.000000000 +0100
-@@ -37,7 +37,7 @@
-
- struct client_config top_level_config;
-
--#define NUM_DEFAULT_REQUESTED_OPTS 9
-+#define NUM_DEFAULT_REQUESTED_OPTS 10
- struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1];
-
- static void parse_client_default_duid(struct parse *cfile);
-@@ -98,15 +98,20 @@
- dhcp_universe.code_hash, &code, 0, MDL);
-
- /* 8 */
-- code = D6O_NAME_SERVERS;
-+ code = DHO_NTP_SERVERS;
- option_code_hash_lookup(&default_requested_options[7],
-- dhcpv6_universe.code_hash, &code, 0, MDL);
-+ dhcp_universe.code_hash, &code, 0, MDL);
-
- /* 9 */
-- code = D6O_DOMAIN_SEARCH;
-+ code = D6O_NAME_SERVERS;
- option_code_hash_lookup(&default_requested_options[8],
- dhcpv6_universe.code_hash, &code, 0, MDL);
-
-+ /* 10 */
-+ code = D6O_DOMAIN_SEARCH;
-+ option_code_hash_lookup(&default_requested_options[9],
-+ dhcpv6_universe.code_hash, &code, 0, MDL);
-+
- for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
- if (default_requested_options[code] == NULL)
- log_fatal("Unable to find option definition for "
-diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos
---- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 11:38:51.000000000 +0100
-+++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 11:39:30.000000000 +0100
-@@ -29,6 +29,26 @@
-
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
- fi
-+ # If we're making confs, may as well make an ntp.conf too
-+ make_ntp_conf
-+}
-+
-+make_ntp_conf() {
-+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ x$new_ntp_servers != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
-diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd
---- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 11:38:51.000000000 +0100
-+++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 11:39:30.000000000 +0100
-@@ -73,6 +73,26 @@
- fi
- fi
- fi
-+ # If we're making confs, may as well make an ntp.conf too
-+ make_ntp_conf
-+}
-+
-+make_ntp_conf() {
-+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
-diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
---- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 11:38:51.000000000 +0100
-+++ dhcp-4.0.0/client/scripts/linux 2008-09-01 11:39:30.000000000 +0100
-@@ -55,6 +55,26 @@
-
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
- fi
-+ # If we're making confs, may as well make an ntp.conf too
-+ make_ntp_conf
-+}
-+
-+make_ntp_conf() {
-+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
-diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd
---- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 11:38:51.000000000 +0100
-+++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 11:39:30.000000000 +0100
-@@ -29,6 +29,26 @@
-
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
- fi
-+ # If we're making confs, may as well make an ntp.conf too
-+ make_ntp_conf
-+}
-+
-+make_ntp_conf() {
-+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
-diff -uNr dhcp-4.0.0.ORIG/client/scripts/openbsd dhcp-4.0.0/client/scripts/openbsd
---- dhcp-4.0.0.ORIG/client/scripts/openbsd 2008-09-01 11:38:51.000000000 +0100
-+++ dhcp-4.0.0/client/scripts/openbsd 2008-09-01 11:39:30.000000000 +0100
-@@ -29,6 +29,26 @@
-
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
- fi
-+ # If we're making confs, may as well make an ntp.conf too
-+ make_ntp_conf
-+}
-+
-+make_ntp_conf() {
-+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
-diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris
---- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 11:38:51.000000000 +0100
-+++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 11:39:30.000000000 +0100
-@@ -17,6 +17,26 @@
-
- mv /etc/resolv.conf.dhclient /etc/resolv.conf
- fi
-+ # If we're making confs, may as well make an ntp.conf too
-+ make_ntp_conf
-+}
-+
-+make_ntp_conf() {
-+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
-+ if [ "x$new_ntp_servers" != x ]; then
-+ conf="# Generated by dhclient for interface $interface\n"
-+ conf="${conf}restrict default noquery notrust nomodify\n"
-+ conf="${conf}restrict 127.0.0.1\n"
-+ for ntpserver in $new_ntp_servers; do
-+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
-+ conf="${conf}server $ntpserver\n"
-+ done
-+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
-+ conf="${conf}logfile /var/log/ntp.log\n"
-+ printf "${conf}" > /etc/ntp.conf
-+ chmod 644 /etc/ntp.conf
-+ fi
-+ fi
- }
-
- # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-PPP.patch b/net-misc/dhcp/files/dhcp-4.2.0-PPP.patch
deleted file mode 100644
index bef2be7..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.0-PPP.patch
+++ /dev/null
@@ -1,150 +0,0 @@
-diff -up dhcp-4.2.0-P1/client/dhc6.c.PPP dhcp-4.2.0-P1/client/dhc6.c
---- dhcp-4.2.0-P1/client/dhc6.c.PPP 2010-11-05 10:47:37.000000000 +0100
-+++ dhcp-4.2.0-P1/client/dhc6.c 2010-11-09 15:54:12.000000000 +0100
-@@ -129,7 +129,7 @@ extern int stateless;
- * is not how it is intended. Upcoming rearchitecting the client should
- * address this "one daemon model."
- */
--void
-+isc_result_t
- form_duid(struct data_string *duid, const char *file, int line)
- {
- struct interface_info *ip;
-@@ -141,6 +141,15 @@ form_duid(struct data_string *duid, cons
- if (ip == NULL)
- log_fatal("Impossible condition at %s:%d.", MDL);
-
-+ while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) {
-+ /* Try the other interfaces */
-+ log_debug("Cannot form default DUID from interface %s.", ip->name);
-+ ip = ip->next;
-+ }
-+ if (ip == NULL) {
-+ return ISC_R_UNEXPECTED;
-+ }
-+
- if ((ip->hw_address.hlen == 0) ||
- (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf)))
- log_fatal("Impossible hardware address length at %s:%d.", MDL);
-@@ -176,6 +185,8 @@ form_duid(struct data_string *duid, cons
- memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1,
- ip->hw_address.hlen - 1);
- }
-+
-+ return ISC_R_SUCCESS;
- }
-
- /*
-@@ -5289,7 +5300,8 @@ make_client6_options(struct client_state
- */
- if ((oc = lookup_option(&dhcpv6_universe, *op,
- D6O_CLIENTID)) == NULL) {
-- if (!option_cache(&oc, &default_duid, NULL, clientid_option,
-+ if (default_duid.len == 0 ||
-+ !option_cache(&oc, &default_duid, NULL, clientid_option,
- MDL))
- log_fatal("Failure assembling a DUID.");
-
-diff -up dhcp-4.2.0-P1/client/dhclient.c.PPP dhcp-4.2.0-P1/client/dhclient.c
---- dhcp-4.2.0-P1/client/dhclient.c.PPP 2010-11-05 10:47:37.000000000 +0100
-+++ dhcp-4.2.0-P1/client/dhclient.c 2010-11-09 15:37:26.000000000 +0100
-@@ -911,8 +911,8 @@ main(int argc, char **argv) {
- if (default_duid.buffer != NULL)
- data_string_forget(&default_duid, MDL);
-
-- form_duid(&default_duid, MDL);
-- write_duid(&default_duid);
-+ if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS)
-+ write_duid(&default_duid);
- }
-
- for (ip = interfaces ; ip != NULL ; ip = ip->next) {
-diff -up dhcp-4.2.0-P1/common/bpf.c.PPP dhcp-4.2.0-P1/common/bpf.c
---- dhcp-4.2.0-P1/common/bpf.c.PPP 2010-11-05 10:47:37.000000000 +0100
-+++ dhcp-4.2.0-P1/common/bpf.c 2010-11-09 15:42:42.000000000 +0100
-@@ -599,6 +599,22 @@ get_hw_addr(const char *name, struct har
- memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen);
- break;
- #endif /* IFT_FDDI */
-+#if defined(IFT_PPP)
-+ case IFT_PPP:
-+ if (local_family != AF_INET6)
-+ log_fatal("Unsupported device type %d for \"%s\"",
-+ sa->sdl_type, name);
-+ hw->hlen = 0;
-+ hw->hbuf[0] = HTYPE_RESERVED;
-+ /* 0xdeadbeef should never occur on the wire,
-+ * and is a signature that something went wrong.
-+ */
-+ hw->hbuf[1] = 0xde;
-+ hw->hbuf[2] = 0xad;
-+ hw->hbuf[3] = 0xbe;
-+ hw->hbuf[4] = 0xef;
-+ break;
-+#endif
- default:
- log_fatal("Unsupported device type %d for \"%s\"",
- sa->sdl_type, name);
-diff -up dhcp-4.2.0-P1/common/lpf.c.PPP dhcp-4.2.0-P1/common/lpf.c
---- dhcp-4.2.0-P1/common/lpf.c.PPP 2010-11-05 10:47:37.000000000 +0100
-+++ dhcp-4.2.0-P1/common/lpf.c 2010-11-09 15:45:40.000000000 +0100
-@@ -502,6 +502,22 @@ get_hw_addr(const char *name, struct har
- hw->hbuf[0] = HTYPE_FDDI;
- memcpy(&hw->hbuf[1], sa->sa_data, 16);
- break;
-+#if defined(ARPHRD_PPP)
-+ case ARPHRD_PPP:
-+ if (local_family != AF_INET6)
-+ log_fatal("Unsupported device type %d for \"%s\"",
-+ sa->sa_family, name);
-+ hw->hlen = 0;
-+ hw->hbuf[0] = HTYPE_RESERVED;
-+ /* 0xdeadbeef should never occur on the wire,
-+ * and is a signature that something went wrong.
-+ */
-+ hw->hbuf[1] = 0xde;
-+ hw->hbuf[2] = 0xad;
-+ hw->hbuf[3] = 0xbe;
-+ hw->hbuf[4] = 0xef;
-+ break;
-+#endif
- default:
- log_fatal("Unsupported device type %ld for \"%s\"",
- (long int)sa->sa_family, name);
-diff -up dhcp-4.2.0-P1/includes/dhcpd.h.PPP dhcp-4.2.0-P1/includes/dhcpd.h
---- dhcp-4.2.0-P1/includes/dhcpd.h.PPP 2010-11-05 10:47:37.000000000 +0100
-+++ dhcp-4.2.0-P1/includes/dhcpd.h 2010-11-09 15:46:58.000000000 +0100
-@@ -2733,7 +2733,7 @@ void dhcpv4_client_assignments(void);
- void dhcpv6_client_assignments(void);
-
- /* dhc6.c */
--void form_duid(struct data_string *duid, const char *file, int line);
-+isc_result_t form_duid(struct data_string *duid, const char *file, int line);
- void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line);
- void start_init6(struct client_state *client);
- void start_info_request6(struct client_state *client);
-diff -up dhcp-4.2.0-P1/includes/dhcp.h.PPP dhcp-4.2.0-P1/includes/dhcp.h
---- dhcp-4.2.0-P1/includes/dhcp.h.PPP 2010-11-05 10:47:37.000000000 +0100
-+++ dhcp-4.2.0-P1/includes/dhcp.h 2010-11-09 15:48:53.000000000 +0100
-@@ -80,6 +80,8 @@ struct dhcp_packet {
- #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */
- #define HTYPE_FDDI 8 /* FDDI... */
-
-+#define HTYPE_RESERVED 0 /* RFC 5494 */
-+
- /* Magic cookie validating dhcp options field (and bootp vendor
- extensions field). */
- #define DHCP_OPTIONS_COOKIE "\143\202\123\143"
-diff -up dhcp-4.2.0-P1/server/dhcpv6.c.PPP dhcp-4.2.0-P1/server/dhcpv6.c
---- dhcp-4.2.0-P1/server/dhcpv6.c.PPP 2010-11-05 10:47:37.000000000 +0100
-+++ dhcp-4.2.0-P1/server/dhcpv6.c 2010-11-09 15:50:17.000000000 +0100
-@@ -300,6 +300,9 @@ generate_new_server_duid(void) {
- if (p->hw_address.hlen > 0) {
- break;
- }
-+ if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) {
-+ log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!");
-+ }
- }
- if (p == NULL) {
- return ISC_R_UNEXPECTED;
diff --git a/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch b/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch
deleted file mode 100644
index f882a13..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.0-errwarn-message.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-ripped from Fedora & tweaked
-
---- dhcp-4.2.0/omapip/errwarn.c
-+++ dhcp-4.2.0/omapip/errwarn.c
-@@ -76,20 +76,13 @@
-
- #if !defined (NOMINUM)
- log_error ("%s", "");
-- log_error ("If you did not get this software from ftp.isc.org, please");
-- log_error ("get the latest from ftp.isc.org and install that before");
-- log_error ("requesting help.");
-+ log_error ("This version of ISC DHCP is based on the release available");
-+ log_error ("on ftp.isc.org. Features have been added and other changes");
-+ log_error ("have been made to the base software release in order to make");
-+ log_error ("it work better with this distribution.");
- log_error ("%s", "");
-- log_error ("If you did get this software from ftp.isc.org and have not");
-- log_error ("yet read the README, please read it before requesting help.");
-- log_error ("If you intend to request help from the dhcp-server@isc.org");
-- log_error ("mailing list, please read the section on the README about");
-- log_error ("submitting bug reports and requests for help.");
-- log_error ("%s", "");
-- log_error ("Please do not under any circumstances send requests for");
-- log_error ("help directly to the authors of this software - please");
-- log_error ("send them to the appropriate mailing list as described in");
-- log_error ("the README file.");
-+ log_error ("Please report for this software via the Gentoo Bugzilla site:");
-+ log_error (" http://bugs.gentoo.org/");
- log_error ("%s", "");
- log_error ("exiting.");
- #endif
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch
deleted file mode 100644
index ae33638..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-bind-build-flags.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-bind sets up BUILD_XXX vars for building native tools, but then
-doesn't use them for the "gen" tool
-
---- a/bind/lib/export/dns/Makefile.in
-+++ b/bind/lib/export/dns/Makefile.in
-@@ -166,7 +166,7 @@
- ./gen -s ${srcdir} > code.h
-
- gen: ${srcdir}/gen.c
-- ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS}
-+ ${BUILD_CC} ${BUILD_CFLAGS} ${CINCLUDES} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c ${BUILD_LIBS}
-
- #We don't need rbtdb64 for this library
- #rbtdb64.@O@: rbtdb.c
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch
deleted file mode 100644
index 4c7810e..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-bind-disable.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-we take care of building this ourselves in the ebuild so
-build settings are properly respected
-
---- dhcp-4.2.2/bind/Makefile
-+++ dhcp-4.2.2/bind/Makefile
-@@ -29,6 +29,7 @@
- bindsrcdir=bind-${version}
-
- all:
-+disable:
- # Extract the source from the tarball, if it hasn't been already.
- @if test -d ${bindsrcdir} ; then \
- echo ${bindsrcdir} already unpacked... ; \
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch b/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch
deleted file mode 100644
index 6136154..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-bind-parallel-build.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-fix the bind subdir parallel builds
-
-https://bugs.gentoo.org/380717
-
---- a/bind/lib/export/isc/Makefile.in
-+++ b/bind/lib/export/isc/Makefile.in
-@@ -114,6 +114,7 @@
- -DLIBAGE=${LIBAGE} \
- -c ${srcdir}/version.c
-
-+${OBJS}: | subdirs
- libisc.@SA@: ${OBJS}
- ${AR} ${ARFLAGS} $@ ${OBJS}
- ${RANLIB} $@
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch
deleted file mode 100644
index 95a0d65..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-dhclient-resolvconf.patch
+++ /dev/null
@@ -1,409 +0,0 @@
---- a/client/scripts/bsdos
-+++ b/client/scripts/bsdos
-@@ -1,40 +1,46 @@
- #!/bin/sh
-
- make_resolv_conf() {
-+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
-+ return 0
-+ fi
-+ local conf=
- if [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
- if [ "x$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-+ conf="${conf}search ${new_domain_search}\n"
- elif [ "x$new_domain_name" != x ]; then
- # Note that the DHCP 'Domain Name Option' is really just a domain
- # name, and that this practice of using the domain name option as
- # a search path is both nonstandard and deprecated.
-- echo search $new_domain_name >> /etc/resolv.conf.dhclient
-+ conf="${conf}search ${new_domain_name}\n"
- fi
- for nameserver in $new_domain_name_servers; do
-- echo nameserver $nameserver >> /etc/resolv.conf.dhclient
-+ conf="${conf}nameserver ${nameserver}\n"
- done
--
-- mv /etc/resolv.conf.dhclient /etc/resolv.conf
- elif [ "x${new_dhcp6_name_servers}" != x ] ; then
-- cat /dev/null > /etc/resolv.conf.dhclient6
-- chmod 644 /etc/resolv.conf.dhclient6
--
- if [ "x${new_dhcp6_domain_search}" != x ] ; then
-- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}search ${new_dhcp6_domain_search}\n"
- fi
- for nameserver in ${new_dhcp6_name_servers} ; do
- # If the nameserver has a link-local address
- # add a <zone_id> (interface name) to it.
- case $nameserver in
- fe80:*) zone_id="%$interface";;
- FE80:*) zone_id="%$interface";;
- *) zone_id='';;
- esac
-- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}$zone_id\n"
- done
-+ fi
-
-- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
-+ if [ x"$conf" != x ]; then
-+ conf="# Generated by dhclient or interface $interface\n${conf}"
-+ if type resolvconf >/dev/null 2>&1; then
-+ printf "${conf}" | resolvconf -a $interface
-+ else
-+ printf "${conf}" > /etc/resolv.conf
-+ chmod 644 /etc/resolv.conf
-+ fi
- fi
- }
-
---- a/client/scripts/freebsd
-+++ b/client/scripts/freebsd
-@@ -11,73 +11,45 @@
- fi
-
- make_resolv_conf() {
-+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
-+ return 0
-+ fi
-+ local conf=
- if [ x"$new_domain_name_servers" != x ]; then
-- ( cat /dev/null > /etc/resolv.conf.dhclient )
-- exit_status=$?
-- if [ $exit_status -ne 0 ]; then
-- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
-- else
-- if [ "x$new_domain_search" != x ]; then
-- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
-- exit_status=$?
-- elif [ "x$new_domain_name" != x ]; then
-- # Note that the DHCP 'Domain Name Option' is really just a domain
-- # name, and that this practice of using the domain name option as
-- # a search path is both nonstandard and deprecated.
-- ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
-- exit_status=$?
-- fi
-- for nameserver in $new_domain_name_servers; do
-- if [ $exit_status -ne 0 ]; then
-- break
-- fi
-- ( echo nameserver $nameserver >>/etc/resolv.conf.dhclient )
-- exit_status=$?
-- done
--
-- # If there were no errors, attempt to mv the new file into place.
-- if [ $exit_status -eq 0 ]; then
-- ( mv /etc/resolv.conf.dhclient /etc/resolv.conf )
-- exit_status=$?
-- fi
--
-- if [ $exit_status -ne 0 ]; then
-- $LOGGER "Error while writing new /etc/resolv.conf."
-- fi
-+ if [ "x$new_domain_search" != x ]; then
-+ conf="${conf}search ${new_domain_search}\n"
-+ elif [ "x$new_domain_name" != x ]; then
-+ # Note that the DHCP 'Domain Name Option' is really just a domain
-+ # name, and that this practice of using the domain name option as
-+ # a search path is both nonstandard and deprecated.
-+ conf="${conf}search ${new_domain_name}\n"
- fi
-+ for nameserver in $new_domain_name_servers; do
-+ conf="${conf}nameserver ${nameserver}\n"
-+ done
- elif [ "x${new_dhcp6_name_servers}" != x ] ; then
-- ( cat /dev/null > /etc/resolv.conf.dhclient6 )
-- exit_status=$?
-- if [ $exit_status -ne 0 ] ; then
-- $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
-- else
-- if [ "x${new_dhcp6_domain_search}" != x ] ; then
-- ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
-- exit_status=$?
-- fi
-- for nameserver in ${new_dhcp6_name_servers} ; do
-- if [ $exit_status -ne 0 ] ; then
-- break
-- fi
- # If the nameserver has a link-local address
- # add a <zone_id> (interface name) to it.
- case $nameserver in
- fe80:*) zone_id="%$interface";;
- FE80:*) zone_id="%$interface";;
- *) zone_id='';;
- esac
-- ( echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6 )
-- exit_status=$?
-- done
--
-- if [ $exit_status -eq 0 ] ; then
-- ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
-- exit_status=$?
-- fi
-+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
-+ conf="${conf}search ${new_dhcp6_domain_search}\n"
-+ fi
-+ for nameserver in ${new_dhcp6_name_servers} ; do
-+ conf="${conf}nameserver ${nameserver}$zone_id\n"
-+ done
-+ fi
-
-- if [ $exit_status -ne 0 ] ; then
-- $LOGGER "Error while writing new /etc/resolv.conf."
-- fi
-+ if [ x"$conf" != x ]; then
-+ conf="# Generated by dhclient or interface $interface\n${conf}"
-+ if type resolvconf >/dev/null 2>&1; then
-+ printf "${conf}" | resolvconf -a $interface
-+ else
-+ printf "${conf}" > /etc/resolv.conf
-+ chmod 644 /etc/resolv.conf
- fi
- fi
- }
---- a/client/scripts/linux
-+++ b/client/scripts/linux
-@@ -26,44 +26,49 @@
- ip=/sbin/ip
-
- make_resolv_conf() {
-+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
-+ return 0
-+ fi
-+ local conf=
- if [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- chmod 644 /etc/resolv.conf.dhclient
-- if [ x"$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ x"$new_domain_name" != x ]; then
-+ if [ "x$new_domain_search" != x ]; then
-+ conf="${conf}search ${new_domain_search}\n"
-+ elif [ "x$new_domain_name" != x ]; then
- # Note that the DHCP 'Domain Name Option' is really just a domain
- # name, and that this practice of using the domain name option as
- # a search path is both nonstandard and deprecated.
-- echo search $new_domain_name >> /etc/resolv.conf.dhclient
-+ conf="${conf}search ${new_domain_name}\n"
- fi
- for nameserver in $new_domain_name_servers; do
-- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
-+ conf="${conf}nameserver ${nameserver}\n"
- done
--
-- mv /etc/resolv.conf.dhclient /etc/resolv.conf
- elif [ "x${new_dhcp6_name_servers}" != x ] ; then
-- cat /dev/null > /etc/resolv.conf.dhclient6
-- chmod 644 /etc/resolv.conf.dhclient6
--
- if [ "x${new_dhcp6_domain_search}" != x ] ; then
-- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}search ${new_dhcp6_domain_search}\n"
- fi
- shopt -s nocasematch
- for nameserver in ${new_dhcp6_name_servers} ; do
- # If the nameserver has a link-local address
- # add a <zone_id> (interface name) to it.
- if [[ "$nameserver" =~ ^fe80:: ]]
- then
- zone_id="%$interface"
- else
- zone_id=
- fi
-- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}$zone_id\n"
- done
- shopt -u nocasematch
-+ fi
-
-- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
-+ if [ x"$conf" != x ]; then
-+ conf="# Generated by dhclient or interface $interface\n${conf}"
-+ if type resolvconf >/dev/null 2>&1; then
-+ printf "${conf}" | resolvconf -a $interface
-+ else
-+ printf "${conf}" > /etc/resolv.conf
-+ chmod 644 /etc/resolv.conf
-+ fi
- fi
- }
-
---- a/client/scripts/netbsd
-+++ b/client/scripts/netbsd
-@@ -1,40 +1,46 @@
- #!/bin/sh
-
- make_resolv_conf() {
-- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- if [ "x$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ "x$new_domain_name" != x ]; then
-+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
-+ return 0
-+ fi
-+ local conf=
-+ if [ x"$new_domain_name_servers" != x ]; then
-+ if [ "x$new_domain_search" != x ]; then
-+ conf="${conf}search ${new_domain_search}\n"
-+ elif [ "x$new_domain_name" != x ]; then
- # Note that the DHCP 'Domain Name Option' is really just a domain
- # name, and that this practice of using the domain name option as
- # a search path is both nonstandard and deprecated.
-- echo search $new_domain_name >> /etc/resolv.conf.dhclient
-+ conf="${conf}search ${new_domain_name}\n"
- fi
- for nameserver in $new_domain_name_servers; do
-- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
-+ conf="${conf}nameserver ${nameserver}\n"
- done
--
-- mv /etc/resolv.conf.dhclient /etc/resolv.conf
- elif [ "x${new_dhcp6_name_servers}" != x ] ; then
-- cat /dev/null > /etc/resolv.conf.dhclient6
-- chmod 644 /etc/resolv.conf.dhclient6
--
- if [ "x${new_dhcp6_domain_search}" != x ] ; then
-- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}search ${new_dhcp6_domain_search}\n"
- fi
- for nameserver in ${new_dhcp6_name_servers} ; do
- # If the nameserver has a link-local address
- # add a <zone_id> (interface name) to it.
- case $nameserver in
- fe80:*) zone_id="%$interface";;
- FE80:*) zone_id="%$interface";;
- *) zone_id='';;
- esac
-- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}$zone_id\n"
- done
-+ fi
-
-- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
-+ if [ x"$conf" != x ]; then
-+ conf="# Generated by dhclient or interface $interface\n${conf}"
-+ if type resolvconf >/dev/null 2>&1; then
-+ printf "${conf}" | resolvconf -a $interface
-+ else
-+ printf "${conf}" > /etc/resolv.conf
-+ chmod 644 /etc/resolv.conf
-+ fi
- fi
- }
-
---- a/client/scripts/openbsd
-+++ b/client/scripts/openbsd
-@@ -1,40 +1,46 @@
- #!/bin/sh
-
- make_resolv_conf() {
-- if [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- if [ x"$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ x"$new_domain_name" != x ]; then
-+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
-+ return 0
-+ fi
-+ local conf=
-+ if [ x"$new_domain_name_servers" != x ]; then
-+ if [ "x$new_domain_search" != x ]; then
-+ conf="${conf}search ${new_domain_search}\n"
-+ elif [ "x$new_domain_name" != x ]; then
- # Note that the DHCP 'Domain Name Option' is really just a domain
- # name, and that this practice of using the domain name option as
- # a search path is both nonstandard and deprecated.
-- echo search $new_domain_name >> /etc/resolv.conf.dhclient
-+ conf="${conf}search ${new_domain_name}\n"
- fi
- for nameserver in $new_domain_name_servers; do
-- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
-+ conf="${conf}nameserver ${nameserver}\n"
- done
--
-- mv /etc/resolv.conf.dhclient /etc/resolv.conf
- elif [ "x${new_dhcp6_name_servers}" != x ] ; then
-- cat /dev/null > /etc/resolv.conf.dhclient6
-- chmod 644 /etc/resolv.conf.dhclient6
--
- if [ "x${new_dhcp6_domain_search}" != x ] ; then
-- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
-+ conf="${conf}search ${new_dhcp6_domain_search}\n"
- fi
- for nameserver in ${new_dhcp6_name_servers} ; do
- # If the nameserver has a link-local address
- # add a <zone_id> (interface name) to it.
- case $nameserver in
- fe80:*) zone_id="%$interface";;
- FE80:*) zone_id="%$interface";;
- *) zone_id='';;
- esac
-- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
-+ conf="${conf}nameserver ${nameserver}$zone_id\n"
- done
-+ fi
-
-- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
-+ if [ x"$conf" != x ]; then
-+ conf="# Generated by dhclient or interface $interface\n${conf}"
-+ if type resolvconf >/dev/null 2>&1; then
-+ printf "${conf}" | resolvconf -a $interface
-+ else
-+ printf "${conf}" > /etc/resolv.conf
-+ chmod 644 /etc/resolv.conf
-+ fi
- fi
- }
-
---- a/client/scripts/solaris
-+++ b/client/scripts/solaris
-@@ -1,21 +1,39 @@
- #!/bin/sh
-
- make_resolv_conf() {
-+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
-+ return 0
-+ fi
-+ local conf=
- if [ x"$new_domain_name_servers" != x ]; then
-- cat /dev/null > /etc/resolv.conf.dhclient
-- if [ x"$new_domain_search" != x ]; then
-- echo search $new_domain_search >> /etc/resolv.conf.dhclient
-- elif [ x"$new_domain_name" != x ]; then
-+ if [ "x$new_domain_search" != x ]; then
-+ conf="${conf}search ${new_domain_search}\n"
-+ elif [ "x$new_domain_name" != x ]; then
- # Note that the DHCP 'Domain Name Option' is really just a domain
- # name, and that this practice of using the domain name option as
- # a search path is both nonstandard and deprecated.
-- echo search $new_domain_name >> /etc/resolv.conf.dhclient
-+ conf="${conf}search ${new_domain_name}\n"
- fi
- for nameserver in $new_domain_name_servers; do
-- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
-+ conf="${conf}nameserver ${nameserver}\n"
-+ done
-+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
-+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
-+ conf="${conf}search ${new_dhcp6_domain_search}\n"
-+ fi
-+ for nameserver in ${new_dhcp6_name_servers} ; do
-+ conf="${conf}nameserver ${nameserver}\n"
- done
-+ fi
-
-- mv /etc/resolv.conf.dhclient /etc/resolv.conf
-+ if [ x"$conf" != x ]; then
-+ conf="# Generated by dhclient or interface $interface\n${conf}"
-+ if type resolvconf >/dev/null 2>&1; then
-+ printf "${conf}" | resolvconf -a $interface
-+ else
-+ printf "${conf}" > /etc/resolv.conf
-+ chmod 644 /etc/resolv.conf
-+ fi
- fi
- }
-
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch b/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
deleted file mode 100644
index bf5a54c..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-dhclient-stdin-conf.patch
+++ /dev/null
@@ -1,113 +0,0 @@
---- dhcp-4.2.2/client/clparse.c
-+++ dhcp-4.2.2/client/clparse.c
-@@ -182,6 +182,10 @@ isc_result_t read_client_conf ()
- #endif
- }
-
-+ /* Read any extra configuration from stdin */
-+ extern int read_client_conf_stdin (struct interface_info *ip, struct client_config *client);
-+ read_client_conf_stdin (NULL, &top_level_config);
-+
- /* Set up state and config structures for clients that don't
- have per-interface configuration statements. */
- config = (struct client_config *)0;
-@@ -211,23 +215,13 @@ isc_result_t read_client_conf ()
- return status;
- }
-
--int read_client_conf_file (const char *name, struct interface_info *ip,
-+int read_client_conf_actual (struct parse *cfile, struct interface_info *ip,
- struct client_config *client)
- {
-- int file;
-- struct parse *cfile;
- const char *val;
- int token;
- isc_result_t status;
-
-- if ((file = open (name, O_RDONLY)) < 0)
-- return uerr2isc (errno);
--
-- cfile = NULL;
-- status = new_parse(&cfile, file, NULL, 0, path_dhclient_conf, 0);
-- if (status != ISC_R_SUCCESS || cfile == NULL)
-- return status;
--
- do {
- token = peek_token (&val, (unsigned *)0, cfile);
- if (token == END_OF_FILE)
-@@ -238,10 +232,74 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
- status = (cfile -> warnings_occurred
- ? DHCP_R_BADPARSE
- : ISC_R_SUCCESS);
-+ return status;
-+}
-+
-+int read_client_conf_file (const char *name, struct interface_info *ip,
-+ struct client_config *client)
-+{
-+ int file;
-+ struct parse *cfile;
-+ isc_result_t status;
-+
-+ if ((file = open (name, O_RDONLY)) < 0)
-+ return uerr2isc (errno);
-+
-+ cfile = (struct parse *)0;
-+ new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
-+ status = read_client_conf_actual(cfile, ip, client);
- end_parse (&cfile);
- return status;
- }
-
-+int read_client_conf_stdin (struct interface_info *ip,
-+ struct client_config *client)
-+{
-+ int file;
-+ char *buffer = NULL, *p;
-+ unsigned buflen, len = 0;
-+ struct parse *cfile;
-+ size_t bytes;
-+ isc_result_t status;
-+
-+ file = fileno(stdin);
-+ if (isatty (file))
-+ return ISC_R_NOTFOUND;
-+ if (fcntl (file, F_SETFL, O_NONBLOCK) < 0)
-+ log_fatal ("could not set stdin to non blocking!");
-+
-+ buflen = BUFSIZ;
-+ buffer = malloc (BUFSIZ + 1);
-+ p = buffer;
-+ do {
-+ bytes = read (file, p, BUFSIZ);
-+ if (bytes == 0)
-+ break;
-+ if (bytes == -1)
-+ log_fatal ("failed to read stdin!");
-+ if (bytes >= BUFSIZ) {
-+ buflen += BUFSIZ;
-+ len += BUFSIZ;
-+ buffer = realloc (buffer, buflen + 1);
-+ if (!buffer)
-+ log_fatal ("not enough buffer to read stdin!");
-+ p = buffer + len;
-+ } else {
-+ len += bytes;
-+ break;
-+ }
-+ } while(1);
-+ buffer[len] = '\0';
-+
-+ cfile = (struct parse *)0;
-+ status = new_parse (&cfile, -1, buffer, len, "stdin", 0);
-+ if (status == ISC_R_SUCCESS) {
-+ status = read_client_conf_actual (cfile, ip, client);
-+ end_parse (&cfile);
-+ }
-+ free(buffer);
-+ return status;
-+}
-
- /* lease-file :== client-lease-statements END_OF_FILE
- client-lease-statements :== <nil>
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch b/net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch
deleted file mode 100644
index c0be4c2..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-gpxe-cid.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-diff -up dhcp-4.2.2/client/dhclient.c.gpxe-cid dhcp-4.2.2/client/dhclient.c
---- dhcp-4.2.2/client/dhclient.c.gpxe-cid 2011-09-16 18:23:20.190453902 +0200
-+++ dhcp-4.2.2/client/dhclient.c 2011-09-16 18:27:15.568463599 +0200
-@@ -58,6 +58,13 @@ const char *path_dhclient_pid = NULL;
- static char path_dhclient_script_array[] = _PATH_DHCLIENT_SCRIPT;
- char *path_dhclient_script = path_dhclient_script_array;
-
-+/* Default Prefix */
-+static unsigned char default_prefix[12] = {
-+ 0xff, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x02, 0x00,
-+ 0x00, 0x02, 0xc9, 0x00
-+};
-+
- /* False (default) => we write and use a pid file */
- isc_boolean_t no_pid_file = ISC_FALSE;
-
-@@ -1250,6 +1257,12 @@ int find_subnet (struct subnet **sp,
- static void setup_ib_interface(struct interface_info *ip)
- {
- struct group *g;
-+ struct hardware *hw = &ip->hw_address;
-+ char client_id[64];
-+ char *arg_conf = NULL;
-+ int arg_conf_len = 0;
-+ isc_result_t status;
-+ struct parse *cfile = (struct parse *)0;
-
- /* Set the broadcast flag */
- ip->client->config->bootp_broadcast_always = 1;
-@@ -1266,8 +1279,39 @@ static void setup_ib_interface(struct in
- }
- }
-
-- /* No client ID specified */
-- log_fatal("dhcp-client-identifier must be specified for InfiniBand");
-+ /*
-+ * No client ID specified, make up one based on a default
-+ * "prefix" and the port GUID.
-+ *
-+ * NOTE: This is compatible with what gpxe does.
-+ */
-+ sprintf(client_id, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
-+ default_prefix[0], default_prefix[1], default_prefix[2],
-+ default_prefix[3], default_prefix[4], default_prefix[5],
-+ default_prefix[6], default_prefix[7], default_prefix[8],
-+ default_prefix[9], default_prefix[10], default_prefix[11],
-+ hw->hbuf[1], hw->hbuf[2], hw->hbuf[3], hw->hbuf[4],
-+ hw->hbuf[5], hw->hbuf[6], hw->hbuf[7], hw->hbuf[8]);
-+
-+ arg_conf_len = asprintf(&arg_conf,
-+ "send dhcp-client-identifier %s;",
-+ client_id);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send option dhcp-client-identifier");
-+
-+ status = new_parse(&cfile, -1, arg_conf, arg_conf_len,
-+ "Automatic Infiniband client identifier", 0);
-+
-+ if ((status != ISC_R_SUCCESS) || (cfile->warnings_occurred))
-+ log_fatal("Failed to parse Infiniband client identifier");
-+
-+ parse_client_statement(cfile, NULL, ip->client->config);
-+
-+ if (cfile->warnings_occurred)
-+ log_fatal("Failed to parse Infiniband client identifier");
-+
-+ end_parse(&cfile);
- }
-
- /* Individual States:
-diff -up dhcp-4.2.2/common/lpf.c.gpxe-cid dhcp-4.2.2/common/lpf.c
---- dhcp-4.2.2/common/lpf.c.gpxe-cid 2011-09-16 18:23:20.183453996 +0200
-+++ dhcp-4.2.2/common/lpf.c 2011-09-16 18:25:28.235804421 +0200
-@@ -591,6 +591,37 @@ void maybe_setup_fallback ()
- }
- }
-
-+static unsigned char * get_ib_hw_addr(char * name)
-+{
-+ struct ifaddrs *ifaddrs;
-+ struct ifaddrs *ifa;
-+ struct sockaddr_ll *sll = NULL;
-+ static unsigned char hw_addr[8];
-+
-+ if (getifaddrs(&ifaddrs) == -1)
-+ return NULL;
-+
-+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
-+ if (ifa->ifa_addr == NULL)
-+ continue;
-+ if (ifa->ifa_addr->sa_family != AF_PACKET)
-+ continue;
-+ if (ifa->ifa_flags & IFF_LOOPBACK)
-+ continue;
-+ if (strcmp(ifa->ifa_name, name) == 0) {
-+ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr;
-+ break;
-+ }
-+ }
-+ if (sll == NULL) {
-+ freeifaddrs(ifaddrs);
-+ return NULL;
-+ }
-+ memcpy(hw_addr, &sll->sll_addr[sll->sll_halen - 8], 8);
-+ freeifaddrs(ifaddrs);
-+ return (unsigned char *)&hw_addr;
-+}
-+
- void
- get_hw_addr(struct interface_info *info)
- {
-@@ -599,6 +630,7 @@ get_hw_addr(struct interface_info *info)
- struct ifaddrs *ifaddrs;
- struct ifaddrs *ifa;
- struct sockaddr_ll *sll = NULL;
-+ unsigned char *hw_addr;
-
- if (getifaddrs(&ifaddrs) == -1)
- log_fatal("Failed to get interfaces");
-@@ -660,6 +692,10 @@ get_hw_addr(struct interface_info *info)
-
- hw->hlen = 1;
- hw->hbuf[0] = HTYPE_INFINIBAND;
-+ hw_addr = get_ib_hw_addr(name);
-+ if (!hw_addr)
-+ log_fatal("Failed getting %s hw addr", name);
-+ memcpy (&hw->hbuf [1], hw_addr, 8);
- break;
- #if defined(ARPHRD_PPP)
- case ARPHRD_PPP:
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-improved-xid.patch b/net-misc/dhcp/files/dhcp-4.2.2-improved-xid.patch
deleted file mode 100644
index f49fc78..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-improved-xid.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-diff -up dhcp-4.2.2/client/dhclient.c.improved-xid dhcp-4.2.2/client/dhclient.c
---- dhcp-4.2.2/client/dhclient.c.improved-xid 2011-09-16 18:18:00.649730661 +0200
-+++ dhcp-4.2.2/client/dhclient.c 2011-09-16 18:22:36.815035513 +0200
-@@ -898,6 +898,26 @@ main(int argc, char **argv) {
- }
- }
-
-+ /* 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 = 0;
-+ for (ip = interfaces; ip; ip = ip -> next) {
-+ int junk;
-+ if ( ip -> hw_address.hlen <= sizeof seed )
-+ continue;
-+ memcpy (&junk,
-+ &ip -> hw_address.hbuf [ip -> hw_address.hlen -
-+ sizeof seed], sizeof seed);
-+ backup_seed = 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
-@@ -912,14 +932,36 @@ main(int argc, char **argv) {
- Not much entropy, but we're booting, so we're not likely to
- find anything better. */
- seed = 0;
-+ int seed_flag = 0;
- for (ip = interfaces; ip; ip = ip->next) {
- int junk;
-+ if ( ip -> hw_address.hlen <= sizeof seed )
-+ continue;
- memcpy(&junk,
- &ip->hw_address.hbuf[ip->hw_address.hlen -
- sizeof seed], sizeof seed);
- seed += junk;
-+ seed_flag = 1;
- }
-- srandom(seed + cur_time + (unsigned)getpid());
-+ if ( seed_flag == 0 ) {
-+ if ( backup_seed != 0 ) {
-+ seed = backup_seed;
-+ log_info ("xid: rand init seed (0x%x) built using all"
-+ " available interfaces",seed);
-+ }
-+ else {
-+ seed = 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 + (unsigned)getpid());
-
- /* Setup specific Infiniband options */
- for (ip = interfaces; ip; ip = ip->next) {
-@@ -1457,7 +1499,7 @@ void dhcpack (packet)
- return;
- }
-
-- log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
-+ log_info ("DHCPACK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
-
- lease = packet_to_lease (packet, client);
- if (!lease) {
-@@ -2174,7 +2216,7 @@ void dhcpnak (packet)
- return;
- }
-
-- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr));
-+ log_info ("DHCPNAK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
-
- if (!client -> active) {
- #if defined (DEBUG)
-@@ -2300,10 +2342,10 @@ void send_discover (cpp)
- client -> packet.secs = htons (65535);
- client -> secs = client -> packet.secs;
-
-- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld",
-+ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=0x%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);
-
- /* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
-@@ -2584,10 +2626,10 @@ void send_request (cpp)
- client -> packet.secs = htons (65535);
- }
-
-- log_info ("DHCPREQUEST on %s to %s port %d",
-+ log_info ("DHCPREQUEST on %s to %s port %d (xid=0x%x)",
- client -> name ? client -> name : client -> interface -> name,
- inet_ntoa (destination.sin_addr),
-- ntohs (destination.sin_port));
-+ ntohs (destination.sin_port), client -> xid);
-
- if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
- fallback_interface)
-@@ -2618,10 +2660,10 @@ void send_decline (cpp)
-
- int result;
-
-- log_info ("DHCPDECLINE on %s to %s port %d",
-+ log_info ("DHCPDECLINE on %s to %s port %d (xid=0x%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);
-
- /* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
-@@ -2661,10 +2703,10 @@ void send_release (cpp)
- return;
- }
-
-- log_info ("DHCPRELEASE on %s to %s port %d",
-+ log_info ("DHCPRELEASE on %s to %s port %d (xid=0x%x)",
- client -> name ? client -> name : client -> interface -> name,
- inet_ntoa (destination.sin_addr),
-- ntohs (destination.sin_port));
-+ ntohs (destination.sin_port), client -> xid);
-
- if (fallback_interface)
- result = send_packet (fallback_interface,
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-lpf-ib.patch b/net-misc/dhcp/files/dhcp-4.2.2-lpf-ib.patch
deleted file mode 100644
index 4034028..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-lpf-ib.patch
+++ /dev/null
@@ -1,538 +0,0 @@
-diff -up dhcp-4.2.2/client/dhclient.c.lpf-ib dhcp-4.2.2/client/dhclient.c
---- dhcp-4.2.2/client/dhclient.c.lpf-ib 2011-09-19 11:24:08.693775799 +0200
-+++ dhcp-4.2.2/client/dhclient.c 2011-09-19 11:24:08.703775541 +0200
-@@ -113,6 +113,8 @@ static int check_domain_name_list(const
- static int check_option_values(struct universe *universe, unsigned int opt,
- const char *ptr, size_t len);
-
-+static void setup_ib_interface(struct interface_info *ip);
-+
- int
- main(int argc, char **argv) {
- int fd;
-@@ -919,6 +921,14 @@ main(int argc, char **argv) {
- }
- srandom(seed + cur_time + (unsigned)getpid());
-
-+ /* Setup specific Infiniband options */
-+ for (ip = interfaces; ip; ip = ip->next) {
-+ if (ip->client &&
-+ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
-+ setup_ib_interface(ip);
-+ }
-+ }
-+
- /* Start a configuration state machine for each interface. */
- #ifdef DHCPv6
- if (local_family == AF_INET6) {
-@@ -1195,6 +1205,29 @@ int find_subnet (struct subnet **sp,
- return 0;
- }
-
-+static void setup_ib_interface(struct interface_info *ip)
-+{
-+ struct group *g;
-+
-+ /* Set the broadcast flag */
-+ ip->client->config->bootp_broadcast_always = 1;
-+
-+ /*
-+ * Find out if a dhcp-client-identifier option was specified either
-+ * in the config file or on the command line
-+ */
-+ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) {
-+ if ((g->statements != NULL) &&
-+ (strcmp(g->statements->data.option->option->name,
-+ "dhcp-client-identifier") == 0)) {
-+ return;
-+ }
-+ }
-+
-+ /* No client ID specified */
-+ log_fatal("dhcp-client-identifier must be specified for InfiniBand");
-+}
-+
- /* Individual States:
- *
- * Each routine is called from the dhclient_state_machine() in one of
-diff -up dhcp-4.2.2/common/bpf.c.lpf-ib dhcp-4.2.2/common/bpf.c
---- dhcp-4.2.2/common/bpf.c.lpf-ib 2011-09-19 11:24:08.694775773 +0200
-+++ dhcp-4.2.2/common/bpf.c 2011-09-19 11:24:08.704775516 +0200
-@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
- BPF_STMT(BPF_RET+BPF_K, 0),
- };
-
-+/* Packet filter program for DHCP over Infiniband.
-+ *
-+ * XXX
-+ * Changes to the filter program may require changes to the constant offsets
-+ * used in lpf_gen_filter_setup to patch the port in the BPF program!
-+ * XXX
-+ */
-+struct bpf_insn dhcp_ib_bpf_filter [] = {
-+ /* 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
-
- int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn);
-+int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn);
-+
- #if defined (HAVE_TR_SUPPORT)
- struct bpf_insn dhcp_bpf_tr_filter [] = {
- /* accept all token ring packets due to variable length header */
-diff -up dhcp-4.2.2/common/lpf.c.lpf-ib dhcp-4.2.2/common/lpf.c
---- dhcp-4.2.2/common/lpf.c.lpf-ib 2011-09-19 11:24:08.694775773 +0200
-+++ dhcp-4.2.2/common/lpf.c 2011-09-19 11:26:15.107109935 +0200
-@@ -42,6 +42,7 @@
- #include "includes/netinet/udp.h"
- #include "includes/netinet/if_ether.h"
- #include <net/if.h>
-+#include <ifaddrs.h>
-
- #ifndef PACKET_AUXDATA
- #define PACKET_AUXDATA 8
-@@ -59,6 +60,15 @@ struct tpacket_auxdata
- /* Reinitializes the specified interface after an address change. This
- is not required for packet-filter APIs. */
-
-+/* Default broadcast address for IPoIB */
-+static unsigned char default_ib_bcast_addr[20] = {
-+ 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;
-
- /* Make an LPF socket. */
-- if ((sock = socket(PF_PACKET, SOCK_RAW,
-- htons((short)ETH_P_ALL))) < 0) {
-+ get_hw_addr(info);
-+
-+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ type = SOCK_DGRAM;
-+ protocol = ETHERTYPE_IP;
-+ } else {
-+ type = SOCK_RAW;
-+ protocol = ETH_P_ALL;
-+ }
-+
-+ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
- errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
- errno == EAFNOSUPPORT || errno == EINVAL) {
-@@ -112,6 +133,7 @@ int if_register_lpf (info)
- /* Bind to the interface name */
- memset (&sa, 0, sizeof sa);
- sa.ll.sll_family = AF_PACKET;
-+ sa.ll.sll_protocol = htons(protocol);
- sa.ll.sll_ifindex = ifr.ifr_ifindex;
- if (bind (sock, &sa.common, sizeof sa)) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
-@@ -127,8 +149,6 @@ int if_register_lpf (info)
- log_fatal ("Bind socket to interface: %m");
- }
-
-- get_hw_addr(info->name, &info->hw_address);
--
- return sock;
- }
- #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */
-@@ -183,6 +203,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;
-
- #if defined (HAVE_TR_SUPPORT)
- extern struct sock_filter dhcp_bpf_tr_filter [];
-@@ -200,11 +222,13 @@ void if_register_receive (info)
- /* Open a LPF device and hang it on this interface... */
- info -> rfdesc = if_register_lpf (info);
-
-- val = 1;
-- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
-- sizeof val) < 0) {
-- if (errno != ENOPROTOOPT)
-- log_fatal ("Failed to set auxiliary packet data: %m");
-+ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) {
-+ val = 1;
-+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA,
-+ &val, sizeof val) < 0) {
-+ if (errno != ENOPROTOOPT)
-+ log_fatal ("Failed to set auxiliary packet data: %m");
-+ }
- }
-
- #if defined (HAVE_TR_SUPPORT)
-@@ -250,15 +274,28 @@ static void lpf_gen_filter_setup (info)
-
- memset(&p, 0, sizeof(p));
-
-- /* Set up the bpf filter program structure. This is defined in
-- bpf.c */
-- p.len = dhcp_bpf_filter_len;
-- p.filter = 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 = ntohs ((short)local_port);
-+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ /* Set up the bpf filter program structure. */
-+ p.len = dhcp_ib_bpf_filter_len;
-+ p.filter = 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 = ntohs ((short)local_port);
-+ } else {
-+ /* Set up the bpf filter program structure.
-+ This is defined in bpf.c */
-+ p.len = dhcp_bpf_filter_len;
-+ p.filter = 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 = ntohs ((short)local_port);
-+ }
-
- if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p,
- sizeof p) < 0) {
-@@ -315,6 +352,54 @@ static void lpf_tr_filter_setup (info)
- #endif /* USE_LPF_RECEIVE */
-
- #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 = 0;
-+ double ih [1536 / sizeof (double)];
-+ unsigned char *buf = (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 = AF_PACKET;
-+ su.sll.sll_protocol = htons(ETHERTYPE_IP);
-+
-+ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) {
-+ errno = ENOENT;
-+ log_error ("send_packet_ib: %m - failed to get if index");
-+ return -1;
-+ }
-+
-+ su.sll.sll_hatype = htons(HTYPE_INFINIBAND);
-+ su.sll.sll_halen = sizeof(interface->bcast_addr);
-+ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20);
-+
-+ result = 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;
-@@ -335,6 +420,11 @@ ssize_t send_packet (interface, packet,
- return send_fallback (interface, packet, raw,
- len, from, to, hto);
-
-+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ return send_packet_ib(interface, packet, raw, len, from,
-+ to, hto);
-+ }
-+
- if (hto == NULL && interface->anycast_mac_addr.hlen)
- hto = &interface->anycast_mac_addr;
-
-@@ -356,6 +446,42 @@ ssize_t send_packet (interface, packet,
- #endif /* USE_LPF_SEND */
-
- #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 = 0;
-+ int offset = 0;
-+ unsigned char ibuf [1536];
-+ unsigned bufix = 0;
-+ unsigned paylen;
-+
-+ length = read(interface->rfdesc, ibuf, sizeof(ibuf));
-+
-+ if (length <= 0)
-+ return length;
-+
-+ offset = decode_udp_ip_header(interface, ibuf, bufix, from,
-+ (unsigned)length, &paylen, 0);
-+
-+ if (offset < 0)
-+ return 0;
-+
-+ bufix += offset;
-+ length -= 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;
-@@ -382,6 +508,10 @@ ssize_t receive_packet (interface, buf,
- };
- struct cmsghdr *cmsg;
-
-+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
-+ return receive_packet_ib(interface, buf, len, from, hfrom);
-+ }
-+
- length = recvmsg (interface -> rfdesc, &msg, 0);
- if (length <= 0)
- return length;
-@@ -462,33 +592,44 @@ void maybe_setup_fallback ()
- }
-
- 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 = &info->hw_address;
-+ char *name = info->name;
-+ struct ifaddrs *ifaddrs;
-+ struct ifaddrs *ifa;
-+ struct sockaddr_ll *sll = NULL;
-
-- if (strlen(name) >= sizeof(tmp.ifr_name)) {
-- log_fatal("Device name too long: \"%s\"", name);
-- }
-+ if (getifaddrs(&ifaddrs) == -1)
-+ log_fatal("Failed to get interfaces");
-
-- sock = socket(AF_INET, SOCK_DGRAM, 0);
-- if (sock < 0) {
-- log_fatal("Can't create socket for \"%s\": %m", name);
-+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
-+
-+ if (ifa->ifa_addr == NULL)
-+ continue;
-+
-+ if (ifa->ifa_addr->sa_family != AF_PACKET)
-+ continue;
-+
-+ if (ifa->ifa_flags & IFF_LOOPBACK)
-+ continue;
-+
-+ if (strcmp(ifa->ifa_name, name) == 0) {
-+ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr;
-+ break;
-+ }
- }
-
-- 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",
-- name);
-+ if (sll == NULL) {
-+ freeifaddrs(ifaddrs);
-+ log_fatal("Failed to get HW address for %s\n", name);
- }
-
-- sa = &tmp.ifr_hwaddr;
-- switch (sa->sa_family) {
-+ switch (sll->sll_hatype) {
- case ARPHRD_ETHER:
- hw->hlen = 7;
- hw->hbuf[0] = 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
-@@ -496,18 +637,35 @@ get_hw_addr(const char *name, struct har
- #endif /* ARPHRD_IEEE802_TR */
- hw->hlen = 7;
- hw->hbuf[0] = HTYPE_IEEE802;
-- memcpy(&hw->hbuf[1], sa->sa_data, 6);
-+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
- break;
- case ARPHRD_FDDI:
- hw->hlen = 17;
- hw->hbuf[0] = 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 = (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 = 1;
-+ hw->hbuf[0] = HTYPE_INFINIBAND;
- break;
- #if defined(ARPHRD_PPP)
- case ARPHRD_PPP:
- if (local_family != AF_INET6)
-- log_fatal("Unsupported device type %d for \"%s\"",
-- sa->sa_family, name);
-+ log_fatal("Unsupported device type %ld for \"%s\"",
-+ (long int)sll->sll_family, name);
- hw->hlen = 0;
- hw->hbuf[0] = HTYPE_RESERVED;
- /* 0xdeadbeef should never occur on the wire,
-@@ -520,10 +678,11 @@ get_hw_addr(const char *name, struct har
- break;
- #endif
- default:
-+ freeifaddrs(ifaddrs);
- log_fatal("Unsupported device type %ld for \"%s\"",
-- (long int)sa->sa_family, name);
-+ (long int)sll->sll_family, name);
- }
-
-- close(sock);
-+ freeifaddrs(ifaddrs);
- }
- #endif
-diff -up dhcp-4.2.2/common/socket.c.lpf-ib dhcp-4.2.2/common/socket.c
---- dhcp-4.2.2/common/socket.c.lpf-ib 2011-06-27 18:18:20.000000000 +0200
-+++ dhcp-4.2.2/common/socket.c 2011-09-19 11:24:08.705775490 +0200
-@@ -324,7 +324,7 @@ void if_register_send (info)
- info->wfdesc = if_register_socket(info, AF_INET, 0);
- /* If this is a normal IPv4 address, get the hardware address. */
- if (strcmp(info->name, "fallback") != 0)
-- get_hw_addr(info->name, &info->hw_address);
-+ get_hw_addr(info);
- #if defined (USE_SOCKET_FALLBACK)
- /* Fallback only registers for send, but may need to receive as
- well. */
-@@ -387,7 +387,7 @@ void if_register_receive (info)
- #endif /* IP_PKTINFO... */
- /* If this is a normal IPv4 address, get the hardware address. */
- if (strcmp(info->name, "fallback") != 0)
-- get_hw_addr(info->name, &info->hw_address);
-+ get_hw_addr(info);
-
- if (!quiet_interface_discovery)
- log_info ("Listening on Socket/%s%s%s",
-@@ -497,7 +497,7 @@ if_register6(struct interface_info *info
- if (req_multi)
- if_register_multicast(info);
-
-- get_hw_addr(info->name, &info->hw_address);
-+ get_hw_addr(info);
-
- if (!quiet_interface_discovery) {
- if (info->shared_network != NULL) {
-diff -up dhcp-4.2.2/includes/dhcpd.h.lpf-ib dhcp-4.2.2/includes/dhcpd.h
---- dhcp-4.2.2/includes/dhcpd.h.lpf-ib 2011-09-19 11:24:08.696775721 +0200
-+++ dhcp-4.2.2/includes/dhcpd.h 2011-09-19 11:24:08.707775438 +0200
-@@ -1243,6 +1243,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.
- */
-@@ -2356,7 +2357,7 @@ void print_dns_status (int, struct dhcp_
- #endif
- const char *print_time(TIME);
-
--void get_hw_addr(const char *name, struct hardware *hw);
-+void get_hw_addr(struct interface_info *info);
-
- /* socket.c */
- #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
-diff -up dhcp-4.2.2/includes/dhcp.h.lpf-ib dhcp-4.2.2/includes/dhcp.h
---- dhcp-4.2.2/includes/dhcp.h.lpf-ib 2011-09-19 11:24:08.696775721 +0200
-+++ dhcp-4.2.2/includes/dhcp.h 2011-09-19 11:24:08.707775438 +0200
-@@ -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 */
-
- #define HTYPE_RESERVED 0 /* RFC 5494 */
-
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch b/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch
deleted file mode 100644
index 27fb2b0..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-nogateway.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-http://bugs.gentoo.org/265531
-
---- dhcp-4.2.2/client/scripts/linux
-+++ dhcp-4.2.2/client/scripts/linux
-@@ -193,12 +193,14 @@
- ifconfig $interface inet $new_ip_address $new_subnet_arg \
- $new_broadcast_arg $mtu_arg
- # Add a network route to the computed network address.
-- for router in $new_routers; do
-- if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
-- route add -host $router dev $interface
-- fi
-- route add default gw $router $metric_arg dev $interface
-- done
-+ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
-+ for router in $new_routers; do
-+ if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
-+ route add -host $router dev $interface
-+ fi
-+ route add default gw $router $metric_arg dev $interface
-+ done
-+ fi
- else
- # we haven't changed the address, have we changed other options
- # that we wish to update?
-@@ -244,12 +246,14 @@
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
- route add -host $alias_ip_address dev $interface:0
- fi
-- for router in $new_routers; do
-- if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
-- route add -host $router dev $interface
-- fi
-- route add default gw $router $metric_arg dev $interface
-- done
-+ if [ x$PEER_ROUTERS = x ] || [ x$PEER_ROUTERS = xyes ]; then
-+ for router in $new_routers; do
-+ if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
-+ route add -host $router dev $interface
-+ fi
-+ route add default gw $router $metric_arg dev $interface
-+ done
-+ fi
- make_resolv_conf
- exit_with_hooks 0
- fi
diff --git a/net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch b/net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch
deleted file mode 100644
index 038d346..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.2-xen-checksum.patch
+++ /dev/null
@@ -1,249 +0,0 @@
-diff -up dhcp-4.2.2b1/common/bpf.c.xen dhcp-4.2.2b1/common/bpf.c
---- dhcp-4.2.2b1/common/bpf.c.xen 2009-11-20 02:48:59.000000000 +0100
-+++ dhcp-4.2.2b1/common/bpf.c 2011-07-01 14:00:16.936959001 +0200
-@@ -485,7 +485,7 @@ ssize_t receive_packet (interface, buf,
- offset = decode_udp_ip_header (interface,
- interface -> rbuf,
- interface -> rbuf_offset,
-- from, hdr.bh_caplen, &paylen);
-+ from, hdr.bh_caplen, &paylen, 0);
-
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0) {
-diff -up dhcp-4.2.2b1/common/dlpi.c.xen dhcp-4.2.2b1/common/dlpi.c
---- dhcp-4.2.2b1/common/dlpi.c.xen 2011-05-11 16:20:59.000000000 +0200
-+++ dhcp-4.2.2b1/common/dlpi.c 2011-07-01 14:00:16.937958997 +0200
-@@ -693,7 +693,7 @@ ssize_t receive_packet (interface, buf,
- length -= offset;
- #endif
- offset = decode_udp_ip_header (interface, dbuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
-
- /*
- * If the IP or UDP checksum was bad, skip the packet...
-diff -up dhcp-4.2.2b1/common/lpf.c.xen dhcp-4.2.2b1/common/lpf.c
---- dhcp-4.2.2b1/common/lpf.c.xen 2011-05-10 16:38:58.000000000 +0200
-+++ dhcp-4.2.2b1/common/lpf.c 2011-07-01 14:11:24.725748028 +0200
-@@ -29,19 +29,33 @@
- #include "dhcpd.h"
- #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
- #include <sys/ioctl.h>
-+#include <sys/socket.h>
- #include <sys/uio.h>
- #include <errno.h>
-
- #include <asm/types.h>
- #include <linux/filter.h>
- #include <linux/if_ether.h>
-+#include <linux/if_packet.h>
- #include <netinet/in_systm.h>
--#include <net/if_packet.h>
- #include "includes/netinet/ip.h"
- #include "includes/netinet/udp.h"
- #include "includes/netinet/if_ether.h"
- #include <net/if.h>
-
-+#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. This
- is not required for packet-filter APIs. */
-
-@@ -67,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;
-
- /* Make an LPF socket. */
-- if ((sock = socket(PF_PACKET, SOCK_PACKET,
-+ if ((sock = socket(PF_PACKET, SOCK_RAW,
- htons((short)ETH_P_ALL))) < 0) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
- errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
-@@ -85,11 +103,17 @@ int if_register_lpf (info)
- log_fatal ("Open a socket for LPF: %m");
- }
-
-+ memset (&ifr, 0, sizeof ifr);
-+ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
-+ ifr.ifr_name[IFNAMSIZ-1] = '\0';
-+ 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 = AF_PACKET;
-- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
-- if (bind (sock, &sa, sizeof sa)) {
-+ sa.ll.sll_family = AF_PACKET;
-+ sa.ll.sll_ifindex = ifr.ifr_ifindex;
-+ if (bind (sock, &sa.common, sizeof sa)) {
- if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
- errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
- errno == EAFNOSUPPORT || errno == EINVAL) {
-@@ -171,9 +195,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 = if_register_lpf (info);
-
-+ val = 1;
-+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
-+ sizeof val) < 0) {
-+ if (errno != ENOPROTOOPT)
-+ log_fatal ("Failed to set auxiliary packet data: %m");
-+ }
-+
- #if defined (HAVE_TR_SUPPORT)
- if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
- lpf_tr_filter_setup (info);
-@@ -295,7 +328,6 @@ ssize_t send_packet (interface, packet,
- double hh [16];
- double ih [1536 / sizeof (double)];
- unsigned char *buf = (unsigned char *)ih;
-- struct sockaddr_pkt sa;
- int result;
- int fudge;
-
-@@ -316,17 +348,7 @@ ssize_t send_packet (interface, packet,
- (unsigned char *)raw, len);
- memcpy (buf + ibufp, raw, len);
-
-- /* 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.spkt_family = AF_PACKET;
-- strncpy ((char *)sa.spkt_device,
-- (const char *)interface -> ifp, sizeof sa.spkt_device);
-- sa.spkt_protocol = htons(ETH_P_IP);
--
-- result = sendto (interface -> wfdesc,
-- buf + fudge, ibufp + len - fudge, 0,
-- (const struct sockaddr *)&sa, sizeof sa);
-+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
- if (result < 0)
- log_error ("send_packet: %m");
- return result;
-@@ -343,14 +365,35 @@ ssize_t receive_packet (interface, buf,
- {
- int length = 0;
- int offset = 0;
-+ int nocsum = 0;
- unsigned char ibuf [1536];
- unsigned bufix = 0;
- unsigned paylen;
-+ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
-+ struct iovec iov = {
-+ .iov_base = ibuf,
-+ .iov_len = sizeof ibuf,
-+ };
-+ struct msghdr msg = {
-+ .msg_iov = &iov,
-+ .msg_iovlen = 1,
-+ .msg_control = cmsgbuf,
-+ .msg_controllen = sizeof(cmsgbuf),
-+ };
-+ struct cmsghdr *cmsg;
-
-- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
-+ length = recvmsg (interface -> rfdesc, &msg, 0);
- if (length <= 0)
- return length;
-
-+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-+ if (cmsg->cmsg_level == SOL_PACKET &&
-+ cmsg->cmsg_type == PACKET_AUXDATA) {
-+ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
-+ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
-+ }
-+ }
-+
- bufix = 0;
- /* Decode the physical header... */
- offset = decode_hw_header (interface, ibuf, bufix, hfrom);
-@@ -367,7 +410,7 @@ ssize_t receive_packet (interface, buf,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix, from,
-- (unsigned)length, &paylen);
-+ (unsigned)length, &paylen, nocsum);
-
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0)
-diff -up dhcp-4.2.2b1/common/nit.c.xen dhcp-4.2.2b1/common/nit.c
---- dhcp-4.2.2b1/common/nit.c.xen 2009-11-20 02:49:01.000000000 +0100
-+++ dhcp-4.2.2b1/common/nit.c 2011-07-01 14:00:16.939958989 +0200
-@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
-
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0)
-diff -up dhcp-4.2.2b1/common/packet.c.xen dhcp-4.2.2b1/common/packet.c
---- dhcp-4.2.2b1/common/packet.c.xen 2009-07-23 20:52:20.000000000 +0200
-+++ dhcp-4.2.2b1/common/packet.c 2011-07-01 14:00:16.939958989 +0200
-@@ -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))));
-
- udp_packets_seen++;
-- if (usum && usum != sum) {
-+ if (!nocsum && usum && usum != sum) {
- udp_packets_bad_checksum++;
- if (udp_packets_seen > 4 &&
- (udp_packets_seen / udp_packets_bad_checksum) < 2) {
-diff -up dhcp-4.2.2b1/common/upf.c.xen dhcp-4.2.2b1/common/upf.c
---- dhcp-4.2.2b1/common/upf.c.xen 2009-11-20 02:49:01.000000000 +0100
-+++ dhcp-4.2.2b1/common/upf.c 2011-07-01 14:00:16.940958986 +0200
-@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
-
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0)
-diff -up dhcp-4.2.2b1/includes/dhcpd.h.xen dhcp-4.2.2b1/includes/dhcpd.h
---- dhcp-4.2.2b1/includes/dhcpd.h.xen 2011-07-01 14:00:16.000000000 +0200
-+++ dhcp-4.2.2b1/includes/dhcpd.h 2011-07-01 14:12:18.069642470 +0200
-@@ -2796,7 +2796,7 @@ ssize_t decode_hw_header (struct interfa
- unsigned, struct hardware *);
- ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *,
- unsigned, struct sockaddr_in *,
-- unsigned, unsigned *);
-+ unsigned, unsigned *, int);
-
- /* ethernet.c */
- void assemble_ethernet_header (struct interface_info *, unsigned char *,
diff --git a/net-misc/dhcp/files/dhcp-4.2.3-options.patch b/net-misc/dhcp/files/dhcp-4.2.3-options.patch
deleted file mode 100644
index c902e62..0000000
--- a/net-misc/dhcp/files/dhcp-4.2.3-options.patch
+++ /dev/null
@@ -1,391 +0,0 @@
-diff -up dhcp-4.2.3-P2/client/clparse.c.options dhcp-4.2.3-P2/client/clparse.c
---- dhcp-4.2.3-P2/client/clparse.c.options 2011-04-21 16:08:14.000000000 +0200
-+++ dhcp-4.2.3-P2/client/clparse.c 2012-02-13 18:21:32.233471518 +0100
-@@ -146,6 +146,7 @@ isc_result_t read_client_conf ()
- /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
- */
- top_level_config.requested_lease = 7200;
-+ top_level_config.bootp_broadcast_always = 0;
-
- group_allocate (&top_level_config.on_receipt, MDL);
- if (!top_level_config.on_receipt)
-@@ -313,7 +314,8 @@ void read_client_leases ()
- interface-declaration |
- LEASE client-lease-statement |
- ALIAS client-lease-statement |
-- KEY key-definition */
-+ KEY key-definition |
-+ BOOTP_BROADCAST_ALWAYS */
-
- void parse_client_statement (cfile, ip, config)
- struct parse *cfile;
-@@ -732,6 +734,12 @@ void parse_client_statement (cfile, ip,
- parse_reject_statement (cfile, config);
- return;
-
-+ case BOOTP_BROADCAST_ALWAYS:
-+ token = next_token(&val, (unsigned*)0, cfile);
-+ config -> bootp_broadcast_always = 1;
-+ parse_semi (cfile);
-+ return;
-+
- default:
- lose = 0;
- stmt = (struct executable_statement *)0;
-diff -up dhcp-4.2.3-P2/client/dhclient.c.options dhcp-4.2.3-P2/client/dhclient.c
---- dhcp-4.2.3-P2/client/dhclient.c.options 2011-12-31 01:55:21.000000000 +0100
-+++ dhcp-4.2.3-P2/client/dhclient.c 2012-02-13 18:22:11.554979930 +0100
-@@ -39,6 +39,12 @@
- #include <limits.h>
- #include <dns/result.h>
-
-+/*
-+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
-+ * that when building ISC code.
-+ */
-+extern int asprintf(char **strp, const char *fmt, ...);
-+
- TIME default_lease_time = 43200; /* 12 hours... */
- TIME max_lease_time = 86400; /* 24 hours... */
-
-@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute
- int wanted_ia_ta = 0;
- int wanted_ia_pd = 0;
- char *mockup_relay = NULL;
-+int bootp_broadcast_always = 0;
-+
-+extern u_int32_t default_requested_options[];
-
- void run_stateless(int exit_mode);
-
-@@ -123,6 +132,15 @@ main(int argc, char **argv) {
- int local_family_set = 0;
- #endif /* DHCPv6 */
- char *s;
-+ char *dhcp_client_identifier_arg = NULL;
-+ char *dhcp_host_name_arg = NULL;
-+ char *dhcp_fqdn_arg = NULL;
-+ char *dhcp_vendor_class_identifier_arg = NULL;
-+ char *dhclient_request_options = NULL;
-+
-+ int timeout_arg = 0;
-+ char *arg_conf = NULL;
-+ int arg_conf_len = 0;
-
- /* Initialize client globals. */
- memset(&default_duid, 0, sizeof(default_duid));
-@@ -310,6 +328,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 == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
-+ exit(1);
-+ }
-+
-+ dhcp_client_identifier_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-B")) {
-+ bootp_broadcast_always = 1;
-+ } else if (!strcmp(argv[i], "-H")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= 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 != NULL) {
-+ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
-+ exit(1);
-+ }
-+
-+ dhcp_host_name_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-F")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= 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 != NULL) {
-+ log_error("Only one -F <fqdn> argument can be specified");
-+ exit(1);
-+ }
-+
-+ if (dhcp_host_name_arg != NULL) {
-+ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
-+ exit(1);
-+ }
-+
-+ dhcp_fqdn_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-timeout")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if ((timeout_arg = atoi(argv[i])) <= 0) {
-+ log_error("timeout option must be > 0 - bad value: %s",argv[i]);
-+ exit(1);
-+ }
-+ } else if (!strcmp(argv[i], "-V")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
-+ exit(1);
-+ }
-+
-+ dhcp_vendor_class_identifier_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-R")) {
-+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
-+ exit(1);
-+ }
-+
-+ dhclient_request_options = argv[i];
- } else if (argv[i][0] == '-') {
- usage();
- } else if (interfaces_requested < 0) {
-@@ -484,6 +584,156 @@ main(int argc, char **argv) {
- /* Parse the dhclient.conf file. */
- read_client_conf();
-
-+ /* Parse any extra command line configuration arguments: */
-+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
-+ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -I option dhcp-client-identifier");
-+ }
-+
-+ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -H option host-name");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -H option host-name");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -F option fqdn.fqdn");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -F option fqdn.fqdn");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (timeout_arg) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to process -timeout timeout argument");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len == 0))
-+ log_fatal("Unable to process -timeout timeout argument");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -V option vendor-class-identifier");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to send -V option vendor-class-identifier");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (dhclient_request_options != NULL) {
-+ if (arg_conf == 0) {
-+ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to parse -R <request options list> argument");
-+ } else {
-+ char *last_arg_conf = arg_conf;
-+ arg_conf = NULL;
-+ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
-+
-+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to parse -R <request options list> argument");
-+
-+ free(last_arg_conf);
-+ }
-+ }
-+
-+ if (arg_conf) {
-+ if (arg_conf_len == 0)
-+ if ((arg_conf_len = strlen(arg_conf)) == 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 = (struct parse *)0;
-+ const char *val = NULL;
-+ int token;
-+
-+ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
-+
-+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
-+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
-+ /* more detailed parse failures will be logged */
-+
-+ do {
-+ token = peek_token(&val, (unsigned *)0, cfile);
-+ if (token == 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 arguments !");
-+ end_parse(&cfile);
-+
-+ if (timeout_arg) {
-+ /* we just set the toplevel timeout, but per-client
-+ * timeouts may still be at defaults.
-+ */
-+ for (ip=interfaces; ip; ip = ip->next) {
-+ if (ip->client->config->timeout == 60)
-+ ip->client->config->timeout = timeout_arg;
-+ }
-+ }
-+
-+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
-+ for (ip=interfaces; ip; ip = ip->next) {
-+ if (ip->client->config->requested_options == default_requested_options)
-+ ip->client->config->requested_options = top_level_config.requested_options;
-+ }
-+ }
-+
-+ free(arg_conf);
-+ arg_conf = NULL;
-+ arg_conf_len = 0;
-+ }
-+
- /* Parse the lease database. */
- read_client_leases();
-
-@@ -2397,7 +2647,8 @@ void make_discover (client, lease)
- client -> packet.xid = random ();
- client -> packet.secs = 0; /* filled in by send_discover. */
-
-- 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 = 0;
- else
- client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2481,7 +2732,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 = 0;
- else
- client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2543,7 +2796,8 @@ void make_decline (client, lease)
- client -> packet.hops = 0;
- client -> packet.xid = client -> xid;
- client -> packet.secs = 0; /* Filled in by send_request. */
-- 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 = 0;
- else
- client -> packet.flags = htons (BOOTP_BROADCAST);
-diff -up dhcp-4.2.3-P2/common/conflex.c.options dhcp-4.2.3-P2/common/conflex.c
---- dhcp-4.2.3-P2/common/conflex.c.options 2011-09-21 22:43:10.000000000 +0200
-+++ dhcp-4.2.3-P2/common/conflex.c 2012-02-13 18:21:32.335470243 +0100
-@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
- 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.3-P2/includes/dhcpd.h.options dhcp-4.2.3-P2/includes/dhcpd.h
---- dhcp-4.2.3-P2/includes/dhcpd.h.options 2011-12-31 00:17:04.000000000 +0100
-+++ dhcp-4.2.3-P2/includes/dhcpd.h 2012-02-13 18:21:32.542467656 +0100
-@@ -1147,6 +1147,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_BROADCAST
-+ flag in requests */
- };
-
- /* Per-interface state used in the dhcp client... */
-diff -up dhcp-4.2.3-P2/includes/dhctoken.h.options dhcp-4.2.3-P2/includes/dhctoken.h
---- dhcp-4.2.3-P2/includes/dhctoken.h.options 2011-09-21 22:43:10.000000000 +0200
-+++ dhcp-4.2.3-P2/includes/dhctoken.h 2012-02-13 18:21:32.644466377 +0100
-@@ -363,7 +363,8 @@ enum dhcp_token {
- INITIAL_DELAY = 664,
- GETHOSTBYNAME = 665,
- PRIMARY6 = 666,
-- SECONDARY6 = 667
-+ SECONDARY6 = 667,
-+ BOOTP_BROADCAST_ALWAYS = 668
- };
-
- #define is_identifier(x) ((x) >= FIRST_TOKEN && \
diff --git a/net-misc/dhcp/files/dhcpd.conf2 b/net-misc/dhcp/files/dhcpd.conf2
deleted file mode 100644
index 5cd2eec..0000000
--- a/net-misc/dhcp/files/dhcpd.conf2
+++ /dev/null
@@ -1,28 +0,0 @@
-# /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="/var/lib/dhcp/chroot"
-
-# 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="/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=""
-
-# Insert any other dhcpd options - see the man page for a full list.
-# DHCPD_OPTS=""
diff --git a/net-misc/dhcp/files/dhcpd.init2 b/net-misc/dhcp/files/dhcpd.init2
deleted file mode 100644
index 82cb26e..0000000
--- a/net-misc/dhcp/files/dhcpd.init2
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/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="configtest"
-
-DHCPD_CONF=${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=$?
- if [ $ret -ne 0 ]; then
- eerror "${SVCNAME} has detected a syntax error in your configuration files:"
- /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 "*)
- DHCPD_CONF=" ${DHCPD_OPTS} "
- DHCPD_CONF="${DHCPD_CONF##* -cf }"
- DHCPD_CONF="${DHCPD_CONF%% *}"
- ;;
- *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
- ;;
- esac
-
- if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then
- eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist"
- return 1
- fi
-
- checkconfig || return 1
-
- local leasefile="$(get_var lease-file-name)"
- leasefile="${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="${LD_PRELOAD} /usr/lib/libresolv.so"
- export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so"
- fi
-
- local pidfile="$(get_var pid-file-name)"
- pidfile="${pidfile:-/var/run/dhcp/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="$(get_options chroot)"
-
- 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.init5 b/net-misc/dhcp/files/dhcpd.init5
deleted file mode 100755
index 79c7f2b..0000000
--- a/net-misc/dhcp/files/dhcpd.init5
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init5,v 1.1 2011/12/04 22:45:07 vapier Exp $
-
-extra_commands="configtest"
-
-: ${DHCPD_CONF:=/etc/dhcp/${SVCNAME}.conf}
-
-depend() {
- need net
- use logger dns
-}
-
-get_var() {
- local var="$(sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' "${chroot}${DHCPD_CONF}")"
- echo ${var:-$2}
-}
-
-checkconfig() {
- set -- ${DHCPD_OPTS} ${chroot:+-chroot} ${chroot} -t
-
- dhcpd "$@" 1>/dev/null 2>&1
- local ret=$?
- if [ ${ret} -ne 0 ] ; then
- eerror "${SVCNAME} has detected a syntax error in your configuration files:"
- dhcpd "$@"
- fi
-
- return ${ret}
-}
-
-configtest() {
- local chroot=${DHCPD_CHROOT%/}
-
- ebegin "Checking ${SVCNAME} configuration"
- checkconfig
- eend $?
-}
-
-start() {
- local chroot=${DHCPD_CHROOT%/}
-
- # Work out our cffile if it's in our DHCPD_OPTS
- case " ${DHCPD_OPTS} " in
- *" -cf "*)
- DHCPD_CONF=" ${DHCPD_OPTS} "
- DHCPD_CONF="${DHCPD_CONF##* -cf }"
- DHCPD_CONF="${DHCPD_CONF%% *}"
- ;;
- *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
- ;;
- esac
-
- if [ -n "${chroot}" ] ; then
- # the config test want's these to exist
- mkdir -p \
- "${chroot}"/var/run/dhcp \
- "${chroot}"/var/lib/dhcp \
- "${chroot}"/etc/dhcp
- fi
-
- # see comment in get_var() above
- if [ ! -f "${chroot}${DHCPD_CONF}" ] ; then
- eerror "${chroot}${DHCPD_CONF} does not exist"
- return 1
- fi
-
- checkconfig || return 1
-
- checkpath -d -o dhcp:dhcp "${chroot}"/var/run/dhcp "${chroot}"/var/lib/dhcp
-
- local leasefile="$(get_var lease-file-name /var/lib/dhcp/${SVCNAME}.leases)"
- checkpath -f -o dhcp:dhcp "${chroot}${leasefile}"
-
- # Setup LD_PRELOAD so name resolution works in our chroot.
- if [ -n "${chroot}" ] ; then
- checkpath -d -o root:root -m 755 "${chroot}"/dev "${chroot}"/etc "${chroot}"/proc
- cp -pP /etc/localtime /etc/resolv.conf "${chroot}"/etc/
- export LD_PRELOAD="${LD_PRELOAD} libresolv.so libnss_dns.so"
- if ! mountinfo -q "${chroot}/proc" ; then
- mount --bind /proc "${chroot}/proc"
- fi
- fi
-
- local pidfile="$(get_var pid-file-name /var/run/dhcp/${SVCNAME}.pid)"
-
- ebegin "Starting ${chroot:+chrooted }${SVCNAME}"
- start-stop-daemon --start --exec /usr/sbin/dhcpd \
- --pidfile "${chroot}/${pidfile}" \
- -- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \
- -user dhcp -group dhcp \
- ${chroot:+-chroot} ${chroot} ${DHCPD_IFACE}
- eend $? \
- && save_options chroot "${chroot}" \
- && save_options pidfile "${pidfile}"
-}
-
-stop() {
- local chroot="$(get_options chroot)"
-
- ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
- start-stop-daemon --stop --exec /usr/sbin/dhcpd \
- --pidfile "${chroot}/$(get_options pidfile)"
- res=$?
-
- if [ ${res} -eq 0 ] && [ -n "${chroot}" ] ; then
- if mountinfo -q "${chroot}/proc" ; then
- umount "${chroot}/proc"
- fi
- fi
-
- eend $res
-}
diff --git a/net-misc/dhcp/files/dhcrelay.conf b/net-misc/dhcp/files/dhcrelay.conf
deleted file mode 100644
index 1102d3a..0000000
--- a/net-misc/dhcp/files/dhcrelay.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# /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=""
-
-# Insert any other options needed. See dhcrelay(8) for details.
-#DHCRELAY_OPTS=""
-
-# Space separated list of IPs to forward BOOTP/DHCP packets to.
-DHCRELAY_SERVERS=""
diff --git a/net-misc/dhcp/files/dhcrelay.init2 b/net-misc/dhcp/files/dhcrelay.init2
deleted file mode 100755
index 4f09249..0000000
--- a/net-misc/dhcp/files/dhcrelay.init2
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/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_SERVERS}
- 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
deleted file mode 100644
index bd60507..0000000
--- a/net-misc/dhcp/metadata.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata>
- <longdescription lang="en">The ISC DHCP client/server package.</longdescription>
- <longdescription lang="ja">ISC DHCP クライアント/サーバ・パッケージです。</longdescription>
- <use>
- <flag name='client'>Install the dhclient program</flag>
- <flag name='server'>Install the dhcpd and dhcrelay programs</flag>
- </use>
-</pkgmetadata>
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-06-13 16:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-22 13:33 [gentoo-commits] proj/sci:master commit in: net-misc/dhcp/files/, net-misc/dhcp/ Alexey Shvetsov
-- strict thread matches above, loose matches on Subject: below --
2012-03-15 19:49 Alexey Shvetsov
2012-03-15 19:55 Alexey Shvetsov
2012-03-15 19:58 Alexey Shvetsov
2012-03-15 20:03 Alexey Shvetsov
2012-03-15 20:05 Alexey Shvetsov
2012-03-15 21:00 Alexey Shvetsov
2012-03-15 21:42 Alexey Shvetsov
2013-06-13 16:42 Justin Lecher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox