diff options
Diffstat (limited to 'abs/core/dhcp')
-rw-r--r-- | abs/core/dhcp/ChangeLog | 8 | ||||
-rw-r--r-- | abs/core/dhcp/PKGBUILD | 39 | ||||
-rw-r--r-- | abs/core/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch | 50 | ||||
-rw-r--r-- | abs/core/dhcp/dhcp.conf.d | 6 | ||||
-rw-r--r-- | abs/core/dhcp/dhcp.install | 15 | ||||
-rwxr-xr-x | abs/core/dhcp/dhcpd | 40 |
6 files changed, 158 insertions, 0 deletions
diff --git a/abs/core/dhcp/ChangeLog b/abs/core/dhcp/ChangeLog new file mode 100644 index 0000000..7b9cb47 --- /dev/null +++ b/abs/core/dhcp/ChangeLog @@ -0,0 +1,8 @@ + +2009-07-19 K. Piche <kevin@archlinux.org> + * dhcp 4.1.0.p1-1 + * Adopted RedHat patch to fix bug where dhcpd won't start if ipv6 module + is not loaded. Fixes FS#12792. + * Added /etc/conf.d/dhcp feature contributed by Fabiano Furtado Pessoa + Coelho <fusca14@gmail.com> + diff --git a/abs/core/dhcp/PKGBUILD b/abs/core/dhcp/PKGBUILD new file mode 100644 index 0000000..db15ac3 --- /dev/null +++ b/abs/core/dhcp/PKGBUILD @@ -0,0 +1,39 @@ +# $Id: PKGBUILD 46754 2009-07-20 03:16:44Z kevin $ +# Maintainer: judd <jvinet@zeroflux.org> +pkgname=dhcp +# separate patch levels with a period to maintain proper versioning. +pkgver=4.1.0.p1 +_pkgver=4.1.0p1 +pkgrel=1 +pkgdesc="A DHCP server, client, and relay agent" +arch=(i686 x86_64) +license=('custom:isc-dhcp') +url="https://www.isc.org/software/dhcp" +depends=('openssl>=0.9.8a') +backup=('etc/dhcpd.conf' 'etc/conf.d/dhcp') +install=dhcp.install +source=(http://ftp.isc.org/isc/${pkgname}/${pkgname}-${_pkgver}.tar.gz +dhcpd dhcp.conf.d dhcp-4.1.0-missing-ipv6-not-fatal.patch) + +build() { + cd ${srcdir}/${pkgname}-${_pkgver} + # Define _GNU_SOURCE to fix IPV6. + sed '/^CFLAGS="$CFLAGS/ s/INGS"/INGS -D_GNU_SOURCE"/' -i configure + # Make not having ipv6 non-fatal. + patch -Np1 -i ${srcdir}/dhcp-4.1.0-missing-ipv6-not-fatal.patch + ./configure --prefix=/usr --sysconfdir=/etc \ + --with-srv-lease-file=/var/state/dhcp/dhcpd.leases \ + --with-srv6-lease-file=/var/state/dhcp/dhcpd6.leases + make || return 1 + make DESTDIR=${pkgdir} install + + install -D -m755 ${srcdir}/dhcpd ${pkgdir}/etc/rc.d/dhcpd + install -D -m644 ${srcdir}/dhcp.conf.d ${pkgdir}/etc/conf.d/${pkgname} + mkdir -p ${pkgdir}/var/state/dhcp + rm -f ${pkgdir}/etc/dhclient.conf + rm -f ${pkgdir}/usr/sbin/dhclient + rm -f ${pkgdir}/usr/share/man/man{5,8}/dhclient* + # install licenses + install -m644 -D ${srcdir}/${pkgname}-${_pkgver}/LICENSE \ + ${pkgdir}/usr/share/licenses/dhcp/LICENSE +} diff --git a/abs/core/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch b/abs/core/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch new file mode 100644 index 0000000..ebf3865 --- /dev/null +++ b/abs/core/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch @@ -0,0 +1,50 @@ +diff -Naur dhcp-4.1.0a2/common/discover.c dhcp-4.1.0a2-mcn/common/discover.c +--- dhcp-4.1.0a2/common/discover.c 2008-08-29 18:48:57.000000000 +0100 ++++ dhcp-4.1.0a2-mcn/common/discover.c 2008-10-02 13:02:06.000000000 +0100 +@@ -443,15 +443,17 @@ + } + + #ifdef DHCPv6 +- ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); +- if (ifaces->fp6 == NULL) { +- log_error("Error opening '/proc/net/if_inet6' to " +- "list IPv6 interfaces; %m"); +- close(ifaces->sock); +- ifaces->sock = -1; +- fclose(ifaces->fp); +- ifaces->fp = NULL; +- return 0; ++ if (local_family == AF_INET6) { ++ ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); ++ if (ifaces->fp6 == NULL) { ++ log_error("Error opening '/proc/net/if_inet6' to " ++ "list IPv6 interfaces; %m"); ++ close(ifaces->sock); ++ ifaces->sock = -1; ++ fclose(ifaces->fp); ++ ifaces->fp = NULL; ++ return 0; ++ } + } + #endif + +@@ -720,7 +722,8 @@ + } + #ifdef DHCPv6 + if (!(*err)) { +- return next_iface6(info, err, ifaces); ++ if (local_family == AF_INET6) ++ return next_iface6(info, err, ifaces); + } + #endif + return 0; +@@ -736,7 +739,8 @@ + close(ifaces->sock); + ifaces->sock = -1; + #ifdef DHCPv6 +- fclose(ifaces->fp6); ++ if (local_family == AF_INET6) ++ fclose(ifaces->fp6); + ifaces->fp6 = NULL; + #endif + } diff --git a/abs/core/dhcp/dhcp.conf.d b/abs/core/dhcp/dhcp.conf.d new file mode 100644 index 0000000..99ba6d1 --- /dev/null +++ b/abs/core/dhcp/dhcp.conf.d @@ -0,0 +1,6 @@ +# +# Arguments to be passed to the DHCP server daemon +# + +DHCP_ARGS="-q" + diff --git a/abs/core/dhcp/dhcp.install b/abs/core/dhcp/dhcp.install new file mode 100644 index 0000000..edb84b1 --- /dev/null +++ b/abs/core/dhcp/dhcp.install @@ -0,0 +1,15 @@ +# arg 1: the new package version +post_install() { + [ -f var/state/dhcp/dhcpd.leases ] || : >var/state/dhcp/dhcpd.leases + echo "If dhcpd doesn' start ensure the ipv6 kernel module is loaded." +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 +} + +op=$1 +shift +$op $* diff --git a/abs/core/dhcp/dhcpd b/abs/core/dhcp/dhcpd new file mode 100755 index 0000000..1fbb31e --- /dev/null +++ b/abs/core/dhcp/dhcpd @@ -0,0 +1,40 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/dhcp + +PIDFILE="/var/run/dhcpd.pid" +PID=`cat $PIDFILE 2>/dev/null` +case "$1" in + start) + stat_busy "Starting DHCP Server" + if [ "$PID" = "" ]; then + /usr/sbin/dhcpd $DHCP_ARGS + fi + if [ "$PID" != "" -o $? -gt 0 ]; then + stat_fail + else + add_daemon dhcpd + stat_done + fi + ;; + stop) + stat_busy "Stopping DHCP Server" + [ ! -z "$PID" ] && kill $PID &> /dev/null + rm -f $PIDFILE + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon dhcpd + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac |