From db2c1433cfbd4fde1af9ffe3ad1e3d74dea8557e Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 31 Jul 2009 22:12:52 -0500
Subject: dhcp: version 4.1

---
 abs/core-testing/dhcp/ChangeLog                    |  8 ++++
 abs/core-testing/dhcp/PKGBUILD                     | 33 ++++++--------
 abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch        | 10 -----
 .../dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch   | 50 ++++++++++++++++++++++
 abs/core-testing/dhcp/dhcp.conf.d                  |  6 +++
 abs/core-testing/dhcp/dhcpd                        |  3 +-
 6 files changed, 79 insertions(+), 31 deletions(-)
 create mode 100644 abs/core-testing/dhcp/ChangeLog
 delete mode 100644 abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch
 create mode 100644 abs/core-testing/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch
 create mode 100644 abs/core-testing/dhcp/dhcp.conf.d

diff --git a/abs/core-testing/dhcp/ChangeLog b/abs/core-testing/dhcp/ChangeLog
new file mode 100644
index 0000000..7b9cb47
--- /dev/null
+++ b/abs/core-testing/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-testing/dhcp/PKGBUILD b/abs/core-testing/dhcp/PKGBUILD
index f426778..db15ac3 100644
--- a/abs/core-testing/dhcp/PKGBUILD
+++ b/abs/core-testing/dhcp/PKGBUILD
@@ -1,46 +1,39 @@
-# $Id: PKGBUILD 23123 2009-01-03 02:43:02Z kevin $
+# $Id: PKGBUILD 46754 2009-07-20 03:16:44Z kevin $
 # Maintainer: judd <jvinet@zeroflux.org>
 pkgname=dhcp
-pkgver=4.1.0
+# 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="http://www.isc.org/sw/dhcp/"
+url="https://www.isc.org/software/dhcp"
 depends=('openssl>=0.9.8a')
-backup=('etc/dhcpd.conf' 'etc/dhclient.conf')
+backup=('etc/dhcpd.conf' 'etc/conf.d/dhcp')
 install=dhcp.install
-source=(http://ftp.isc.org/isc/dhcp/dhcp-${pkgver}.tar.gz dhcp-3.0.3-tr.c.patch
-dhcpd)
-md5sums=('1fffed2e8c3d67b111316d6a9b33db7a' '39866416303b674df08b66b2d094e523'
-         '025b8fe98b6c0814428b671b1819a810')
+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}
-  patch -p1 -i ../dhcp-3.0.3-tr.c.patch || return 1
+  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 -m644 server/dhcpd.conf ${pkgdir}/etc/dhcpd.conf
-  #install -D -m644 client/dhclient.conf ${pkgdir}/etc/dhclient.conf
   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
-  #touch ${pkgdir}/var/state/dhcp/dhcpd.leases
-  #chmod -R 644 ${pkgdir}/usr/share/man/*
-  #chmod 755 ${pkgdir}/usr/share/man/man{1,3,5,8}
-  #sed -i 's|etc/dhclient-script|sbin/dhclient-script|g' \
-  #${pkgdir}/etc/dhclient.conf
-  #rm -f ${pkgdir}/var/state/dhcp/dhcpd.leases
-  #rm -f ${pkgdir}/sbin/{dhclient,dhclient-script}
   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 \
+  install -m644 -D ${srcdir}/${pkgname}-${_pkgver}/LICENSE \
                    ${pkgdir}/usr/share/licenses/dhcp/LICENSE
 }
diff --git a/abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch b/abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch
deleted file mode 100644
index e262c5e..0000000
--- a/abs/core-testing/dhcp/dhcp-3.0.3-tr.c.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- 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,7 @@ static char copyright[] =
- #include "includes/netinet/if_ether.h"
- #include "netinet/if_tr.h"
- #include <sys/time.h>
-+#include <linux/types.h>
- 
- /*
-  * token ring device handling subroutines.  These are required as token-ring
diff --git a/abs/core-testing/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch b/abs/core-testing/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch
new file mode 100644
index 0000000..ebf3865
--- /dev/null
+++ b/abs/core-testing/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-testing/dhcp/dhcp.conf.d b/abs/core-testing/dhcp/dhcp.conf.d
new file mode 100644
index 0000000..99ba6d1
--- /dev/null
+++ b/abs/core-testing/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-testing/dhcp/dhcpd b/abs/core-testing/dhcp/dhcpd
index 0aebcc8..1fbb31e 100755
--- a/abs/core-testing/dhcp/dhcpd
+++ b/abs/core-testing/dhcp/dhcpd
@@ -2,6 +2,7 @@
 
 . /etc/rc.conf
 . /etc/rc.d/functions
+. /etc/conf.d/dhcp
 
 PIDFILE="/var/run/dhcpd.pid"
 PID=`cat $PIDFILE 2>/dev/null`
@@ -9,7 +10,7 @@ case "$1" in
   start)
     stat_busy "Starting DHCP Server"
     if [ "$PID" = "" ]; then 
-       /usr/sbin/dhcpd -q
+       /usr/sbin/dhcpd $DHCP_ARGS 
     fi
     if [ "$PID" != "" -o $? -gt 0 ]; then
       stat_fail
-- 
cgit v0.12