diff options
-rw-r--r-- | net-misc/dhcp/ChangeLog | 9 | ||||
-rw-r--r-- | net-misc/dhcp/dhcp-3.1.0_alpha1.ebuild | 235 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-3.1.0a1-dhclient-resolvconf.patch | 254 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-3.1.0a1-x-option.patch | 223 | ||||
-rw-r--r-- | net-misc/dhcp/files/digest-dhcp-3.1.0_alpha1 | 3 |
5 files changed, 723 insertions, 1 deletions
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog index 9871de5a786b..18b522ff8b09 100644 --- a/net-misc/dhcp/ChangeLog +++ b/net-misc/dhcp/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-misc/dhcp # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.115 2006/09/06 07:35:03 uberlord Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.116 2006/09/07 19:53:36 uberlord Exp $ + +*dhcp-3.1.0_alpha1 (07 Sep 2006) + + 07 Sep 2006; Roy Marples <uberlord@gentoo.org> + +files/dhcp-3.1.0a1-dhclient-resolvconf.patch, + +files/dhcp-3.1.0a1-x-option.patch, +dhcp-3.1.0_alpha1.ebuild: + New alpha version. Has FQDN support, wooooo. 06 Sep 2006; Roy Marples <uberlord@gentoo.org> dhcp-3.0.5_rc2.ebuild: Just warn about Packet Socket instead of requiring linux sources diff --git a/net-misc/dhcp/dhcp-3.1.0_alpha1.ebuild b/net-misc/dhcp/dhcp-3.1.0_alpha1.ebuild new file mode 100644 index 000000000000..c41b82a2a8d7 --- /dev/null +++ b/net-misc/dhcp/dhcp-3.1.0_alpha1.ebuild @@ -0,0 +1,235 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-3.1.0_alpha1.ebuild,v 1.1 2006/09/07 19:53:36 uberlord Exp $ + +inherit eutils flag-o-matic multilib toolchain-funcs + +MY_PV="${PV//_alpha/a}" +MY_PV="${MY_PV//_beta/b}" +MY_PV="${MY_PV//_rc/rc}" +MY_P="${PN}-${MY_PV}" +DESCRIPTION="ISC Dynamic Host Configuration Protocol" +HOMEPAGE="http://www.isc.org/products/DHCP" +SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz" + +LICENSE="isc-dhcp" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="doc minimal static selinux" + +DEPEND="selinux? ( sec-policy/selinux-dhcp ) + kernel_linux? ( sys-apps/net-tools )" + +PROVIDE="virtual/dhcpc" + +S="${WORKDIR}/${MY_P}" + +src_unpack() { + unpack ${A} + cd "${S}" + + # Gentoo patches - these will probably never be accepted upstream + # Enable chroot support + epatch "${FILESDIR}/${PN}"-3.0-paranoia.patch + # Fix some permission issues + epatch "${FILESDIR}/${PN}"-3.0-fix-perms.patch + # Enable dhclient to equery NTP servers + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-ntp.patch + # resolvconf support in dhclient-script + epatch "${FILESDIR}/${PN}"-3.1.0a1-dhclient-resolvconf.patch + # Fix setting hostnames on Linux + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-hostname.patch + # Allow mtu settings + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-mtu.patch + # Allow dhclient to use IF_METRIC to set route metrics + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-metric.patch + # Stop downing the interface on Linux as that breaks link dameons + # such as wpa_supplicant and netplug + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-no-down.patch + # Quiet the isc blurb + epatch "${FILESDIR}/${PN}"-3.0.3-no_isc_blurb.patch + # Enable dhclient to get extra configuration from stdin + epatch "${FILESDIR}/${PN}"-3.0.4-dhclient-stdin-conf.patch + + # General fixes which will probably be accepted upstream eventually + # Install libdst, #75544 + epatch "${FILESDIR}/${PN}"-3.0.3-libdst.patch + # Fix building on Gentoo/FreeBSD + epatch "${FILESDIR}/${PN}"-3.0.2-gmake.patch + + # NetworkManager support patches + # If they fail to apply to future versions they will be dropped + # Enable eXtended options + epatch "${FILESDIR}/${PN}"-3.1.0a1-x-option.patch + # Add dbus support to dhclient + epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch + + # Brand the version with Gentoo + # include revision if >0 + local newver="${MY_PV}-Gentoo" + [[ ${PR} != "r0" ]] && newver="${newver}-${PR}" + sed -i '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \ + includes/version.h || 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 + + # Remove these options from the sample config + sed -i -e "/\(script\|host-name\|domain-name\) / d" \ + client/dhclient.conf || die + + # Build sed man pages as we don't ever support BSD 4.4 and older, #130251. + local x= + for x in Makefile.dist $(ls */Makefile.dist) ; do + sed -i -e 's/$(CATMANPAGES)/$(SEDMANPAGES)/g' "${x}" || die + done + + # Only install different man pages if we don't have en + if [[ " ${LINGUAS} " != *" en "* ]]; then + # Install Japanese man pages + if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then + einfo "Installing Japanese documention" + cp doc/ja_JP.eucJP/dhclient* client + cp doc/ja_JP.eucJP/dhcp* common + fi + fi + + # Now remove the non-english docs so there are no errors later + [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP +} + +src_compile() { + use static && append-ldflags -static + + cat <<-END >> includes/site.h + #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf" + #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid" + #define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases" + #define _PATH_DHCLIENT_CONF "/etc/dhcp/dhclient.conf" + #define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases" + #define _PATH_DHCLIENT_PID "/var/run/dhcp/dhclient.pid" + #define DHCPD_LOG_FACILITY LOG_LOCAL1 + END + + cat <<-END > site.conf + CC = $(tc-getCC) + LFLAGS = ${LDFLAGS} + LIBDIR = /usr/$(get_libdir) + INCDIR = /usr/include + ETC = /etc/dhcp + VARDB = /var/lib/dhcp + VARRUN = /var/run/dhcp + ADMMANDIR = /usr/share/man/man8 + ADMMANEXT = .8 + FFMANDIR = /usr/share/man/man5 + FFMANEXT = .5 + LIBMANDIR = /usr/share/man/man3 + LIBMANEXT = .3 + USRMANDIR = /usr/share/man/man1 + USRMANEXT = .1 + MANCAT = man + END + + ./configure --copts "-DPARANOIA -DEARLY_CHROOT -DEXTENDED_NEW_OPTION_INFO \ + ${CFLAGS}" || die "configure failed" + + # Remove server support from the Makefile + # We still install some extra crud though + if use minimal ; then + sed -i -e 's/\(server\|relay\|dhcpctl\)/ /g' work.*/Makefile || die + fi + emake || die "compile problem" +} + +src_install() { + make install DESTDIR="${D}" || die + use doc && dodoc README RELNOTES doc/* + + insinto /etc/dhcp + newins client/dhclient.conf dhclient.conf.sample + keepdir /var/{lib,run}/dhcp + + # Install our server files + if ! use minimal ; then + insinto /etc/dhcp + newins server/dhcpd.conf dhcpd.conf.sample + newinitd "${FILESDIR}"/dhcpd.init dhcpd + newinitd "${FILESDIR}"/dhcrelay.init dhcrelay + insinto /etc/conf.d + newins "${FILESDIR}"/dhcpd.conf dhcpd + newins "${FILESDIR}"/dhcrelay.conf dhcrelay + fi +} + +pkg_preinst() { + if ! use minimal ; then + enewgroup dhcp + enewuser dhcp -1 -1 /var/lib/dhcp dhcp + fi +} + +pkg_postinst() { + if use kernel_linux ; then + ewarn + ewarn "${PN} requires kernel support for Packet Socket (CONFIG_PACKET)." + ewarn + fi + + use minimal && return + + chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp + + if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then + ewarn + ewarn "WARNING: The dhcp init script has been renamed to dhcpd" + ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and" + ewarn "and dhcp should be removed from the default runlevel" + ewarn + fi + + einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings." + einfo + einfo "If you would like to run dhcpd in a chroot, simply configure the" + einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:" + einfo " emerge --config =${PF}" +} + +pkg_config() { + if use minimal ; then + eerror "${PN} has not been compiled for server support" + eerror "emerge ${PN} without the minimal USE flag to use dhcp sever" + return 1 + fi + + 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.1.0a1-dhclient-resolvconf.patch b/net-misc/dhcp/files/dhcp-3.1.0a1-dhclient-resolvconf.patch new file mode 100644 index 000000000000..2baaa78418e6 --- /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 ++ echo -e "$conf" | resolvconf -a "$interface" ++ else ++ echo -e "$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 ++ echo -e "$conf" | resolvconf -a "$interface" ++ else ++ echo -e "$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 ++ echo -e "$conf" | resolvconf -a "$interface" ++ else ++ echo -e "$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 ++ echo -e "$conf" | resolvconf -a "$interface" ++ else ++ echo -e "$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 ++ echo -e "$conf" | resolvconf -a "$interface" ++ else ++ echo -e "$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 ++ echo -e "$conf" | resolvconf -a "$interface" ++ else ++ echo -e "$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.0a1-x-option.patch b/net-misc/dhcp/files/dhcp-3.1.0a1-x-option.patch new file mode 100644 index 000000000000..8728e0ced490 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.1.0a1-x-option.patch @@ -0,0 +1,223 @@ +diff -ur client.orig/dhclient.8 client/dhclient.8 +--- client.orig/dhclient.8 2006-09-07 19:24:17.756460024 +0100 ++++ client/dhclient.8 2006-09-07 19:24:52.000000000 +0100 +@@ -85,6 +85,9 @@ + .B -w + ] + [ ++.B -x ++] ++[ + .I if0 + [ + .I ...ifN +@@ -268,6 +271,10 @@ + supplying the + .B -nw + flag. ++.PP ++The -x argument enables eXtended option information to be created in the ++-s dhclient-script environment, which would allow applications running ++in that environment to handle options they do not know about in advance. + .SH CONFIGURATION + The syntax of the dhclient.conf(5) file is discussed separately. + .SH OMAPI +diff -ur client.orig/dhclient.c client/dhclient.c +--- client.orig/dhclient.c 2006-09-07 19:24:17.756460024 +0100 ++++ client/dhclient.c 2006-09-07 19:24:52.000000000 +0100 +@@ -74,7 +74,9 @@ + int onetry=0; + int quiet=0; + int nowait=0; +- ++#ifdef EXTENDED_NEW_OPTION_INFO ++int extended_option_environment = 0; ++#endif + static void usage PROTO ((void)); + + void do_release(struct client_state *); +@@ -211,6 +213,11 @@ + } else if (!strcmp (argv [i], "--version")) { + log_info ("isc-dhclient-%s", DHCP_VERSION); + exit (0); ++#ifdef EXTENDED_NEW_OPTION_INFO ++ } else if (!strcmp (argv [i], "-x")) { ++ extended_option_environment = 1; ++ new_option_info_tree = GENERATE_NEW_OPTION_INFO; ++#endif + } else if (argv [i][0] == '-') { + usage (); + } else { +@@ -483,7 +490,11 @@ + log_info (arr); + log_info (url); + ++#ifdef EXTENDED_NEW_OPTION_INFO ++ log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s", ++#else + log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s", ++#endif + "[-s server]"); + log_error (" [-cf config-file] [-lf lease-file]%s", + "[-pf pid-file] [-e VAR=val]"); +@@ -2479,8 +2490,28 @@ + struct envadd_state { + struct client_state *client; + const char *prefix; ++ struct universe *universe; + }; + ++#ifdef EXTENDED_NEW_OPTION_INFO ++static ++void build_universe_info_envvar ++( struct option_cache *oc, ++ struct packet *p, struct lease *l, ++ struct client_state *client, ++ struct option_state *in_o, ++ struct option_state *cf_o, ++ struct binding_scope **scope, ++ struct universe *u, void *es ++) ++{ ++ char info_name[512], info_data[512]; ++ snprintf(info_name, 512, "%s._universe_.", oc->option->universe->name); ++ snprintf(info_data, 512, "%u:%s", oc->option->code,oc->option->format); ++ client_envadd( client, info_name, oc->option->name, info_data ); ++} ++#endif ++ + void client_option_envadd (struct option_cache *oc, + struct packet *packet, struct lease *lease, + struct client_state *client_state, +@@ -2497,6 +2528,31 @@ + in_options, cfg_options, scope, oc, MDL)) { + if (data.len) { + char name [256]; ++#ifdef EXTENDED_NEW_OPTION_INFO ++ if ( extended_option_environment ) ++ { ++ if( ( oc->option->universe != &dhcp_universe ) ++ &&( oc->option->universe->index > fqdn_universe.index ) ++ &&( es->universe != oc->option->universe ) ++ ) ++ { ++ es->universe = oc->option->universe; ++ (*(es->universe->foreach)) ++ ( (struct packet *)0, (struct lease *)0, ++ client_state, ++ in_options, cfg_options, ++ scope, es->universe, es, ++ build_universe_info_envvar ++ ); ++ }else ++ if ( lookup_new_option_info(oc->option) != 0L ) ++ build_universe_info_envvar ++ ( oc, packet, lease, client_state, ++ in_options, cfg_options, scope, ++ oc->option->universe, es ++ ); ++ } ++#endif + if (dhcp_option_ev_name (name, sizeof name, + oc -> option)) { + client_envadd (es -> client, es -> prefix, +@@ -2525,6 +2581,7 @@ + + es.client = client; + es.prefix = prefix; ++ es.universe = 0L; + + client_envadd (client, + prefix, "ip_address", "%s", piaddr (lease -> address)); +@@ -2736,7 +2793,14 @@ + s = option -> name; + if (j + 1 == buflen) + return 0; ++#ifdef EXTENDED_NEW_OPTION_INFO ++ if ( ! extended_option_environment ) ++ buf [j++] = '_'; ++ else ++ buf [j++] = '.'; ++#else + buf [j++] = '_'; ++#endif + } + ++i; + } while (i != 2); +diff -ur /tmp/dhcp-3.1.0a1/common/parse.c ./common/parse.c +--- /tmp/dhcp-3.1.0a1/common/parse.c 2006-09-07 19:24:17.753460480 +0100 ++++ ./common/parse.c 2006-09-07 19:27:18.000000000 +0100 +@@ -1566,6 +1566,10 @@ + option, MDL); + option_name_hash_add(option->universe->name_hash, option->name, 0, + option, MDL); ++#ifdef EXTENDED_NEW_OPTION_INFO ++ if (new_option_info_tree != 0L) ++ add_new_option_info(option); ++#endif + return 1; + } + +Only in ./common: parse.c.orig +diff -ur /tmp/dhcp-3.1.0a1/common/tables.c ./common/tables.c +--- /tmp/dhcp-3.1.0a1/common/tables.c 2006-09-07 19:24:17.754460328 +0100 ++++ ./common/tables.c 2006-09-07 19:24:52.000000000 +0100 +@@ -887,3 +887,40 @@ + universe_hash_add(universe_hash, isc_universe.name, 0, + &isc_universe, MDL); + } ++ ++#ifdef EXTENDED_NEW_OPTION_INFO ++#include <search.h> ++ ++void *new_option_info_tree = 0L; ++ ++static int new_option_info_comparator( const void* p1, const void *p2 ) ++{ ++ uint32_t ocode1 = (((const struct option*)p1)->universe->index << 8) ++ |(((const struct option*)p1)->code), ++ ocode2 = (((const struct option*)p2)->universe->index << 8) ++ |(((const struct option*)p2)->code); ++ return( (ocode1 == ocode2) ++ ? 0 ++ :( ( ocode1 > ocode2 ) ++ ? 1 ++ : -1 ++ ) ++ ); ++} ++ ++void *add_new_option_info( struct option *option ) ++{ ++ if ( option->universe->index >= fqdn_universe.index ) ++ return 0L; ++ if ( new_option_info_tree == GENERATE_NEW_OPTION_INFO ) ++ new_option_info_tree = (void*)0L; ++ return tsearch( option, &(new_option_info_tree), new_option_info_comparator ); ++} ++ ++void *lookup_new_option_info( struct option *option ) ++{ ++ if ( new_option_info_tree == GENERATE_NEW_OPTION_INFO ) ++ return 0L; ++ return tfind( option, &(new_option_info_tree), new_option_info_comparator ); ++} ++#endif +Only in ./common: tables.c.orig +diff -ur /tmp/dhcp-3.1.0a1/includes/dhcpd.h ./includes/dhcpd.h +--- /tmp/dhcp-3.1.0a1/includes/dhcpd.h 2006-09-07 19:24:17.831448624 +0100 ++++ ./includes/dhcpd.h 2006-09-07 19:24:52.000000000 +0100 +@@ -1938,6 +1938,13 @@ + void initialize_common_option_spaces PROTO ((void)); + struct universe *config_universe; + ++#ifdef EXTENDED_NEW_OPTION_INFO ++#define GENERATE_NEW_OPTION_INFO ((void*)1) ++extern void *new_option_info_tree; ++extern void *add_new_option_info( struct option*); ++extern void *lookup_new_option_info( struct option *); ++#endif ++ + /* stables.c */ + #if defined (FAILOVER_PROTOCOL) + extern failover_option_t null_failover_option; diff --git a/net-misc/dhcp/files/digest-dhcp-3.1.0_alpha1 b/net-misc/dhcp/files/digest-dhcp-3.1.0_alpha1 new file mode 100644 index 000000000000..3b3d805f94ee --- /dev/null +++ b/net-misc/dhcp/files/digest-dhcp-3.1.0_alpha1 @@ -0,0 +1,3 @@ +MD5 a326c6f135b9fa3ad24988312c784be5 dhcp-3.1.0a1.tar.gz 773828 +RMD160 4ededc197e668219d404a054816cd48e71ac8a39 dhcp-3.1.0a1.tar.gz 773828 +SHA256 80f610a6bdfe2ac2d2dd50886d903217141c2983c1a22af23fb223998769651b dhcp-3.1.0a1.tar.gz 773828 |