Merge pull request #428 from crawford/dhcp

net-misc/dhcp: unused and triggering GLSA failures
This commit is contained in:
Alex Crawford 2016-05-18 16:54:58 -07:00
commit df4bdcc132
18 changed files with 0 additions and 1467 deletions

View File

@ -1 +0,0 @@
DIST dhcp-4.2.2.tar.gz 8764108 RMD160 a7d0a66a6156cc2194a784b120587ffd5e8e200e SHA1 a2d5d5bf0fb2a98e9e3e18b243d0a07e12837f81 SHA256 846ee115bd3a789ef4d8d051e1078b920b152c5644179c1a28ed59aa1b5ee38c

View File

@ -1,265 +0,0 @@
# 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.2-r1.ebuild,v 1.2 2011/08/29 21:08:27 flameeyes Exp $
EAPI="2"
inherit eutils 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"
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 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
# 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}/dhcprelay.pid"
#define _PATH_DHCRELAY6_PID "${r}/dhcprelay6.pid"
EOF
econf \
--enable-paranoia \
--sysconfdir=${e} \
$(use_enable ipv6 dhcpv6) \
$(use_with ldap) \
$(use ldap && use_with ssl ldapcrypto || echo --without-ldapcrypto)
# configure local bind cruft
cd bind/bind-*/ || die
eval econf \
$(sed -n '/ [.].configure /{s:^[^-]*::;s:>.*::;p}' ../Makefile) \
--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.init3 dhcpd || die
newconfd "${FILESDIR}"/dhcpd.conf dhcpd || die
newinitd "${FILESDIR}"/dhcrelay.init2 dhcrelay || die
newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay || 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"
}

View File

@ -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);

View File

@ -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
}

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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 ${LIBS}
#We don't need rbtdb64 for this library
#rbtdb64.@O@: rbtdb.c

View File

@ -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... ; \

View File

@ -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} $@

View File

@ -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
}

View File

@ -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>

View File

@ -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

View File

@ -1,29 +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="/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=""

View File

@ -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 $?
}

View File

@ -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=""

View File

@ -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 $?
}

View File

@ -1,11 +0,0 @@
<?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>
</use>
</pkgmetadata>