Add ldap patched bind and dhcp

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@373 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2008-06-08 13:25:18 +00:00
parent 005a694339
commit bc639769e8
60 changed files with 10114 additions and 12 deletions

35
net-dns/bind/Manifest Normal file
View File

@ -0,0 +1,35 @@
AUX 10bind.env 27 RMD160 872245707b4f72a212cda162c59495744d77a6e3 SHA1 7b8c1abd5910bb7a07c6b7c820c2b34a534b2593 SHA256 5ad6a4402372b43809618051873b63646746f400447bba30dc4dfecd028e3650
AUX 127.zone 227 RMD160 66ab92f201d71da613702a85806d2e8d27f6516f SHA1 6787635fd44b1f29dc34b31053ca28e4353f69e0 SHA256 65b909fc1398dfa5b532ab395d6920758937093cf7e5b5bec8242dff4fe15e89
AUX bind-9.2.5-berkdb_fix.patch 537 RMD160 db4a569f94447687410d6c0145790185a5e2b177 SHA1 e21f0148987e79a27a5d3c662223fb743a67f6c9 SHA256 f2602bb014e5e60da50019447aefadff4ff352467ed9c360aaaec01b54115ff8
AUX bind-9.2.5-dlz-mysql.patch 11296 RMD160 8a414c89c2479ad1e0212b0d6e263bbc77bed4e8 SHA1 019b83f2f87919820267d473b05d57d2052c921d SHA256 c7130b90a0afa27d91117466a6e09783b43a0ae9227e86d9f2d7e08b89539b37
AUX bind-9.2.5-mysql.patch 11315 RMD160 6161e9ebaed3b13a64d3cc17edcce8a0e64e48fc SHA1 d22cf2f08c1f4a923513c8ae06a596ac51c2441c SHA256 f275c2f5566bdc57dbe54c6a17db4397f54999715bda1c06a5457b10a8dbbc94
AUX bind-9.2.8-missing_odbc_test.patch 613 RMD160 ec141cef65e470dfc8df4c641ec96bfbd5d8cdd1 SHA1 dbc3a933cac7e474fa62fb2f71e50be91825b963 SHA256 5e6465bdb01cbb662333cc2b0a00ad51905a0cda2eb6b7abc3a0b2dd3e701f4e
AUX bind-9.3.2-missing_odbc_test.patch 613 RMD160 ec141cef65e470dfc8df4c641ec96bfbd5d8cdd1 SHA1 dbc3a933cac7e474fa62fb2f71e50be91825b963 SHA256 5e6465bdb01cbb662333cc2b0a00ad51905a0cda2eb6b7abc3a0b2dd3e701f4e
AUX bind-9.3.2-sdb-ldap.patch 1466 RMD160 7dad010d273e0975ef661280460932dbd29fc888 SHA1 077279fdb2b5c44ef40638ae7cad402e6d96d29d SHA256 306910a891dcc28bb520c7e663d021f7786eba4d5cf0bd573b7fbcc63812abee
AUX bind-9.3.4-missing_odbc_test.patch 613 RMD160 ec141cef65e470dfc8df4c641ec96bfbd5d8cdd1 SHA1 dbc3a933cac7e474fa62fb2f71e50be91825b963 SHA256 5e6465bdb01cbb662333cc2b0a00ad51905a0cda2eb6b7abc3a0b2dd3e701f4e
AUX bind-9.4.0-dlzbdb-close_cursor.patch 338 RMD160 3c92206a6c77ac8e9ea854dfc22fda5753b653a9 SHA1 903383e2b142d76a73030c27f2cdab8d100df150 SHA256 4a004d72565d6db683b879851ae8dfaddcf1b39fd0f97a995d9c5d22d72c6395
AUX bind-dlzbdb-close_cursor.patch 307 RMD160 1bbf09d393b5db40b483a952db5f39fe60efda7c SHA1 4214a98ca49b6b85366f85d40dd9d5bbfd008151 SHA256 e18fb5668ffaa540d8ec3e01fe40b1f0d1c562a094c06fa902ef67953daed9f5
AUX bind-dlzbdb-includes.patch 465 RMD160 07e120527c34ebc044f1312e491a8d8dc13ec558 SHA1 0184830214317aac4c2f60a8eeabdbbdbf3b2276 SHA256 16ac0b8ba61287a2172c99ab21dd66d0a46b104ef34f710da5933720604f70c6
AUX bind-dlzmysql5-reconnect.patch 1842 RMD160 687f6128b6511dbeecdfc81b197520b1afd74005 SHA1 7b9b8e1b85f1344e4b5d8566ab868fcb1e87a049 SHA256 7376ac37c2d3fbcf5d8e886008639bdbe642f44c9021f435af370bddd3f03bd4
AUX localhost.zone 412 RMD160 74d734f124f9078c300d089218536bcb108643d9 SHA1 8ed1efa7ba9560f59eff83712b65a4d75cee8340 SHA256 a67891fb66beb12999ade1b599f57a349337ec9a7f941962db94ac5816bc4088
AUX localhost.zone-r1 419 RMD160 4013a4c855081d823c3b17f898e483d96eac2c3a SHA1 e0c5329c72039b6abd5dca60199aee2b617475f3 SHA256 bb7ec96335f265f7d6d21b6dd63e0a794477c0ec2675864a4851717a72ac447f
AUX localhost.zone-r2 423 RMD160 d4b5c18d7f1678595799320b0bfa238d23e5119e SHA1 0e7bdf1cf307b553a572a6775efd69d9a254a77c SHA256 b6dff70386920adb21883566610b0a45b9de5a3847a870e4ad1902c5c7900399
AUX named.ca 2878 RMD160 f374039998071794501461ccc13012c052b7d117 SHA1 c2f8c46a51493e4209fca6c3f2ba7755ae6dcf2b SHA256 0bd88f7f5cab2f872d3619700e382c1df6837a8aacf28cf6a0bf336742a0ee56
AUX named.conf-r2 768 RMD160 911a089113451cf0ac58446069f6046b90f3250a SHA1 60ae31cde6a84694a1773de862c423c150e2f974 SHA256 1f6f47647c9e332ed6636f2b154cb23adad9ee53a50d0cec16b6243547418fb4
AUX named.conf-r3 1314 RMD160 b8189eaac58eb27b612eacc66826802748e145ca SHA1 d8b2af94a89472ed0b767bdebadcfebcbf6ddfd3 SHA256 ab2f7305e9a1d30406528c5ef079beb4970c89572e90d57bb5ddb27b8126ad13
AUX named.confd 319 RMD160 621fa073325cba947ffe63f7ff2867128bd90193 SHA1 c4fb9131c5b9b245ac247a2c0233dcb3bfa834da SHA256 c61a8f3b2488e0b007c9441a761026a94c40537acec4dbf7a9f8d22a14c4f3e0
AUX named.confd-r1 392 RMD160 eb80118694d541aeb06df96473ca7d226adf0f6c SHA1 8a0a19237cb661c9d10f545041783edc0f3795ce SHA256 7f985999486b6cfea652b7a7470976bc703c259ef8cbc1cedc3eaacb302805a6
AUX named.confd-r2 479 RMD160 0a0452bf9bb6f18d4628ee72abe82a52d484a2cb SHA1 d0b0e2f5d72d43862c5aaff9a226fd8599992323 SHA256 bae05257852ecbc7f66bd30e452162f15b6f6e8c3fc170fb6dfdfa7d22361915
AUX named.init 1641 RMD160 8f6ff9334b258a1167ac02572391bc4c71d946d2 SHA1 1dd468ba20c1c050b428d5dedd5bb61b44fc3006 SHA256 505604e2e1ac3d7f8e5aea74e1f9fba543570809dadc4769a0de179a10637c1b
AUX named.init-r2 1481 RMD160 e94af8ecbc639f59951ce9828fd3583e9616ca2a SHA1 e619db5d9370325e9bdb40e178dcf5da6f6809d8 SHA256 cbe7b55cf66b606ffede1847dec08e4810c1efd666d38ebc4f75dbe8277f1c13
AUX named.init-r3 1513 RMD160 f69d90d619de354b5962ba7d69c4f39e5e5ac747 SHA1 8cd9657761f1ed080e9a8494fdf0b472808e1a26 SHA256 244888788cd9ddd0f2bce687621d96ca4d8b960398b6bc3d5cb1da3639861fd4
AUX named.init-r4 1585 RMD160 30ed0f443f0ec1b63d3fd15e4d32fc79ad6199af SHA1 e600929124b4e993552896f6f111f06a706fed89 SHA256 f2eb9393a7380f670af0e09bd378cf619681e33b81ed7e5c7f5b7a1b01964821
AUX named.init-r5 1620 RMD160 37279362e437241188a07e5f274730e68645827e SHA1 00a14819a322b391183084c79cc9a4dc04d0d484 SHA256 07fb9d653f086319680d04abde0218495ed09d3528087257788bf294252a0bad
AUX named.rc 1644 RMD160 ab040b05deea9b8b1b2a8a75c174be103aa9a4a9 SHA1 1d3503cb3312f68851bda57c1fd23a90af36256e SHA256 07a1b0958594e067259cfbf8b6eeb33125536e2f82f0e63c2d802943eed1bdb6
AUX named.rc6 1434 RMD160 f56a0c837609467df4b18b63979542ee7447c83b SHA1 992ef568bade0a5125c58258019b725ca6ac8fc3 SHA256 2619fc7695b84a35f9362bc1c0da4a3835e207f99f1164a56e0bbb97e70df057
AUX named.rc6-pid_fix 488 RMD160 e59636895b54535a6e7e378635791c3c01728907 SHA1 3b57a5dce713716617de2e94eb1cb53b9876fc84 SHA256 612fbc406fff920a4a2a35ee6146ff31cf8ca1535b21a6a5eed1c912ee631cb5
AUX named.rc6-smart_pid_fix 1204 RMD160 376ecf34ef5543571f1551a7d83da504ac420628 SHA1 7da3b265235a486686affc2806bd497d98ffc68b SHA256 703aa04162bee124fd492c991ba21ca7276112c61c297f0fa424e2cd4333f060
DIST bind-9.5.0.tar.gz 6749437 RMD160 1f40217a7baab442f30e024698999ba845f6f05d SHA1 8d622ebcb6061518770cbc66072258c7ff051cb8 SHA256 fbb4c02c792a5298f8c71d617dfbab2acebbbdd51ea1d1e94d1aa66de48ddd61
DIST bind-sdb-ldap-1.1.0.tar.gz 8687 RMD160 472b90c3792fe846bb5170e8e1bea9dccb28522a SHA1 99069a42cb318176bd190677209fedc19eeef10c SHA256 c0a07b41d67924e13ff362615f3c18a496fb7cb9ea11431f29f3e46d847e4b1c
DIST dyndns-samples.tbz2 22866 RMD160 27d5b2d0edb8e1ff16b3f980c38d7af33ccf0c7d SHA1 0a62e9458d0e16b67a3a2f63ea485ce969f1fb4d SHA256 92fb06a92ca99cbbe96b90bcca229ef9c12397db57ae17e199dad9f1218fdbe8
EBUILD bind-9.5.0-r1.ebuild 9216 RMD160 70bb89e617fc93572f9658cf9408f19190f92fb2 SHA1 70fc1d7d51e93ed3c2c85283f9e19237715dfd45 SHA256 80717b2545ffb19ca0aee7110a61ea01e7bcb45f4486209540a72767db1e66a4

View File

@ -0,0 +1,291 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.5.0.ebuild,v 1.2 2008/06/06 14:40:52 dertobi123 Exp $
inherit eutils libtool autotools toolchain-funcs flag-o-matic
DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
HOMEPAGE="http://www.isc.org/products/BIND/bind9.html"
SRC_URI="ftp://ftp.isc.org/isc/bind9/${PV}/${P}.tar.gz
doc? ( mirror://gentoo/dyndns-samples.tbz2 )
sdb-ldap? ( http://bind9-ldap.bayour.com/bind-sdb-ldap-1.1.0.tar.gz )"
LICENSE="as-is"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads resolvconf urandom sdb-ldap"
DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
mysql? ( >=virtual/mysql-4.0 )
odbc? ( >=dev-db/unixODBC-2.2.6 )
ldap? ( net-nds/openldap )
idn? ( net-dns/idnkit )"
RDEPEND="${DEPEND}
selinux? ( sec-policy/selinux-bind )
resolvconf? ( || ( net-dns/openresolv net-dns/resolvconf-gentoo ) )"
#S="${WORKDIR}/${P/_p1/-P1}"
pkg_setup() {
use threads && {
echo
ewarn "If you're in vserver enviroment, you're probably want to"
ewarn "disable threads support because of linux capabilities dependency"
echo
}
ebegin "Creating named group and user"
enewgroup named 40
enewuser named 40 -1 /etc/bind named
eend ${?}
}
src_unpack() {
unpack ${A}
cd "${S}"
# Adjusting PATHs in manpages
for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
sed -i \
-e 's:/etc/named.conf:/etc/bind/named.conf:g' \
-e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
-e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
"${i}"
done
use dlz && epatch "${FILESDIR}"/${PN}-9.4.0-dlzbdb-close_cursor.patch
# bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
# (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
# Add sdb-ldap support
use sdb-ldap && cp "${WORKDIR}"/bind-sdb-ldap-1.1.0/ldapdb.c "${S}"/bin/named/
use sdb-ldap && cp "${WORKDIR}"/bind-sdb-ldap-1.1.0/ldapdb.h "${S}"/bin/named/include/
use sdb-ldap && epatch "${FILESDIR}"/${PN}-9.3.2-sdb-ldap.patch
use dlz && use mysql && epatch ${FILESDIR}/bind-dlzmysql5-reconnect.patch
# should be installed by bind-tools
sed -e "s:nsupdate ::g" -i "${S}"/bin/Makefile.in
# bug #220361
rm "${S}"/aclocal.m4 "${S}"/libtool.m4
WANT_AUTOCONF=2.5 AT_NO_RECURSIVE=1 eautoreconf
# bug #151839
sed -e \
's:struct isc_socket {:#undef SO_BSDCOMPAT\n\nstruct isc_socket {:' \
-i lib/isc/unix/socket.c
# remove useless c++ checks
epunt_cxx
}
src_compile() {
local myconf=""
use ssl && myconf="${myconf} --with-openssl"
use idn && myconf="${myconf} --with-idn"
use dlz && {
myconf="${myconf} --with-dlz-filesystem --with-dlz-stub"
use postgres && myconf="${myconf} --with-dlz-postgres"
use mysql && myconf="${myconf} --with-dlz-mysql"
use berkdb && myconf="${myconf} --with-dlz-bdb"
use ldap && myconf="${myconf} --with-dlz-ldap"
use odbc && myconf="${myconf} --with-dlz-odbc"
}
if use threads; then
if use dlz && use mysql; then
echo
ewarn
ewarn "MySQL uses thread local storage in its C api. Thus MySQL"
ewarn "requires that each thread of an application execute a MySQL"
ewarn "\"thread initialization\" to setup the thread local storage."
ewarn "This is impossible to do safely while staying within the DLZ"
ewarn "driver API. This is a limitation caused by MySQL, and not"
ewarn "the DLZ API."
ewarn "Because of this BIND MUST only run with a single thread when"
ewarn "using the MySQL driver."
ewarn
myconf="${myconf} --disable-linux-caps --disable-threads"
ewarn "Threading support disabled"
epause 10
else
myconf="${myconf} --enable-linux-caps --enable-threads"
einfo "Threading support enabled"
fi
else
myconf="${myconf} --disable-linux-caps --disable-threads"
fi
if use urandom; then
myconf="${myconf} --with-randomdev=/dev/urandom"
else
myconf="${myconf} --with-randomdev=/dev/random"
fi
# bug #158664
gcc-specs-ssp && replace-flags -O[23s] -O
export BUILD_CC="${CBUILD}-gcc"
econf \
--sysconfdir=/etc/bind \
--localstatedir=/var \
--with-libtool \
`use_enable ipv6` \
${myconf} || die "econf failed"
emake -j1 || die "failed to compile bind"
}
src_install() {
einstall || die "failed to install bind"
dodoc CHANGES COPYRIGHT FAQ README
use doc && {
docinto misc
dodoc doc/misc/*
docinto html
dohtml doc/arm/*
docinto draft
dodoc doc/draft/*
docinto rfc
dodoc doc/rfc/*
docinto contrib
dodoc contrib/named-bootconf/named-bootconf.sh \
contrib/nanny/nanny.pl
# some handy-dandy dynamic dns examples
cd "${D}"/usr/share/doc/${PF}
tar pjxf ${DISTFILES}/dyndns-samples.tbz2
}
newenvd "${FILESDIR}"/10bind.env 10bind
dodir /etc/bind /var/bind/{pri,sec}
keepdir /var/bind/sec
insinto /etc/bind ; newins "${FILESDIR}"/named.conf-r3 named.conf
# ftp://ftp.rs.internic.net/domain/named.ca:
insinto /var/bind ; doins "${FILESDIR}"/named.ca
insinto /var/bind/pri
doins "${FILESDIR}"/127.zone
newins "${FILESDIR}"/localhost.zone-r2 localhost.zone
newinitd "${FILESDIR}"/named.init-r5 named
newconfd "${FILESDIR}"/named.confd-r2 named
dosym ../../var/bind/named.ca /var/bind/root.cache
dosym ../../var/bind/pri /etc/bind/pri
dosym ../../var/bind/sec /etc/bind/sec
# Let's get rid of those tools and their manpages since they're provided by bind-tools
rm -f "${D}"/usr/share/man/man1/{dig.1,host.1,nslookup.1}
rm -f "${D}"/usr/share/man/man8/{dnssec-keygen.8,nsupdate.8}
rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
use resolvconf && {
exeinto /etc/resolvconf/update.d
newexe "${FILESDIR}"/resolvconf.bind bind
}
}
pkg_postinst() {
if [ ! -f '/etc/bind/rndc.key' ]; then
if [ -c /dev/urandom ]; then
einfo "Using /dev/urandom for generating rndc.key"
/usr/sbin/rndc-confgen -r /dev/urandom -a -u named
echo
else
einfo "Using /dev/random for generating rndc.key"
/usr/sbin/rndc-confgen -a -u named
echo
fi
fi
install -d -o named -g named "${ROOT}"/var/run/named \
"${ROOT}"/var/bind/pri "${ROOT}"/var/bind/sec
chown -R named:named "${ROOT}"/var/bind
elog "The default zone files are now installed as *.zone,"
elog "be careful merging config files if you have modified"
elog "/var/bind/pri/127 or /var/bind/pri/localhost"
elog
elog "You can edit /etc/conf.d/named to customize named settings"
elog
elog "The BIND ebuild now includes chroot support."
elog "If you like to run bind in chroot AND this is a new install OR"
elog "your bind doesn't already run in chroot, simply run:"
elog "\`emerge --config '=${CATEGORY}/${PF}'\`"
elog "Before running the above command you might want to change the chroot"
elog "dir in /etc/conf.d/named. Otherwise /chroot/dns will be used."
elog
elog "Recently verisign added a wildcard A record to the .COM and .NET TLD"
elog "zones making all .com and .net domains appear to be registered"
elog "This causes many problems such as breaking important anti-spam checks"
elog "which verify source domains exist. ISC released a patch for BIND which"
elog "adds 'delegation-only' zones to allow admins to return the .com and .net"
elog "domain resolution to their normal function."
elog
elog "There is no need to create a com or net data file. Just the"
elog "entries to the named.conf file is enough."
elog
elog " zone "com" IN { type delegation-only; };"
elog " zone "net" IN { type delegation-only; };"
echo
ewarn "BIND >=9.2.5 makes the priority argument to MX records mandatory"
ewarn "when it was previously optional. If the priority is missing, BIND"
ewarn "won't load the zone file at all."
echo
}
pkg_config() {
CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/named 2>/dev/null`
EXISTS="no"
if [ -z "${CHROOT}" -a ! -d "/chroot/dns" ]; then
CHROOT="/chroot/dns"
elif [ -d ${CHROOT} ]; then
eerror; eerror "${CHROOT:-/chroot/dns} already exists. Quitting."; eerror; EXISTS="yes"
fi
if [ ! "$EXISTS" = yes ]; then
einfo ; einfon "Setting up the chroot directory..."
mkdir -m 700 -p ${CHROOT}
mkdir -p ${CHROOT}/{dev,etc,var/run/named}
chown -R named:named ${CHROOT}/var/run/named
cp -R /etc/bind ${CHROOT}/etc/
cp /etc/localtime ${CHROOT}/etc/localtime
chown named:named ${CHROOT}/etc/bind/rndc.key
cp -R /var/bind ${CHROOT}/var/
chown -R named:named ${CHROOT}/var/
mknod ${CHROOT}/dev/zero c 1 5
mknod ${CHROOT}/dev/random c 1 8
chmod 666 ${CHROOT}/dev/{random,zero}
chown root:named ${CHROOT}
chmod 0750 ${CHROOT}
grep -q "^#[[:blank:]]\?CHROOT" /etc/conf.d/named ; RETVAL=$?
if [ $RETVAL = 0 ]; then
sed 's/^# \?\(CHROOT.*\)$/\1/' /etc/conf.d/named > /etc/conf.d/named.orig 2>/dev/null
mv --force /etc/conf.d/named.orig /etc/conf.d/named
fi
sleep 1; echo " Done."; sleep 1
einfo
einfo "Add the following to your root .bashrc or .bash_profile: "
einfo " alias rndc='rndc -k ${CHROOT}/etc/bind/rndc.key'"
einfo "Then do the following: "
einfo " source /root/.bashrc or .bash_profile"
einfo
fi
}

View File

@ -0,0 +1 @@
CONFIG_PROTECT="/var/bind"

View File

@ -0,0 +1,11 @@
$ORIGIN 127.in-addr.arpa.
$TTL 1W
@ 1D IN SOA localhost. root.localhost. (
2002081601 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS localhost.
1 1D IN PTR localhost.

View File

@ -0,0 +1,11 @@
--- configure.in.orig 2005-03-25 23:33:33.000000000 +0300
+++ configure.in 2005-03-25 23:34:04.000000000 +0300
@@ -453,7 +453,7 @@
then
use_dlz_bdb=$d
DLZ_BDB_INCDIR=$use_dlz_bdb/include
- DLB_BDB_LIB="-ldb"
+ DLZ_BDB_LIB="-ldb"
break
fi
done

View File

@ -0,0 +1,402 @@
diff -uraN bind-9.2.5-dlz/bin/named/include/mysqldb.h bind-9.2.5-dlz-mysql/bin/named/include/mysqldb.h
--- bind-9.2.5-dlz/bin/named/include/mysqldb.h 1970-01-01 03:00:00.000000000 +0300
+++ bind-9.2.5-dlz-mysql/bin/named/include/mysqldb.h 2005-03-25 21:41:25.000000000 +0300
@@ -0,0 +1,7 @@
+
+#include <isc/types.h>
+
+isc_result_t mysqldb_init(void);
+
+void mysqldb_clear(void);
+
diff -uraN bind-9.2.5-dlz/bin/named/main.c bind-9.2.5-dlz-mysql/bin/named/main.c
--- bind-9.2.5-dlz/bin/named/main.c 2005-03-25 21:41:01.000000000 +0300
+++ bind-9.2.5-dlz-mysql/bin/named/main.c 2005-03-25 21:41:25.000000000 +0300
@@ -68,6 +68,7 @@
* Include header files for database drivers here.
*/
/* #include "xxdb.h" */
+#include "mysqldb.h"
#ifdef DLZ_STUB
#include <named/dlz_stub_driver.h>
@@ -594,6 +595,7 @@
* Add calls to register sdb drivers here.
*/
/* xxdb_init(); */
+ mysqldb_init ();
#ifdef DLZ_STUB
dlz_stub_init();
@@ -637,6 +639,7 @@
* Add calls to unregister sdb drivers here.
*/
/* xxdb_clear(); */
+ mysqldb_clear ();
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
ISC_LOG_NOTICE, "exiting");
diff -uraN bind-9.2.5-dlz/bin/named/Makefile.in bind-9.2.5-dlz-mysql/bin/named/Makefile.in
--- bind-9.2.5-dlz/bin/named/Makefile.in 2005-03-25 21:41:01.000000000 +0300
+++ bind-9.2.5-dlz-mysql/bin/named/Makefile.in 2005-03-25 21:41:25.000000000 +0300
@@ -26,10 +26,10 @@
#
# Add database drivers here.
#
-DBDRIVER_OBJS =
-DBDRIVER_SRCS =
-DBDRIVER_INCLUDES =
-DBDRIVER_LIBS =
+DBDRIVER_OBJS = mysqldb.@O@
+DBDRIVER_SRCS = mysqldb.c
+DBDRIVER_INCLUDES = -I/usr/local/include
+DBDRIVER_LIBS = -L/usr/local/lib/mysql -lmysqlclient
DLZINCLUDES = @DLZ_BDB_INC@ @DLZ_POSTGRES_INC@ @DLZ_ODBC_INC@ \
@DLZ_MYSQL_INC@ @DLZ_LDAP_INC@
diff -uraN bind-9.2.5-dlz/bin/named/mysqldb.c bind-9.2.5-dlz-mysql/bin/named/mysqldb.c
--- bind-9.2.5-dlz/bin/named/mysqldb.c 1970-01-01 03:00:00.000000000 +0300
+++ bind-9.2.5-dlz-mysql/bin/named/mysqldb.c 2005-03-25 21:41:25.000000000 +0300
@@ -0,0 +1,342 @@
+/*
+ * Copyright (C) 2002 Mihai Chelaru ( kefren@netbastards.org )
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND I DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL I BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include <config.h>
+#include <stdio.h>
+#include <malloc.h>
+#include <mysql/mysql.h>
+#include <isc/mem.h>
+#include <dns/sdb.h>
+#include <dns/result.h>
+#include <named/globals.h>
+
+#include <mysqldb.h>
+
+#define ROWS 20
+#define MAXCOLUMN 200
+
+/*
+#define ONEDATABASE
+#define MDEBUG
+*/
+struct mysqlrow {
+ char *s[ROWS];
+};
+
+static dns_sdbimplementation_t *mysqldb = NULL;
+
+struct mydbinfo {
+ MYSQL *conn;
+ char *database;
+ char *table;
+ char *host;
+ char *user;
+ char *passwd;
+};
+
+/* My internal functions */
+
+int mysql_dbcon(struct mydbinfo *);
+
+int
+mysql_dbcon(struct mydbinfo * dbi)
+{
+#ifdef MDEBUG
+ printf("Connecting\n");
+#endif
+ dbi->conn=mysql_init(NULL);
+ if (dbi->conn == NULL) return 0;
+ if (!mysql_real_connect(dbi->conn, dbi->host, dbi->user, dbi->passwd, dbi->database, 3306, NULL, 0))
+ return 0;
+#ifdef MDEBUG
+ printf("Connected\n");
+#endif
+ return 1;
+}
+
+/* External functions */
+
+static isc_result_t
+mysqldb_lookup(const char *zone, const char *name, void *dbdata, dns_sdblookup_t * lookup)
+{
+ char *querystring = NULL, seclook[150];
+ struct mydbinfo *dbi = (struct mydbinfo *) dbdata;
+ MYSQL_RES *result;
+ struct mysqlrow myrow;
+ int i, j, totlen;
+ MYSQL_ROW row;
+ int num_fields, putrr_success=0;
+#ifdef MDEBUG
+ printf("Lookup in %.200s for %.200s ", zone, name);
+#endif
+ querystring = (char *) malloc(200);
+ if (!querystring)
+ return ISC_R_NOMEMORY;
+ snprintf(querystring, 200, "SELECT TTL,RDTYPE,RDATA FROM %s where name='%.150s'", dbi->table, name);
+#ifdef MDEBUG
+ printf("Query = %s\n", querystring);
+#endif
+ mysql_ping(dbi->conn);
+ if (mysql_query(dbi->conn, querystring)) {
+ printf("Query Error in lookup\n");
+ free(querystring);
+ return ISC_R_FAILURE;
+ }
+ free(querystring);
+ result = mysql_store_result(dbi->conn);
+
+ num_fields = mysql_num_fields(result);
+ if (num_fields > ROWS) {
+ printf("Incorrect database format\n");
+ mysql_free_result(result);
+ return ISC_R_FAILURE;
+ }
+ /* allocate to fetch */
+ for (i = 0; i < ROWS; i++)
+ if (!(myrow.s[i] = (char *) malloc(MAXCOLUMN))) {
+ for (j = 0; j < i; j++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ return ISC_R_NOMEMORY;
+ }
+ /* Ok. we found no reason why to not let fetch */
+ while ((row = mysql_fetch_row(result))) {
+ unsigned long *lengths;
+ lengths = mysql_fetch_lengths(result);
+ totlen = 0;
+ for (i = 0; i < num_fields; i++) {
+ totlen += lengths[i];
+ snprintf(myrow.s[i], MAXCOLUMN, "%.*s", (int) lengths[i], row[i] ? row[i] : "NULL");
+ }
+#ifdef MDEBUG
+ printf("Lookup: %s %s %s\n", myrow.s[0], myrow.s[1], myrow.s[2]);
+#endif
+ if (dns_sdb_putrr(lookup, myrow.s[1], strtol(myrow.s[0], NULL, 10), myrow.s[2]) != ISC_R_SUCCESS) {
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ printf("Lookup Failure\n");
+ return ISC_R_FAILURE;
+ } else putrr_success=1;
+ }
+#ifdef MDEBUG
+ printf ("Bailing out lookup\n");
+#endif
+ /* Ok. success. bail out. */
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+
+ /* Check if there is any *.foo.com available and return it in case that this is not a *.foo.com call */
+ if ((!putrr_success)&&(name[0]!='*')) {
+#ifdef MDEBUG
+printf ("Cannot find it. Trying to check * record\n");
+#endif
+ snprintf (seclook,150,"*.%s",zone);
+ return mysqldb_lookup (zone, seclook, dbdata, lookup);
+ }
+
+ /* else return SUCCESS */
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+mysqldb_allnodes(const char *zone, void *dbdata, dns_sdballnodes_t * allnodes)
+{
+ char *querystring = NULL;
+ struct mydbinfo *dbi = (struct mydbinfo *) dbdata;
+ MYSQL_RES *result;
+ struct mysqlrow myrow;
+ MYSQL_ROW row;
+ int num_fields;
+ int i, totlen, j;
+#ifdef MDEBUG
+ printf("All Nodes\n");
+#endif
+ querystring = (char *) malloc(200);
+ if (!querystring)
+ return ISC_R_NOMEMORY;
+ snprintf(querystring, 200, "SELECT TTL,NAME,RDTYPE,RDATA FROM %s where name like('%%%.150s')", dbi->table, zone);
+ mysql_ping(dbi->conn);
+ if (mysql_query(dbi->conn, querystring)) {
+ printf("Query Error\n");
+ free(querystring);
+ return ISC_R_FAILURE;
+ }
+ free(querystring);
+ result = mysql_store_result(dbi->conn);
+
+ num_fields = mysql_num_fields(result);
+ if (num_fields > ROWS) {
+ printf("Incorrect database format\n");
+ mysql_free_result(result);
+ return ISC_R_FAILURE;
+ }
+ /* allocate to fetch */
+ for (i = 0; i < ROWS; i++)
+ if (!(myrow.s[i] = (char *) malloc(MAXCOLUMN))) {
+ for (j = 0; j < i; j++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ return ISC_R_NOMEMORY;
+ }
+ /* Ok. we found no reason why to not let fetch */
+ while ((row = mysql_fetch_row(result))) {
+ unsigned long *lengths;
+ lengths = mysql_fetch_lengths(result);
+ totlen = 0;
+ for (i = 0; i < num_fields; i++) {
+ totlen += lengths[i];
+ snprintf(myrow.s[i], MAXCOLUMN, "%.*s", (int) lengths[i], row[i] ? row[i] : "NULL");
+ }
+#ifdef MDEBUG
+ printf("All Nodes: %s %s %s %s\n", myrow.s[0], myrow.s[1], myrow.s[2], myrow.s[3]);
+#endif
+ if (dns_sdb_putnamedrr(allnodes, myrow.s[1], myrow.s[2], strtol(myrow.s[0], NULL, 10), myrow.s[3]) != ISC_R_SUCCESS) {
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ return ISC_R_FAILURE;
+ }
+ }
+
+ /* Ok. success. bail out. */
+ mysql_free_result(result);
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ return ISC_R_SUCCESS;
+}
+
+
+
+/*
+ * Open database argv[i]=database,table,hostname,user,passwd
+ */
+
+static isc_result_t
+mysqldb_create(const char *zone, int argc, char **argv, void *driverdata, void **dbdata)
+{
+ struct mydbinfo *dbi;
+ #ifdef ONEDATABASE
+ static MYSQL *dbconstat;
+ #endif
+
+ /* Argument count checking */
+ if (argc < 5)
+ return ISC_R_FAILURE;
+
+ /* dbi init */
+
+ dbi = (struct mydbinfo *) isc_mem_get(ns_g_mctx, sizeof(struct mydbinfo));
+ if (!dbi)
+ return ISC_R_NOMEMORY;
+ dbi->database = NULL;
+ dbi->table = NULL;
+ dbi->host = NULL;
+ dbi->user = NULL;
+ dbi->passwd = NULL;
+
+ dbi->database = isc_mem_strdup(ns_g_mctx, argv[0]);
+ dbi->table = isc_mem_strdup(ns_g_mctx, argv[1]);
+ dbi->host = isc_mem_strdup(ns_g_mctx, argv[2]);
+ dbi->user = isc_mem_strdup(ns_g_mctx, argv[3]);
+ dbi->passwd = isc_mem_strdup(ns_g_mctx, argv[4]);
+
+ if ((!dbi->database) || (!dbi->table) || (!dbi->host) || (!dbi->user) || (!dbi->passwd)) {
+ printf("Cannot strdup\n");
+ if (dbi->conn)
+ mysql_close(dbi->conn);
+ if (dbi->database)
+ isc_mem_free(ns_g_mctx, dbi->database);
+ if (dbi->table)
+ isc_mem_free(ns_g_mctx, dbi->table);
+ if (dbi->host)
+ isc_mem_free(ns_g_mctx, dbi->host);
+ if (dbi->user)
+ isc_mem_free(ns_g_mctx, dbi->user);
+ if (dbi->passwd)
+ isc_mem_free(ns_g_mctx, dbi->passwd);
+ isc_mem_put(ns_g_mctx, dbi, sizeof(struct mydbinfo));
+ return ISC_R_NOMEMORY;
+ }
+ /* connect to database */
+ #ifdef ONEDATABASE
+ if (!((dbconstat) && (!mysql_ping(dbconstat))))
+ #endif
+ if (!mysql_dbcon(dbi)) {
+ printf("Cannot connect to database\n");
+ return ISC_R_FAILURE;
+ }
+ #ifdef ONEDATABASE
+ if (dbconstat) dbi->conn = dbconstat; else dbconstat = dbi->conn;
+ #endif
+ *dbdata = dbi;
+ return ISC_R_SUCCESS;
+}
+
+static void
+mysqldb_destroy(const char *zone, void *driverdata, void **dbdata)
+{
+ struct mydbinfo *dbi;
+
+ dbi = (struct mydbinfo *) (*dbdata);
+ if (!dbi)
+ return;
+ if (dbi->conn)
+ mysql_close(dbi->conn);
+ if (dbi->database)
+ isc_mem_free(ns_g_mctx, dbi->database);
+ if (dbi->table)
+ isc_mem_free(ns_g_mctx, dbi->table);
+ if (dbi->host)
+ isc_mem_free(ns_g_mctx, dbi->host);
+ if (dbi->user)
+ isc_mem_free(ns_g_mctx, dbi->user);
+ if (dbi->passwd)
+ isc_mem_free(ns_g_mctx, dbi->passwd);
+ isc_mem_put(ns_g_mctx, dbi, sizeof(struct mydbinfo));
+#ifdef MDEBUG
+ printf("Destroyed\n");
+#endif
+}
+
+
+/* SDB methods */
+
+static dns_sdbmethods_t mysqldb_methods = {
+ mysqldb_lookup,
+ NULL, /* authority */
+ mysqldb_allnodes,
+ mysqldb_create,
+ mysqldb_destroy
+};
+
+
+
+isc_result_t
+mysqldb_init()
+{
+ unsigned int flags = 0;
+ return dns_sdb_register("mysql", &mysqldb_methods, NULL, flags, ns_g_mctx, &mysqldb);
+}
+
+void
+mysqldb_clear()
+{
+ if (mysqldb)
+ dns_sdb_unregister(&mysqldb);
+}

View File

@ -0,0 +1,402 @@
diff -uraN bind-9.2.5-orig/bin/named/include/mysqldb.h bind-9.2.5-mysql/bin/named/include/mysqldb.h
--- bind-9.2.5-orig/bin/named/include/mysqldb.h 1970-01-01 03:00:00.000000000 +0300
+++ bind-9.2.5-mysql/bin/named/include/mysqldb.h 2005-03-25 21:35:47.000000000 +0300
@@ -0,0 +1,7 @@
+
+#include <isc/types.h>
+
+isc_result_t mysqldb_init(void);
+
+void mysqldb_clear(void);
+
diff -uraN bind-9.2.5-orig/bin/named/main.c bind-9.2.5-mysql/bin/named/main.c
--- bind-9.2.5-orig/bin/named/main.c 2004-10-25 04:50:53.000000000 +0400
+++ bind-9.2.5-mysql/bin/named/main.c 2005-03-25 21:35:47.000000000 +0300
@@ -68,6 +68,7 @@
* Include header files for database drivers here.
*/
/* #include "xxdb.h" */
+#include "mysqldb.h"
static isc_boolean_t want_stats = ISC_FALSE;
static char program_name[ISC_DIR_NAMEMAX] = "named";
@@ -565,6 +566,7 @@
* Add calls to register sdb drivers here.
*/
/* xxdb_init(); */
+ mysqldb_init ();
ns_server_create(ns_g_mctx, &ns_g_server);
}
@@ -579,6 +581,7 @@
* Add calls to unregister sdb drivers here.
*/
/* xxdb_clear(); */
+ mysqldb_clear ();
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
ISC_LOG_NOTICE, "exiting");
diff -uraN bind-9.2.5-orig/bin/named/Makefile.in bind-9.2.5-mysql/bin/named/Makefile.in
--- bind-9.2.5-orig/bin/named/Makefile.in 2004-09-07 01:42:06.000000000 +0400
+++ bind-9.2.5-mysql/bin/named/Makefile.in 2005-03-25 21:35:47.000000000 +0300
@@ -26,10 +26,10 @@
#
# Add database drivers here.
#
-DBDRIVER_OBJS =
-DBDRIVER_SRCS =
-DBDRIVER_INCLUDES =
-DBDRIVER_LIBS =
+DBDRIVER_OBJS = mysqldb.@O@
+DBDRIVER_SRCS = mysqldb.c
+DBDRIVER_INCLUDES = -I/usr/local/include
+DBDRIVER_LIBS = -L/usr/local/lib/mysql -lmysqlclient
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
${LWRES_INCLUDES} ${DNS_INCLUDES} \
diff -uraN bind-9.2.5-orig/bin/named/mysqldb.c bind-9.2.5-mysql/bin/named/mysqldb.c
--- bind-9.2.5-orig/bin/named/mysqldb.c 1970-01-01 03:00:00.000000000 +0300
+++ bind-9.2.5-mysql/bin/named/mysqldb.c 2005-03-25 21:35:47.000000000 +0300
@@ -0,0 +1,342 @@
+/*
+ * Copyright (C) 2002 Mihai Chelaru ( kefren@netbastards.org )
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND I DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL I BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include <config.h>
+#include <stdio.h>
+#include <malloc.h>
+#include <mysql/mysql.h>
+#include <isc/mem.h>
+#include <dns/sdb.h>
+#include <dns/result.h>
+#include <named/globals.h>
+
+#include <mysqldb.h>
+
+#define ROWS 20
+#define MAXCOLUMN 200
+
+/*
+#define ONEDATABASE
+#define MDEBUG
+*/
+struct mysqlrow {
+ char *s[ROWS];
+};
+
+static dns_sdbimplementation_t *mysqldb = NULL;
+
+struct mydbinfo {
+ MYSQL *conn;
+ char *database;
+ char *table;
+ char *host;
+ char *user;
+ char *passwd;
+};
+
+/* My internal functions */
+
+int mysql_dbcon(struct mydbinfo *);
+
+int
+mysql_dbcon(struct mydbinfo * dbi)
+{
+#ifdef MDEBUG
+ printf("Connecting\n");
+#endif
+ dbi->conn=mysql_init(NULL);
+ if (dbi->conn == NULL) return 0;
+ if (!mysql_real_connect(dbi->conn, dbi->host, dbi->user, dbi->passwd, dbi->database, 3306, NULL, 0))
+ return 0;
+#ifdef MDEBUG
+ printf("Connected\n");
+#endif
+ return 1;
+}
+
+/* External functions */
+
+static isc_result_t
+mysqldb_lookup(const char *zone, const char *name, void *dbdata, dns_sdblookup_t * lookup)
+{
+ char *querystring = NULL, seclook[150];
+ struct mydbinfo *dbi = (struct mydbinfo *) dbdata;
+ MYSQL_RES *result;
+ struct mysqlrow myrow;
+ int i, j, totlen;
+ MYSQL_ROW row;
+ int num_fields, putrr_success=0;
+#ifdef MDEBUG
+ printf("Lookup in %.200s for %.200s ", zone, name);
+#endif
+ querystring = (char *) malloc(200);
+ if (!querystring)
+ return ISC_R_NOMEMORY;
+ snprintf(querystring, 200, "SELECT TTL,RDTYPE,RDATA FROM %s where name='%.150s'", dbi->table, name);
+#ifdef MDEBUG
+ printf("Query = %s\n", querystring);
+#endif
+ mysql_ping(dbi->conn);
+ if (mysql_query(dbi->conn, querystring)) {
+ printf("Query Error in lookup\n");
+ free(querystring);
+ return ISC_R_FAILURE;
+ }
+ free(querystring);
+ result = mysql_store_result(dbi->conn);
+
+ num_fields = mysql_num_fields(result);
+ if (num_fields > ROWS) {
+ printf("Incorrect database format\n");
+ mysql_free_result(result);
+ return ISC_R_FAILURE;
+ }
+ /* allocate to fetch */
+ for (i = 0; i < ROWS; i++)
+ if (!(myrow.s[i] = (char *) malloc(MAXCOLUMN))) {
+ for (j = 0; j < i; j++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ return ISC_R_NOMEMORY;
+ }
+ /* Ok. we found no reason why to not let fetch */
+ while ((row = mysql_fetch_row(result))) {
+ unsigned long *lengths;
+ lengths = mysql_fetch_lengths(result);
+ totlen = 0;
+ for (i = 0; i < num_fields; i++) {
+ totlen += lengths[i];
+ snprintf(myrow.s[i], MAXCOLUMN, "%.*s", (int) lengths[i], row[i] ? row[i] : "NULL");
+ }
+#ifdef MDEBUG
+ printf("Lookup: %s %s %s\n", myrow.s[0], myrow.s[1], myrow.s[2]);
+#endif
+ if (dns_sdb_putrr(lookup, myrow.s[1], strtol(myrow.s[0], NULL, 10), myrow.s[2]) != ISC_R_SUCCESS) {
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ printf("Lookup Failure\n");
+ return ISC_R_FAILURE;
+ } else putrr_success=1;
+ }
+#ifdef MDEBUG
+ printf ("Bailing out lookup\n");
+#endif
+ /* Ok. success. bail out. */
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+
+ /* Check if there is any *.foo.com available and return it in case that this is not a *.foo.com call */
+ if ((!putrr_success)&&(name[0]!='*')) {
+#ifdef MDEBUG
+printf ("Cannot find it. Trying to check * record\n");
+#endif
+ snprintf (seclook,150,"*.%s",zone);
+ return mysqldb_lookup (zone, seclook, dbdata, lookup);
+ }
+
+ /* else return SUCCESS */
+ return ISC_R_SUCCESS;
+}
+
+static isc_result_t
+mysqldb_allnodes(const char *zone, void *dbdata, dns_sdballnodes_t * allnodes)
+{
+ char *querystring = NULL;
+ struct mydbinfo *dbi = (struct mydbinfo *) dbdata;
+ MYSQL_RES *result;
+ struct mysqlrow myrow;
+ MYSQL_ROW row;
+ int num_fields;
+ int i, totlen, j;
+#ifdef MDEBUG
+ printf("All Nodes\n");
+#endif
+ querystring = (char *) malloc(200);
+ if (!querystring)
+ return ISC_R_NOMEMORY;
+ snprintf(querystring, 200, "SELECT TTL,NAME,RDTYPE,RDATA FROM %s where name like('%%%.150s')", dbi->table, zone);
+ mysql_ping(dbi->conn);
+ if (mysql_query(dbi->conn, querystring)) {
+ printf("Query Error\n");
+ free(querystring);
+ return ISC_R_FAILURE;
+ }
+ free(querystring);
+ result = mysql_store_result(dbi->conn);
+
+ num_fields = mysql_num_fields(result);
+ if (num_fields > ROWS) {
+ printf("Incorrect database format\n");
+ mysql_free_result(result);
+ return ISC_R_FAILURE;
+ }
+ /* allocate to fetch */
+ for (i = 0; i < ROWS; i++)
+ if (!(myrow.s[i] = (char *) malloc(MAXCOLUMN))) {
+ for (j = 0; j < i; j++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ return ISC_R_NOMEMORY;
+ }
+ /* Ok. we found no reason why to not let fetch */
+ while ((row = mysql_fetch_row(result))) {
+ unsigned long *lengths;
+ lengths = mysql_fetch_lengths(result);
+ totlen = 0;
+ for (i = 0; i < num_fields; i++) {
+ totlen += lengths[i];
+ snprintf(myrow.s[i], MAXCOLUMN, "%.*s", (int) lengths[i], row[i] ? row[i] : "NULL");
+ }
+#ifdef MDEBUG
+ printf("All Nodes: %s %s %s %s\n", myrow.s[0], myrow.s[1], myrow.s[2], myrow.s[3]);
+#endif
+ if (dns_sdb_putnamedrr(allnodes, myrow.s[1], myrow.s[2], strtol(myrow.s[0], NULL, 10), myrow.s[3]) != ISC_R_SUCCESS) {
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ mysql_free_result(result);
+ return ISC_R_FAILURE;
+ }
+ }
+
+ /* Ok. success. bail out. */
+ mysql_free_result(result);
+ for (i = 0; i < ROWS; i++)
+ free(myrow.s[i]);
+ return ISC_R_SUCCESS;
+}
+
+
+
+/*
+ * Open database argv[i]=database,table,hostname,user,passwd
+ */
+
+static isc_result_t
+mysqldb_create(const char *zone, int argc, char **argv, void *driverdata, void **dbdata)
+{
+ struct mydbinfo *dbi;
+ #ifdef ONEDATABASE
+ static MYSQL *dbconstat;
+ #endif
+
+ /* Argument count checking */
+ if (argc < 5)
+ return ISC_R_FAILURE;
+
+ /* dbi init */
+
+ dbi = (struct mydbinfo *) isc_mem_get(ns_g_mctx, sizeof(struct mydbinfo));
+ if (!dbi)
+ return ISC_R_NOMEMORY;
+ dbi->database = NULL;
+ dbi->table = NULL;
+ dbi->host = NULL;
+ dbi->user = NULL;
+ dbi->passwd = NULL;
+
+ dbi->database = isc_mem_strdup(ns_g_mctx, argv[0]);
+ dbi->table = isc_mem_strdup(ns_g_mctx, argv[1]);
+ dbi->host = isc_mem_strdup(ns_g_mctx, argv[2]);
+ dbi->user = isc_mem_strdup(ns_g_mctx, argv[3]);
+ dbi->passwd = isc_mem_strdup(ns_g_mctx, argv[4]);
+
+ if ((!dbi->database) || (!dbi->table) || (!dbi->host) || (!dbi->user) || (!dbi->passwd)) {
+ printf("Cannot strdup\n");
+ if (dbi->conn)
+ mysql_close(dbi->conn);
+ if (dbi->database)
+ isc_mem_free(ns_g_mctx, dbi->database);
+ if (dbi->table)
+ isc_mem_free(ns_g_mctx, dbi->table);
+ if (dbi->host)
+ isc_mem_free(ns_g_mctx, dbi->host);
+ if (dbi->user)
+ isc_mem_free(ns_g_mctx, dbi->user);
+ if (dbi->passwd)
+ isc_mem_free(ns_g_mctx, dbi->passwd);
+ isc_mem_put(ns_g_mctx, dbi, sizeof(struct mydbinfo));
+ return ISC_R_NOMEMORY;
+ }
+ /* connect to database */
+ #ifdef ONEDATABASE
+ if (!((dbconstat) && (!mysql_ping(dbconstat))))
+ #endif
+ if (!mysql_dbcon(dbi)) {
+ printf("Cannot connect to database\n");
+ return ISC_R_FAILURE;
+ }
+ #ifdef ONEDATABASE
+ if (dbconstat) dbi->conn = dbconstat; else dbconstat = dbi->conn;
+ #endif
+ *dbdata = dbi;
+ return ISC_R_SUCCESS;
+}
+
+static void
+mysqldb_destroy(const char *zone, void *driverdata, void **dbdata)
+{
+ struct mydbinfo *dbi;
+
+ dbi = (struct mydbinfo *) (*dbdata);
+ if (!dbi)
+ return;
+ if (dbi->conn)
+ mysql_close(dbi->conn);
+ if (dbi->database)
+ isc_mem_free(ns_g_mctx, dbi->database);
+ if (dbi->table)
+ isc_mem_free(ns_g_mctx, dbi->table);
+ if (dbi->host)
+ isc_mem_free(ns_g_mctx, dbi->host);
+ if (dbi->user)
+ isc_mem_free(ns_g_mctx, dbi->user);
+ if (dbi->passwd)
+ isc_mem_free(ns_g_mctx, dbi->passwd);
+ isc_mem_put(ns_g_mctx, dbi, sizeof(struct mydbinfo));
+#ifdef MDEBUG
+ printf("Destroyed\n");
+#endif
+}
+
+
+/* SDB methods */
+
+static dns_sdbmethods_t mysqldb_methods = {
+ mysqldb_lookup,
+ NULL, /* authority */
+ mysqldb_allnodes,
+ mysqldb_create,
+ mysqldb_destroy
+};
+
+
+
+isc_result_t
+mysqldb_init()
+{
+ unsigned int flags = 0;
+ return dns_sdb_register("mysql", &mysqldb_methods, NULL, flags, ns_g_mctx, &mysqldb);
+}
+
+void
+mysqldb_clear()
+{
+ if (mysqldb)
+ dns_sdb_unregister(&mysqldb);
+}

View File

@ -0,0 +1,20 @@
--- configure.in 2006-07-09 22:00:54.000000000 +0000
+++ configure.in 2006-07-09 22:01:05.000000000 +0000
@@ -686,17 +686,7 @@
fi
done
- if test -z "`${CC} contrib/sdb/test//test.c -lodbc -o contrib/sdb/test/test.ok 2>&1`"; then
DLZ_ODBC_LIB="-lodbc"
- elif test -z "`${CC} contrib/sdb/test//test.c -liodbc -o contrib/sdb/test/test.ok 2>&1`"; then
- DLZ_ODBC_LIB="-liodbc"
- else
- DLZ_ODBC_LIB=""
- use_dlz_odbc="no"
- AC_MSG_RESULT("no ODBC libraries found")
- fi
- rm -f contrib/sdb/test/test.ok
-
if test "$use_dlz_odbc" = "yes"
then

View File

@ -0,0 +1,20 @@
--- configure.in 2006-07-09 22:00:54.000000000 +0000
+++ configure.in 2006-07-09 22:01:05.000000000 +0000
@@ -686,17 +686,7 @@
fi
done
- if test -z "`${CC} contrib/sdb/test//test.c -lodbc -o contrib/sdb/test/test.ok 2>&1`"; then
DLZ_ODBC_LIB="-lodbc"
- elif test -z "`${CC} contrib/sdb/test//test.c -liodbc -o contrib/sdb/test/test.ok 2>&1`"; then
- DLZ_ODBC_LIB="-liodbc"
- else
- DLZ_ODBC_LIB=""
- use_dlz_odbc="no"
- AC_MSG_RESULT("no ODBC libraries found")
- fi
- rm -f contrib/sdb/test/test.ok
-
if test "$use_dlz_odbc" = "yes"
then

View File

@ -0,0 +1,47 @@
diff -urN bind9-9.3.2-P1.backup/bin/named/Makefile.in bind9-9.3.2-P1/bin/named/Makefile.in
--- bind9-9.3.2-P1.backup/bin/named/Makefile.in 2004-09-06 23:47:25.000000000 +0200
+++ bind9-9.3.2-P1/bin/named/Makefile.in 2006-10-06 13:09:13.000000000 +0200
@@ -26,10 +26,10 @@
#
# Add database drivers here.
#
-DBDRIVER_OBJS =
+DBDRIVER_OBJS = ldapdb.@O@
DBDRIVER_SRCS =
-DBDRIVER_INCLUDES =
-DBDRIVER_LIBS =
+DBDRIVER_INCLUDES = -I/usr/include
+DBDRIVER_LIBS = -L/usr/lib -lldap -llber -lresolv
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
diff -urN bind9-9.3.2-P1.backup/bin/named/main.c bind9-9.3.2-P1/bin/named/main.c
--- bind9-9.3.2-P1.backup/bin/named/main.c 2005-04-29 03:04:47.000000000 +0200
+++ bind9-9.3.2-P1/bin/named/main.c 2006-10-06 13:09:13.000000000 +0200
@@ -69,7 +69,7 @@
/*
* Include header files for database drivers here.
*/
-/* #include "xxdb.h" */
+#include "ldapdb.h"
static isc_boolean_t want_stats = ISC_FALSE;
static char program_name[ISC_DIR_NAMEMAX] = "named";
@@ -669,7 +669,7 @@
/*
* Add calls to register sdb drivers here.
*/
- /* xxdb_init(); */
+ ldapdb_init();
ns_server_create(ns_g_mctx, &ns_g_server);
}
@@ -685,7 +685,7 @@
/*
* Add calls to unregister sdb drivers here.
*/
- /* xxdb_clear(); */
+ ldapdb_clear();
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
ISC_LOG_NOTICE, "exiting");

View File

@ -0,0 +1,20 @@
--- configure.in 2006-07-09 22:00:54.000000000 +0000
+++ configure.in 2006-07-09 22:01:05.000000000 +0000
@@ -686,17 +686,7 @@
fi
done
- if test -z "`${CC} contrib/sdb/test//test.c -lodbc -o contrib/sdb/test/test.ok 2>&1`"; then
DLZ_ODBC_LIB="-lodbc"
- elif test -z "`${CC} contrib/sdb/test//test.c -liodbc -o contrib/sdb/test/test.ok 2>&1`"; then
- DLZ_ODBC_LIB="-liodbc"
- else
- DLZ_ODBC_LIB=""
- use_dlz_odbc="no"
- AC_MSG_RESULT("no ODBC libraries found")
- fi
- rm -f contrib/sdb/test/test.ok
-
if test "$use_dlz_odbc" = "yes"
then

View File

@ -0,0 +1,11 @@
--- contrib/dlz/drivers/dlz_bdbhpt_driver.c 2007-03-02 12:02:12.000000000 +0300
+++ contrib/dlz/drivers/dlz_bdbhpt_driver.c 2007-03-02 12:02:18.000000000 +0300
@@ -442,7 +442,7 @@
xfr_cursor->c_close(xfr_cursor);
if (dns_cursor != NULL)
- dns_cursor->c_close(xfr_cursor);
+ dns_cursor->c_close(dns_cursor);
return result;
}

View File

@ -0,0 +1,11 @@
--- bin/named/dlz_bdbhpt_driver.c Thu May 4 13:13:20 2006
+++ bin/named/dlz_bdbhpt_driver.c Thu May 4 13:27:05 2006
@@ -462,7 +462,7 @@
xfr_cursor->c_close(xfr_cursor);
if(dns_cursor != NULL)
- dns_cursor->c_close(xfr_cursor);
+ dns_cursor->c_close(dns_cursor);
return result;
}

View File

@ -0,0 +1,12 @@
--- bin/dlzbdb/Makefile.in 2006-03-25 22:11:15.840755988 +0000
+++ bin/dlzbdb/Makefile.in 2006-03-25 22:33:43.873082259 +0000
@@ -26,6 +26,9 @@
DLZINCLUDES = @DLZ_BDB_INC@
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
+ -I${top_srcdir}/lib/isc/include \
+ -I${top_srcdir}/lib/isc/unix/include \
+ -I${top_srcdir}/lib/isc/@ISC_THREAD_DIR@/include \
${ISC_INCLUDES} ${DLZINCLUDES}
CDEFINES = @USE_DLZ_BDB@

View File

@ -0,0 +1,59 @@
--- bind-9.5.0a6.orig/contrib/dlz/drivers/dlz_mysql_driver.c 2007-02-06 06:44:26.000000000 +0100
+++ bind-9.5.0a6/contrib/dlz/drivers/dlz_mysql_driver.c 2007-09-04 23:57:57.000000000 +0200
@@ -92,6 +92,25 @@
*/
/*%
+ * Factorize the mysql_ping for adding a log error message
+ */
+static isc_result_t
+mysqldrv_ping(dbinstance_t *dbi) {
+ int pres = 0;
+
+ pres = mysql_ping(dbi->dbconn);
+ if ( pres != 0 ) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
+ "\nMySQL Ping Error : %s (%i)\n",
+ mysql_error(dbi->dbconn),
+ mysql_errno(dbi->dbconn));
+ return (ISC_R_FAILURE);
+ }
+ return (ISC_R_SUCCESS);
+}
+
+/*%
* Allocates memory for a new string, and then constructs the new
* string by "escaping" the input string. The new string is
* safe to be used in queries. This is necessary because we cannot
@@ -225,6 +244,8 @@
}
+ mysqldrv_ping(dbi);
+
/*
* was a zone string passed? If so, make it safe for use in
* queries.
@@ -324,7 +345,7 @@
qres = mysql_query((MYSQL *) dbi->dbconn, querystring);
if (qres == 0)
break;
- for (j=0; mysql_ping((MYSQL *) dbi->dbconn) != 0 && j < 4; j++)
+ for (j=0; mysqldrv_ping(dbi) != 0 && j < 4; j++)
;
}
@@ -923,6 +944,12 @@
pass = getParameterValue(argv[1], "pass=");
socket = getParameterValue(argv[1], "socket=");
+ if(mysql_options((MYSQL *) dbi->dbconn, MYSQL_OPT_RECONNECT, "1")) {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+ "Could not set database reconnect option");
+ }
+
for (j=0; dbc == NULL && j < 4; j++)
dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host,
user, pass, dbname, port, socket,

View File

@ -0,0 +1,9 @@
$TTL 1W
@ IN SOA ns.localhost. root.localhost. (
2002081601 ; Serial
28800 ; Refresh
14400 ; Retry
604800 ; Expire - 1 week
86400 ) ; Minimum
IN NS ns
localhost. IN A 127.0.0.1

View File

@ -0,0 +1,9 @@
$TTL 1W
@ IN SOA ns.localhost. root.localhost. (
2002081601 ; Serial
28800 ; Refresh
14400 ; Retry
604800 ; Expire - 1 week
86400 ) ; Minimum
IN NS 127.0.0.1
localhost. IN A 127.0.0.1

View File

@ -0,0 +1,11 @@
$TTL 1W
@ IN SOA ns.localhost. root.localhost. (
2002081601 ; Serial
28800 ; Refresh
14400 ; Retry
604800 ; Expire - 1 week
86400 ) ; Minimum
@ IN NS ns
ns IN A 127.0.0.1
ns IN AAAA ::1

View File

@ -0,0 +1,85 @@
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC
; under anonymous FTP as
; file /domain/named.root
; on server FTP.INTERNIC.NET
; -OR- RS.INTERNIC.NET
;
; last update: Feb 04, 2008
; related version of root zone: 2008020400
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803f:235
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; operated by VeriSign, Inc.
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30
;
; operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1
;
; operated by ICANN
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42
;
; operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
M.ROOT-SERVERS.NET. 3600000 AAAA 2001:dc3::35
; End of File

View File

@ -0,0 +1,42 @@
options {
directory "/var/bind";
// uncomment the following lines to turn on DNS forwarding,
// and change the forwarding ip address(es) :
//forward first;
//forwarders {
// 123.123.123.123;
// 123.123.123.123;
//};
listen-on-v6 { none; };
listen-on { 127.0.0.1; };
// to allow only specific hosts to use the DNS server:
//allow-query {
// 127.0.0.1;
//};
// if you have problems and are behind a firewall:
//query-source address * port 53;
pid-file "/var/run/named/named.pid";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "pri/localhost.zone";
allow-update { none; };
notify no;
};
zone "127.in-addr.arpa" IN {
type master;
file "pri/127.zone";
allow-update { none; };
notify no;
};

View File

@ -0,0 +1,53 @@
options {
directory "/var/bind";
// uncomment the following lines to turn on DNS forwarding,
// and change the forwarding ip address(es) :
//forward first;
//forwarders {
// 123.123.123.123;
// 123.123.123.123;
//};
listen-on-v6 { none; };
listen-on { 127.0.0.1; };
// to allow only specific hosts to use the DNS server:
//allow-query {
// 127.0.0.1;
//};
// if you have problems and are behind a firewall:
//query-source address * port 53;
pid-file "/var/run/named/named.pid";
};
// Briefly, a zone which has been declared delegation-only will be effectively
// limited to containing NS RRs for subdomains, but no actual data beyond its
// own apex (for example, its SOA RR and apex NS RRset). This can be used to
// filter out "wildcard" or "synthesized" data from NAT boxes or from
// authoritative name servers whose undelegated (in-zone) data is of no
// interest.
// See http://www.isc.org/products/BIND/delegation-only.html for more info
//zone "COM" { type delegation-only; };
//zone "NET" { type delegation-only; };
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "pri/localhost.zone";
allow-update { none; };
notify no;
};
zone "127.in-addr.arpa" IN {
type master;
file "pri/127.zone";
allow-update { none; };
notify no;
};

View File

@ -0,0 +1,13 @@
# Set various named options here.
#
OPTIONS=""
# Set this to the number of processors you have.
#
CPU="1"
# If you wish to run bind in a chroot, run:
# emerge --config =<bind-version>
# and un-comment the following line.
# You can specify a different chroot directory but MAKE SURE it's empty.
# CHROOT="/chroot/dns"

View File

@ -0,0 +1,16 @@
# Set various named options here.
#
OPTIONS=""
# Set this to the number of processors you have.
#
CPU="1"
# If you wish to run bind in a chroot, run:
# emerge --config =<bind-version>
# and un-comment the following line.
# You can specify a different chroot directory but MAKE SURE it's empty.
# CHROOT="/chroot/dns"
# Default pid file location
PIDFILE="${CHROOT}/var/run/named/named.pid"

View File

@ -0,0 +1,20 @@
# Set various named options here.
#
OPTIONS=""
# Set this to the number of processors you have.
#
CPU="1"
# If you wish to run bind in a chroot, run:
# emerge --config =<bind-version>
# and un-comment the following line.
# You can specify a different chroot directory but MAKE SURE it's empty.
# CHROOT="/chroot/dns"
# Default pid file location
PIDFILE="${CHROOT}/var/run/named/named.pid"
# Scheduling priority: 19 is the lowest and -20 is the highest.
#
NAMED_NICELEVEL="0"

72
net-dns/bind/files/named.init Executable file
View File

@ -0,0 +1,72 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init,v 1.1 2005/06/23 17:37:44 voxus Exp $
opts="start stop reload restart"
depend() {
need net
use logger
provide dns
}
checkconfig() {
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
if [ ! ${CPU} ] ; then
CPU="1"
fi
# As with the named.conf test, above, there's no need
# for chroot and non-chroot cases here
PIDFILE=$(grep "pid-file" ${CHROOT}/etc/bind/named.conf | \
egrep -v ".*[#,//].*pid-file" | \
head -n 1 | \
sed -ne 's:.*pid-file \"\(.*\)\";:\1:p')
[ -n "$PIDFILE" ] || PIDFILE=/var/run/named.pid
PIDFILE="${CHROOT}$PIDFILE"
KEY="${CHROOT}/etc/bind/rndc.key"
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--exec /usr/sbin/named \
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t $CHROOT}
eend $?
}
stop() {
ebegin "Stopping ${CHROOT:+chrooted }named"
checkconfig || return 2
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec /usr/sbin/named -- stop
eend $?
}
reload() {
checkconfig || return 3
if [ ! -f $PIDFILE ] ; then
/etc/init.d/named start &>/dev/null
exit
fi
if [ -f $KEY ] ; then
ebegin "Reloading named.conf and zone files"
rndc -k $KEY reload &>/dev/null
eend $?
else /etc/init.d/named restart &>/dev/null
fi
}
restart() {
svc_stop
svc_start
}

View File

@ -0,0 +1,66 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r2,v 1.1 2005/09/30 22:33:25 voxus Exp $
opts="start stop reload restart"
depend() {
need net
use logger
provide dns
}
checkconfig() {
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
if [ ! ${CPU} ] ; then
CPU="1"
fi
# as suggested in bug #107724
PIDFILE=$(\
egrep -v \
"^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \
${CHROOT}/etc/bind/named.conf \
| egrep -o -m1 "pid\-file +\".+\" *;" \
| cut -d\" -f2
)
KEY="${CHROOT}/etc/bind/rndc.key"
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--exec /usr/sbin/named \
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t $CHROOT}
eend $?
}
stop() {
ebegin "Stopping ${CHROOT:+chrooted }named"
checkconfig || return 2
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec /usr/sbin/named -- stop
eend $?
}
reload() {
checkconfig || return 3
if [ ! -f $PIDFILE ] ; then
/etc/init.d/named start &>/dev/null
exit
fi
if [ -f $KEY ] ; then
ebegin "Reloading named.conf and zone files"
rndc -k $KEY reload &>/dev/null
eend $?
else /etc/init.d/named restart &>/dev/null
fi
}

View File

@ -0,0 +1,66 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r3,v 1.1 2005/11/09 09:25:53 voxus Exp $
opts="start stop reload restart"
depend() {
need net
use logger
provide dns
}
checkconfig() {
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
if [ ! ${CPU} ] ; then
CPU="1"
fi
# as suggested in bug #107724
[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
egrep -v \
"^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \
${CHROOT}/etc/bind/named.conf \
| egrep -o -m1 "pid\-file +\".+\" *;" \
| cut -d\" -f2
)
KEY="${CHROOT}/etc/bind/rndc.key"
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--exec /usr/sbin/named \
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t $CHROOT}
eend $?
}
stop() {
ebegin "Stopping ${CHROOT:+chrooted }named"
checkconfig || return 2
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec /usr/sbin/named -- stop
eend $?
}
reload() {
checkconfig || return 3
if [ ! -f $PIDFILE ] ; then
/etc/init.d/named start &>/dev/null
exit
fi
if [ -f $KEY ] ; then
ebegin "Reloading named.conf and zone files"
rndc -k $KEY reload &>/dev/null
eend $?
else /etc/init.d/named restart &>/dev/null
fi
}

View File

@ -0,0 +1,70 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r4,v 1.2 2007/05/12 23:19:40 uberlord Exp $
opts="start stop reload restart"
depend() {
need net
use logger
provide dns
}
checkconfig() {
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
if [ ! ${CPU} ] ; then
CPU="1"
fi
# as suggested in bug #107724
[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
egrep -v \
"^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \
${CHROOT}/etc/bind/named.conf \
| egrep -o -m1 "pid\-file +\".+\" *;" \
| cut -d\" -f2
)
KEY="${CHROOT}/etc/bind/rndc.key"
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--exec /usr/sbin/named \
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
eend $?
}
stop() {
ebegin "Stopping ${CHROOT:+chrooted }named"
checkconfig || return 2
if [ -f $KEY ] ; then
rndc -k $KEY stop &>/dev/null
else
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec /usr/sbin/named -- stop
fi
eend $?
}
reload() {
checkconfig || return 3
if [ ! -f $PIDFILE ] ; then
/etc/init.d/named start &>/dev/null
exit
fi
if [ -f $KEY ] ; then
ebegin "Reloading named.conf and zone files"
rndc -k $KEY reload &>/dev/null
eend $?
else /etc/init.d/named restart &>/dev/null
fi
}

View File

@ -0,0 +1,71 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r5,v 1.1 2007/06/02 22:34:48 voxus Exp $
opts="start stop reload restart"
depend() {
need net
use logger
provide dns
}
checkconfig() {
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
if [ ! ${CPU} ] ; then
CPU="1"
fi
# as suggested in bug #107724
[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
egrep -v \
"^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \
${CHROOT}/etc/bind/named.conf \
| egrep -o -m1 "pid\-file +\".+\" *;" \
| cut -d\" -f2
)
KEY="${CHROOT}/etc/bind/rndc.key"
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--nicelevel ${NAMED_NICELEVEL:-0} \
--exec /usr/sbin/named \
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
eend $?
}
stop() {
ebegin "Stopping ${CHROOT:+chrooted }named"
checkconfig || return 2
if [ -f $KEY ] ; then
rndc -k $KEY stop &>/dev/null
else
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec /usr/sbin/named -- stop
fi
eend $?
}
reload() {
checkconfig || return 3
if [ ! -f $PIDFILE ] ; then
/etc/init.d/named start &>/dev/null
exit
fi
if [ -f $KEY ] ; then
ebegin "Reloading named.conf and zone files"
rndc -k $KEY reload &>/dev/null
eend $?
else /etc/init.d/named restart &>/dev/null
fi
}

72
net-dns/bind/files/named.rc Executable file
View File

@ -0,0 +1,72 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.rc,v 1.1 2005/08/03 16:54:38 voxus Exp $
opts="start stop reload restart"
depend() {
need net
use logger
provide dns
}
checkconfig() {
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
if [ ! ${CPU} ] ; then
CPU="1"
fi
# As with the named.conf test, above, there's no need
# for chroot and non-chroot cases here
PIDFILE=$(grep "pid-file" ${CHROOT}/etc/bind/named.conf | \
egrep -v ".*[#,//].*pid-file" | \
head -n 1 | \
sed -ne 's:.*pid-file\(.*\)\"\(.*\)\";:\2:p')
[ -n "$PIDFILE" ] || PIDFILE=/var/run/named.pid
PIDFILE="${CHROOT}$PIDFILE"
KEY="${CHROOT}/etc/bind/rndc.key"
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--exec /usr/sbin/named \
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t $CHROOT}
eend $?
}
stop() {
ebegin "Stopping ${CHROOT:+chrooted }named"
checkconfig || return 2
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec /usr/sbin/named -- stop
eend $?
}
reload() {
checkconfig || return 3
if [ ! -f $PIDFILE ] ; then
/etc/init.d/named start &>/dev/null
exit
fi
if [ -f $KEY ] ; then
ebegin "Reloading named.conf and zone files"
rndc -k $KEY reload &>/dev/null
eend $?
else /etc/init.d/named restart &>/dev/null
fi
}
restart() {
svc_stop
svc_start
}

66
net-dns/bind/files/named.rc6 Executable file
View File

@ -0,0 +1,66 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.rc6,v 1.15 2004/07/14 23:18:19 agriffis Exp $
opts="start stop reload restart"
depend() {
need net
use logger
provide dns
}
checkconfig() {
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
if [ ! $CPU ] ; then
CPU=1
fi
if [ $CHROOT -a -d $CHROOT ] ; then
PIDFILE="${CHROOT}/var/run/named/named.pid"
KEY="${CHROOT}/etc/bind/rndc.key"
else
PIDFILE="/var/run/named/named.pid"
KEY="/etc/bind/rndc.key"
fi
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
start-stop-daemon --start --quiet --exec /usr/sbin/named -- -u named -n $CPU $OPTIONS ${CHROOT:+-t $CHROOT}
eend $?
}
stop() {
ebegin "Stopping ${CHROOT:+chrooted }named"
checkconfig || return 2
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec /usr/sbin/named -- stop
eend $?
}
reload() {
checkconfig || return 3
if [ ! -f $PIDFILE ] ; then
/etc/init.d/named start &>/dev/null
exit
fi
if [ -f $KEY ] ; then
ebegin "Reloading named.conf and zone files"
rndc -k $KEY reload &>/dev/null
eend $?
else /etc/init.d/named restart &>/dev/null
fi
}
restart() {
svc_stop
svc_start
}

View File

@ -0,0 +1,13 @@
--- files/named.rc6 2004-07-15 03:36:02.000000000 +0400
+++ named 2005-03-25 20:19:16.000000000 +0300
@@ -33,7 +33,9 @@
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
- start-stop-daemon --start --quiet --exec /usr/sbin/named -- -u named -n $CPU $OPTIONS ${CHROOT:+-t $CHROOT}
+ start-stop-daemon --start --quiet --exec /usr/sbin/named \
+ --pid ${CHROOT}/var/run/named/named.pid \
+ -- -u named -n $CPU $OPTIONS ${CHROOT:+-t $CHROOT}
eend $?
}

View File

@ -0,0 +1,42 @@
--- named.orig 2005-04-17 16:14:08.000000000 +0400
+++ named.rc6 2005-04-17 16:18:00.000000000 +0400
@@ -17,23 +17,29 @@
fi
# In case someone doesn't have $CPU set from /etc/conf.d/named
- if [ ! $CPU ] ; then
- CPU=1
+ if [ ! ${CPU} ] ; then
+ CPU="1"
fi
- if [ $CHROOT -a -d $CHROOT ] ; then
- PIDFILE="${CHROOT}/var/run/named/named.pid"
- KEY="${CHROOT}/etc/bind/rndc.key"
- else
- PIDFILE="/var/run/named/named.pid"
- KEY="/etc/bind/rndc.key"
- fi
+ # As with the named.conf test, above, there's no need
+ # for chroot and non-chroot cases here
+ PIDFILE=$(grep "pid-file" ${CHROOT}/etc/bind/named.conf | \
+ egrep -v ".*[#,//].*pid-file" | \
+ head -n 1 | \
+ sed -ne 's:.*pid-file \"\(.*\)\";:\1:p')
+ [ -n "$PIDFILE" ] || PIDFILE=/var/run/named.pid
+
+ PIDFILE="${CHROOT}$PIDFILE"
+
+ KEY="${CHROOT}/etc/bind/rndc.key"
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
- start-stop-daemon --start --quiet --exec /usr/sbin/named -- -u named -n $CPU $OPTIONS ${CHROOT:+-t $CHROOT}
+ start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
+ --exec /usr/sbin/named \
+ -- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t $CHROOT}
eend $?
}

26
net-misc/dhcp/Manifest Normal file
View File

@ -0,0 +1,26 @@
AUX dhcp-3.0-ddns-example.patch 401 RMD160 0188ae91fb58fc6f8c0d1b5bcbed58582dfed099 SHA1 c9e0f4c9ccbf1ff89076ff1bec37fb6d1276b7f0 SHA256 cf136ce92ea8f3337b9ded9c6f4f019db9782a68c63a3e8b712d26a04c2c9584
AUX dhcp-3.0-fix-perms.patch 485 RMD160 3857270dffed5feee95609aeb37d0c9ef8844945 SHA1 1217265a8a7f1416b781e9f79e8dfb8304268e6c SHA256 a805a60b36e148886887aebb797e80f642386b3e55ef4a0b5132f96a2877e018
AUX dhcp-3.0-paranoia.patch 5366 RMD160 7c64e3dac5b07ff3859fcaa7a8b0e52a0c50446c SHA1 a30103c138e480766f84644fffb1d0897709c27d SHA256 a8db9eb98397a9c1b3a0de07fc107c39dc4f6a4a331d404fc6fcc4a8dbc7aeae
AUX dhcp-3.0.2-gmake.patch 1872 RMD160 d2d41c0a7e002103d68605d2492bfe716bb2889e SHA1 f60c89233f06ca8554cd5cc9ed0301b597a724f7 SHA256 b2bbfc1d1f5b4d03ff3f53b3974ec32731e5f626de8f8d127328591e4c721215
AUX dhcp-3.0.3-dhclient-dbus.patch 2774 RMD160 250582d89894a58a297786c4a6884b54219c4b6f SHA1 74760ca00712ff529e6b97457408515098563f88 SHA256 d70292c5b61648ba5970ab436429ced33e807bd6f68ba06dcd2b9d4073b02ea4
AUX dhcp-3.0.3-dhclient-hostname.patch 523 RMD160 38c20bcc417822ae858626eb5d0eaf7e669c1ca0 SHA1 5d2c3a1da74a1d151c9fbf08e01e4545e989078c SHA256 57c09edd2bf48cd65745e3b14499f7f3c26d529f60fd2ab122887ae968e26bbd
AUX dhcp-3.0.3-dhclient-metric.patch 7270 RMD160 04187868f66e03a62dafd31b4cdcdd2029283ce5 SHA1 1d726d1526ae97adbdf1b259bb55e05145060375 SHA256 7e5ace014ed55d7d4e90a6cdac7dec4842ea9d178bb19bf6cdccf295eba9da7d
AUX dhcp-3.0.3-dhclient-mtu.patch 6413 RMD160 2517c7fe58d7dca95bdbdc80e96b6260cc205e56 SHA1 da342800bafee86726570aa0a5e4e3c8bd5f1371 SHA256 0a4bff3c4c44252125f66a3a4423f677465592b84a8f7f500bad9ba4e3b5cb06
AUX dhcp-3.0.3-dhclient-no-down.patch 2332 RMD160 26d0c88534b71070e81c86c12b76a2b4ec7c9c2c SHA1 b2a00d46754414e937dc6c3d63a28b63b3b57ac9 SHA256 a5a67de79f6435d9bc4eeea416aff7a904ab567e5e8d75ecf34495bc9f2c5a44
AUX dhcp-3.0.3-dhclient-ntp.patch 5862 RMD160 73d001b7b2df36cf84aba9db76a1753c8d423a7d SHA1 cc3db6430f07f956c2ad25ed00e47d468eef2600 SHA256 80ab30eee75fb03c099416c25f031d03744011a582e8940c73077d5ee587c1ee
AUX dhcp-3.0.3-dhclient-resolvconf.patch 6659 RMD160 27e6d97ca0ca52fc85abeb4f21f4cea526cbffcb SHA1 d4808b4ba195a2fe1232136c2e36fb534a4c07c3 SHA256 3e2ec3758f6a56658aa1ef9c8ab29f655716015f0c75eba022fa6e1a5e28b1ac
AUX dhcp-3.0.3-dhclient-stdin-conf.patch 1948 RMD160 42f32a5bbfe2a937827c2972ef84cfa78c2c401c SHA1 ac7afd5ecbde5348e9acea532dab1e01e3a58e8b SHA256 e1bfd26b7da10acc4bd718e35aae4235308abcacde78dedf39533b11ab18b3ae
AUX dhcp-3.0.3-libdst.patch 322 RMD160 5216c754a912cfcfc65683afcf44dbe1a7871212 SHA1 804bab67ae06269336c51183d5ff1e8ba45c20b5 SHA256 68e9a081739736980c0ad834dfa6197f940982f53d4d16054715c0346b5b9eca
AUX dhcp-3.0.3-no_isc_blurb.patch 3002 RMD160 d70f89e1763bfeb23ce8f09399426983df01f7c8 SHA1 99a9fe69988226d29ccc6c2dc745ffab9b66817c SHA256 09c451cd9667fc8effcecd640f4cbe8629d41f6abacf9d1f2f923aab1f6e0bbb
AUX dhcp-3.0.3-tr.patch 377 RMD160 fe81fefb55796b4e06fa73ec180026dceef5599d SHA1 947a4002e7e2b21cd80fe0a3d0f6f044d5c6faff SHA256 05f81ad7c0e8cd2d2f3e81c0cd1aecc0f2a2787672037eca87e66a814150f5c8
AUX dhcp-3.0.3-x-option.patch 6478 RMD160 a0fa5b3c7caf2d303a76c3d6fc135783cfa2bbc6 SHA1 4c77474307f9e657e45618f93ba9120eafd83a9e SHA256 6628629a95ee7e711f9dbce6b7d527b15f98eaf7592a1d0855d7bf65961bc3f7
AUX dhcp-3.0.4-dhclient-stdin-conf.patch 2176 RMD160 fae08899f6b57da3ec7ab0068e288bbdf2fbf2ae SHA1 c10c35dcf4a94f45f4bc98147a70e9dcf3f01dd5 SHA256 80141fe71e52774f1c7b1a02f2cbd49bc646f19753ceefc1c3605104df0cae5f
AUX dhcp-3.0.5-bpf-nofallback.patch 1473 RMD160 1a5ece77cb481416935b0d2eea53e85dc4c4ee93 SHA1 d4cad638075a98606e07c633551c8a1d2f78f2e7 SHA256 b215c5ff4a282b475f28168250c05bbbc85e7c37e7af92616571d499b8c14da6
AUX dhcp-3.1.0-ldap.patch 186418 RMD160 a84a45107f5b050c859a6a78e6a05be48e553364 SHA1 30f60d83e01decf0de6556f4abab85b168071062 SHA256 2c061f5cd90858d9cacc7176c60c1d9f26a6f034daf161c4f4df1e381eed91cb
AUX dhcp-3.1.0a1-dhclient-resolvconf.patch 10316 RMD160 183bedd1660bf5a5f9dc7d002199e76aec12341c SHA1 1e0332ea31cfdbe92f3053405587f08117de8f8b SHA256 112b2ed44aab92592eb3810c61ada7f30d9d01fe43b647667326972a37b412a1
AUX dhcpd.conf 1092 RMD160 936bb112c7cdf8e669b695599252d1f6626be2f3 SHA1 cbabbcea73a0cbc9692462683b983c96d6f18b0c SHA256 b86d27e0560689057b01a352474582fceb3a398eaf3b17f901378ec56284c4d5
AUX dhcpd.init 1989 RMD160 7f6b6858020100e47efa5d6a0809b2959e551249 SHA1 2c611adc6425fd095740aa56d09d8aafb4fea58a SHA256 916bfeb81dcb3423fd4239270ac2dce2e6dc105b28a06e03b352f6bf6b30ed1e
AUX dhcrelay.conf 421 RMD160 456edbc9bcc8d3a44db5bb6dbf0c3003c3e7419c SHA1 78ecdb000382893fb49d0052ced063955b0ad9cf SHA256 409b895ed489e75c1a08f72961b45d641b93fd9357f528abc78b1fd036b7f730
AUX dhcrelay.init 736 RMD160 04566b87bd6dbb8bb754b26409ca30b878ef3ca3 SHA1 72742b308314b2e1476b27e94212fbf4d179adc4 SHA256 cfdaff3a723be3935d06c14e171d4008f2ad3329bd05ac2e49c19bc0e14bc59c
DIST dhcp-3.1.0.tar.gz 797100 RMD160 59ef8b695b66d3cb61437e25a179d9f17639017d SHA1 f33d017f055648e6571aa26cf314d37857491a2e SHA256 26d02217f53e40ab7c7140cf58d99b55a64979c8501481b28da9c432f0f92243
EBUILD dhcp-3.1.0-r1.ebuild 7622 RMD160 831ed83951cf678c02ea5b2a7b6c0c873009270f SHA1 a1be08f55e97189d6cde851491b410294db6c6c0 SHA256 a7ca880b7af8422ed152f09eb9c5917b6c3186d51f2a87ab043eae560b94d127

View File

@ -0,0 +1,244 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-3.1.0.ebuild,v 1.11 2008/01/10 09:14:57 vapier 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 ~sparc-fbsd x86 ~x86-fbsd"
IUSE="doc minimal static selinux kernel_linux ldap"
DEPEND="selinux? ( sec-policy/selinux-dhcp )
kernel_linux? ( sys-apps/net-tools )
ldap? ( net-nds/openldap )"
PROVIDE="virtual/dhcpc"
S="${WORKDIR}/${MY_P}"
src_unpack() {
unpack ${A}
cd "${S}"
# Gentoo patches - these will probably never be accepted upstream
# Enable chroot support
epatch "${FILESDIR}/${PN}"-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
# Disable fallback interfaces when using BPF
# This allows more than one dhclient instance on the BSD's
epatch "${FILESDIR}/${PN}"-3.0.5-bpf-nofallback.patch
# 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
# Add dbus support to dhclient
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch
# Ldap support patch
# Add ldap support to dhcpd
use ldap && epatch "${FILESDIR}/${PN}"-3.1.0-ldap.patch
# Brand the version with Gentoo
# include revision if >0
local newver="${MY_PV}-Gentoo"
use ldap && local newver="${MY_PV}-Gentoo-LDAP"
[[ ${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
# 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
# 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 ${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
newconfd "${FILESDIR}"/dhcpd.conf dhcpd
newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
# We never want portage to own this file
rm -f "${D}"/var/lib/dhcp/dhcpd.leases
fi
}
pkg_preinst() {
if ! use minimal ; then
enewgroup dhcp
enewuser dhcp -1 -1 /var/lib/dhcp dhcp
fi
}
pkg_postinst() {
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"
}

View File

@ -0,0 +1,13 @@
diff -ur a/server/dhcpd.conf b/server/dhcpd.conf
--- a/server/dhcpd.conf 2001-01-25 08:33:11 +0000
+++ b/server/dhcpd.conf 2007-07-19 10:29:43 +0100
@@ -21,6 +21,9 @@
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
+# Disable dynamic DNS updates.
+ddns-update-style none;
+
subnet 10.152.187.0 netmask 255.255.255.0 {
}

View File

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

View File

@ -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]",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,191 @@
--- client/scripts/bsdos
+++ client/scripts/bsdos
@@ -1,11 +1,22 @@
#!/bin/sh
make_resolv_conf() {
- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
- echo search $new_domain_name >/etc/resolv.conf
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
+ 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
fi
# If we're making confs, may as well make an ntp.conf too
make_ntp_conf
--- client/scripts/freebsd
+++ client/scripts/freebsd
@@ -11,25 +11,21 @@
fi
make_resolv_conf() {
- if [ x"$new_domain_name_servers" != x ]; then
- if [ "x$new_domain_name" != x ]; then
- ( echo search $new_domain_name >/etc/resolv.conf )
- exit_status=$?
- else
- if [ -e /etc/resolv.conf ] ; then
- ( rm /etc/resolv.conf )
- exit_status=$?
- else
- ( touch /etc/resolv.conf )
- 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
- fi
- if [ $exit_status -ne 0 ]; then
- $LOGGER "WARNING: Unable to update resolv.conf: Error $exit_status"
- else
for nameserver in $new_domain_name_servers; do
- ( echo nameserver $nameserver >>/etc/resolv.conf )
+ 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
fi
# If we're making confs, may as well make an ntp.conf too
--- client/scripts/linux
+++ client/scripts/linux
@@ -23,12 +23,22 @@
# of the $1 in its args.
make_resolv_conf() {
- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
- echo search $new_domain_name >/etc/resolv.conf
- chmod 644 /etc/resolv.conf
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
+ 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
fi
# If we're making confs, may as well make an ntp.conf too
make_ntp_conf
--- client/scripts/netbsd
+++ client/scripts/netbsd
@@ -1,11 +1,22 @@
#!/bin/sh
make_resolv_conf() {
- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
- echo search $new_domain_name >/etc/resolv.conf
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
+ 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
fi
# If we're making confs, may as well make an ntp.conf too
make_ntp_conf
--- client/scripts/openbsd
+++ client/scripts/openbsd
@@ -1,11 +1,22 @@
#!/bin/sh
make_resolv_conf() {
- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
- echo search $new_domain_name >/etc/resolv.conf
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
+ 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
fi
# If we're making confs, may as well make an ntp.conf too
make_ntp_conf
--- client/scripts/solaris
+++ client/scripts/solaris
@@ -1,11 +1,22 @@
#!/bin/sh
make_resolv_conf() {
- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
- echo search $new_domain_name >/etc/resolv.conf
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
+ 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
fi
# If we're making confs, may as well make an ntp.conf too
make_ntp_conf

View File

@ -0,0 +1,77 @@
--- 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);
@@ -174,11 +174,36 @@
status = (cfile -> warnings_occurred
? ISC_R_BADPARSE
: ISC_R_SUCCESS);
- close (file);
end_parse (&cfile);
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>

View File

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

View File

@ -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")) {

View File

@ -0,0 +1,12 @@
--- work.linux-2.2/common/tr.c 2005/08/14 11:34:24 1.1
+++ work.linux-2.2/common/tr.c 2005/08/14 11:35:16
@@ -40,6 +40,9 @@ static char copyright[] =
#include "includes/netinet/if_ether.h"
#include "netinet/if_tr.h"
#include <sys/time.h>
+#ifdef __linux__
+#include <linux/types.h>
+#endif
/*
* token ring device handling subroutines. These are required as token-ring

View File

@ -0,0 +1,216 @@
--- dhcp-3.0.2/common/parse.c.extended_option_environment 2005-04-05 17:49:36.513062562 -0400
+++ dhcp-3.0.2/common/parse.c 2005-04-05 17:49:36.580052656 -0400
@@ -1270,6 +1270,10 @@
option_hash_add (option -> universe -> hash,
(const char *)option -> name,
0, option, MDL);
+#ifdef EXTENDED_NEW_OPTION_INFO
+ if ( new_option_info_tree != 0L )
+ add_new_option_info( option );
+#endif
return 1;
}
--- dhcp-3.0.2/common/tables.c.extended_option_environment 2004-09-01 13:06:35.000000000 -0400
+++ dhcp-3.0.2/common/tables.c 2005-04-05 18:04:23.915838623 -0400
@@ -1238,3 +1238,40 @@
fqdn_universe.name, 0,
&fqdn_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
--- dhcp-3.0.2/includes/dhcpd.h.extended_option_environment 2004-11-24 12:39:16.000000000 -0500
+++ dhcp-3.0.2/includes/dhcpd.h 2005-04-05 17:49:36.613047777 -0400
@@ -1800,6 +1800,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;
--- dhcp-3.0.2/client/dhclient.c.extended_option_environment 2005-04-05 17:49:36.566054726 -0400
+++ dhcp-3.0.2/client/dhclient.c 2005-04-05 17:49:36.617047185 -0400
@@ -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 *);
@@ -204,6 +206,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 {
@@ -572,7 +579,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]");
@@ -2529,8 +2540,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,
@@ -2547,6 +2578,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,
@@ -2575,6 +2631,7 @@
es.client = client;
es.prefix = prefix;
+ es.universe = 0L;
client_envadd (client,
prefix, "ip_address", "%s", piaddr (lease -> address));
@@ -2788,7 +2845,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);
--- dhcp-3.0.2/client/dhclient.8.extended_option_environment 2004-09-29 19:01:46.000000000 -0400
+++ dhcp-3.0.2/client/dhclient.8 2005-04-05 17:49:36.619046889 -0400
@@ -78,6 +78,9 @@
.B -w
]
[
+.B -x
+]
+[
.I if0
[
.I ...ifN
@@ -252,6 +255,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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -0,0 +1,71 @@
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init,v 1.5 2007/04/02 12:34:01 uberlord Exp $
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}"
}
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
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)"
ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
start-stop-daemon --stop --exec /usr/sbin/dhcpd \
--pidfile "${chroot}/$(get_options pidfile)"
eend $?
}

View File

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

View File

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

View File

@ -1,17 +1,8 @@
DIST llvm-2.1-patches-1.0.tar.bz2 1958 RMD160 435a113bd440512cef1713777de059eee9b0fd29 SHA1 01c8ef8b2520155b516f0be7a1fb19a40d8dd942 SHA256 5d180d6a7f2575fcb74d80607f7ec79379d3ca470acec106faacc618ecd7f706
DIST llvm-2.1.tar.gz 5062241 RMD160 df28ee93be79b8d436deb7c0e1cff1c21e1328be SHA1 e57081e1bc7c2cb168859f534c08b579276c3398 SHA256 8cabd422f249ada736d864fc8a1f4d14aabefacb6f860c9beefbc53f93e0f96c
DIST llvm-2.2-patches-1.1.tar.bz2 1734 RMD160 5ca6e8aa4e17a41eabde5e706fb0c1feb58548f8 SHA1 d34b58b78cbf3f4b182f237a4a9a782e620cedb1 SHA256 f8bb10d142597b57fead9682d4088aa763788d4f3cbc362f9605ae07e34cd095
DIST llvm-2.2.tar.gz 5702420 RMD160 543d26dea265d5cb72b3e5d5c74af85c0f74a376 SHA1 9cbd80cd15711618d11b82c1873d0a46d550091b SHA256 788d871aec139e0c61d49533d0252b21c4cd030e91405491ee8cb9b2d0311072
EBUILD llvm-2.1.ebuild 176 RMD160 9f7b33bdedc3eca0ce04a61c5c82ef8b331aef6a SHA1 8c52175a0cf89471c3a9d27a118898b4d15ba90b SHA256 77abaacb58f0eab70168cf6636e0578ae078e80051739cbf606f0a3424d91acf
MD5 df4cb1f76ce0ffa0f2f327492e78dcf6 llvm-2.1.ebuild 176
RMD160 9f7b33bdedc3eca0ce04a61c5c82ef8b331aef6a llvm-2.1.ebuild 176
SHA256 77abaacb58f0eab70168cf6636e0578ae078e80051739cbf606f0a3424d91acf llvm-2.1.ebuild 176
EBUILD llvm-2.2.ebuild 176 RMD160 bf08a7b74b33b7cd5354879eb2f55c39e76996ec SHA1 d26481b8ab89be55e137902d8f4ea257ea868c2d SHA256 53cfbd1a99c6560a57d7af896d4d9ccf9c801eeac8be14449f62966825c37323
MISC ChangeLog 325 RMD160 25f9393eab9c9990f29ddac537b3d5ba30b3370a SHA1 20833b78acbff61fb36d06ac352c6f1f64d30592 SHA256 a48414fe2821dc7a7f8a089a8b703f74001d51db2018a4c5f088d3767e9d8f53
MD5 c2e13744fc1e3b64b7705b7fe5876a23 ChangeLog 325
RMD160 25f9393eab9c9990f29ddac537b3d5ba30b3370a ChangeLog 325
SHA256 a48414fe2821dc7a7f8a089a8b703f74001d51db2018a4c5f088d3767e9d8f53 ChangeLog 325
MISC metadata.xml 170 RMD160 645927a396fdc21cdeb089fe42c5397332420ea6 SHA1 ac7f48a14fec325926f9ce1be8fbf1f311b4f2e4 SHA256 d797a2ec6f9dc516c9f9c1a758ee87ad3e8c43101b5dc76c2f872d5bd4639b42
MD5 1e678929a9fec6632e227bdf2262e9a1 metadata.xml 170
RMD160 645927a396fdc21cdeb089fe42c5397332420ea6 metadata.xml 170
SHA256 d797a2ec6f9dc516c9f9c1a758ee87ad3e8c43101b5dc76c2f872d5bd4639b42 metadata.xml 170
MD5 9081076b6c81203f42ee17188f9b6063 files/digest-llvm-2.1 488
RMD160 7b3d858f78157a6aa203d697ecea2ca83df85479 files/digest-llvm-2.1 488
SHA256 ae5b55ab3b6bc84fa0748c6db3466a72df053085ac3e4ab1fda4df282b0d2481 files/digest-llvm-2.1 488