ports/136890: [PATCH} update net/isc-dhcp31-server
Josh Paetzel
jpaetzel at FreeBSD.org
Sat Jul 18 18:30:06 UTC 2009
>Number: 136890
>Category: ports
>Synopsis: [PATCH} update net/isc-dhcp31-server
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Sat Jul 18 18:30:05 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Josh Paetzel
>Release: 8.0-CURRENT
>Organization:
>Environment:
FreeBSD virt80.tcbug.org 8.0-CURRENT FreeBSD 8.0-CURRENT #1: Sat Jun 13 10:21:06 UTC 2009 root at virt80.tcbug.org:/usr/obj/usr/src/sys/VIRT80 amd64
>Description:
Update dhcp31 port to latest patch release that includes SA fixes.
Update rcNG script to support checking the config file upon restart
Integrate multi IP jail patchdone by @jhb for net/isc-dhcp30-server
>How-To-Repeat:
>Fix:
Apply the following patch
http://people.freebsd.org/~jpaetzel/ports/net/isc-dhcp31-server/patch.diff
Patch attached with submission follows:
Index: isc-dhcpd.in
===================================================================
RCS file: /home/ncvs/ports/net/isc-dhcp31-server/files/isc-dhcpd.in,v
retrieving revision 1.5
diff -u -r1.5 isc-dhcpd.in
--- isc-dhcpd.in 15 Jul 2009 16:55:51 -0000 1.5
+++ isc-dhcpd.in 18 Jul 2009 13:13:13 -0000
@@ -700,6 +700,25 @@
fi
}
+dhcpd_checkconfig ()
+{
+ local rc_flags_saved rc_flags_our
+ rc_flags_saved="$rc_flags"
+ setup_flags
+ # Eliminate '-q' flag if it is present
+ rc_flags_our=`echo "${rc_flags}" | sed -Ee's/(^-q | -q | -q$)'//`
+ rc_flags="${rc_flags_saved}"
+ if ${command} -t -q ${rc_flags_our}; then
+ true
+ else
+ echo "Configuration file sanity check failed:"
+ echo "======================================="
+ ${command} -t ${rc_flags_our}
+ echo "======================================="
+ false
+ fi
+}
+
rcvar=${name}_enable
load_rc_config ${name}
@@ -718,6 +737,7 @@
required_files=${dhcpd_conf}
start_precmd=${name}_precmd
stop_postcmd=${name}_postcmd
+restart_precmd="dhcpd_checkconfig"
install_cmd=dhcpd_install
uninstall_cmd=dhcpd_uninstall
extra_commands="install uninstall"
Index: patch-server::dhcpd.c
===================================================================
RCS file: /home/ncvs/ports/net/isc-dhcp31-server/files/patch-server::dhcpd.c,v
retrieving revision 1.3
diff -u -r1.3 patch-server::dhcpd.c
--- patch-server::dhcpd.c 14 Mar 2007 17:14:06 -0000 1.3
+++ patch-server::dhcpd.c 18 Jul 2009 12:21:04 -0000
@@ -1,5 +1,5 @@
---- server/dhcpd.c.orig Thu Jun 10 19:59:52 2004
-+++ server/dhcpd.c Fri Jun 25 15:49:09 2004
+--- server/dhcpd.c.orig 2009-07-18 12:17:49.000000000 +0000
++++ server/dhcpd.c 2009-07-18 12:16:17.000000000 +0000
@@ -47,6 +47,22 @@
#include "version.h"
#include <omapip/omapip_p.h>
@@ -22,8 +22,8 @@
+
static void usage PROTO ((void));
- TIME cur_time;
-@@ -195,6 +211,35 @@
+ struct iaddr server_identifier;
+@@ -193,6 +209,46 @@
omapi_object_dereference (&listener, MDL);
}
@@ -42,14 +42,25 @@
+#endif /* PARANOIA */
+
+#if defined (JAIL)
-+static void setup_jail (char *chroot_dir, char *hostname, u_int32_t ip_number)
++#if !defined(JAIL_API_VERSION)
++#define JAIL_API_VERSION 0
++#endif
++static void setup_jail (char *chroot_dir, char *hostname, struct in_addr ip_addr)
+{
+ struct jail j;
+
-+ j.version = 0;
++ memset(&j, 0, sizeof(j));
++ j.version = JAIL_API_VERSION;
+ j.path = chroot_dir;
+ j.hostname = hostname;
-+ j.ip_number = ip_number;
++#if JAIL_API_VERSION == 0
++ j.ip_number = ntoh1(ip_addr.s_addr);
++#elif JAIL_API_VERSION ==2
++ j.ip4s = 1;
++ j.ip4 = &ip_addr;
++#else
++#error Unsupported jail API
++#endif
+
+ if (jail (&j) < 0)
+ log_fatal ("jail(%s, %s): %m", chroot_dir, hostname);
@@ -59,7 +70,7 @@
int main (argc, argv, envp)
int argc;
char **argv, **envp;
-@@ -227,6 +272,25 @@
+@@ -225,6 +281,25 @@
char *traceinfile = (char *)0;
char *traceoutfile = (char *)0;
#endif
@@ -78,14 +89,14 @@
+#endif /* PARANOIA || JAIL */
+#if defined (JAIL)
+ char *set_jail = 0;
-+ u_int32_t jail_ip_address = 0; /* Good as long as it's IPv4 ... */
++ struct in_addr jail_ip_address;
+ int no_dhcpd_jail = 0;
+ char *s2;
+#endif /* JAIL */
- /* Make sure we have stdin, stdout and stderr. */
- status = open ("/dev/null", O_RDWR);
-@@ -289,6 +353,39 @@
+ /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
+ 2 (stderr) are open. To do this, we assume that when we
+@@ -290,6 +365,38 @@
if (++i == argc)
usage ();
server = argv [i];
@@ -119,13 +130,12 @@
+ usage ();
+ if (inet_pton (AF_INET, argv[i], &jail_ip_address) < 0)
+ log_fatal ("invalid ip address: %s", argv[i]);
-+ jail_ip_address = ntohl (jail_ip_address);
+ no_dhcpd_jail = 1;
+#endif /* JAIL */
} else if (!strcmp (argv [i], "-cf")) {
if (++i == argc)
usage ();
-@@ -366,6 +463,28 @@
+@@ -367,6 +474,27 @@
if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
path_dhcpd_pid = s;
}
@@ -148,13 +158,12 @@
+ set_jail = s;
+ if (inet_pton (AF_INET, s2, &jail_ip_address) < 0)
+ log_fatal ("invalid ip address: %s", s2);
-+ jail_ip_address = ntohl (jail_ip_address);
+ }
+#endif /* JAIL */
if (!quiet) {
log_info ("%s %s", message, DHCP_VERSION);
-@@ -388,6 +507,57 @@
+@@ -393,6 +521,57 @@
trace_seed_stop, MDL);
#endif
@@ -212,7 +221,7 @@
/* Default to the DHCP/BOOTP port. */
if (!local_port)
{
-@@ -462,6 +632,9 @@
+@@ -467,6 +646,9 @@
#endif
/* Initialize icmp support... */
@@ -222,7 +231,7 @@
if (!cftest && !lftest)
icmp_startup (1, lease_pinged);
-@@ -491,6 +664,14 @@
+@@ -496,6 +678,14 @@
postconf_initialization (quiet);
@@ -237,7 +246,7 @@
/* test option should cause an early exit */
if (cftest && !lftest)
exit(0);
-@@ -533,7 +714,22 @@
+@@ -538,7 +728,22 @@
else if (pid)
exit (0);
}
@@ -259,8 +268,8 @@
+
/* Read previous pid file. */
if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
- status = read (i, pbuf, (sizeof pbuf) - 1);
-@@ -877,8 +1073,24 @@
+ status = read(i, pbuf, (sizeof pbuf) - 1);
+@@ -877,8 +1082,24 @@
log_info (copyright);
log_info (arr);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list