+++ /dev/null
-diff -up dhcp-4.0.0/common/lpf.c.anycast dhcp-4.0.0/common/lpf.c
---- dhcp-4.0.0/common/lpf.c.anycast 2007-12-29 06:44:46.000000000 -1000
-+++ dhcp-4.0.0/common/lpf.c 2007-12-29 10:40:11.000000000 -1000
-@@ -331,6 +331,9 @@ ssize_t send_packet (interface, packet,
- return send_fallback (interface, packet, raw,
- len, from, to, hto);
-
-+ if (hto == NULL && interface->anycast_mac_addr.hlen)
-+ hto = &interface->anycast_mac_addr;
-+
- /* Assemble the headers... */
- assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
- fudge = hbufp % 4; /* IP header must be word-aligned. */
-diff -up dhcp-4.0.0/common/conflex.c.anycast dhcp-4.0.0/common/conflex.c
---- dhcp-4.0.0/common/conflex.c.anycast 2007-12-29 06:44:46.000000000 -1000
-+++ dhcp-4.0.0/common/conflex.c 2007-12-29 10:39:30.000000000 -1000
-@@ -715,6 +715,8 @@ intern(char *atom, enum dhcp_token dfv)
- }
- if (!strcasecmp (atom + 1, "nd"))
- return AND;
-+ if (!strcasecmp (atom + 1, "nycast-mac"))
-+ return ANYCAST_MAC;
- if (!strcasecmp (atom + 1, "ppend"))
- return APPEND;
- if (!strcasecmp (atom + 1, "llow"))
-diff -up dhcp-4.0.0/includes/dhcpd.h.anycast dhcp-4.0.0/includes/dhcpd.h
---- dhcp-4.0.0/includes/dhcpd.h.anycast 2007-12-29 06:44:46.000000000 -1000
-+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 10:42:56.000000000 -1000
-@@ -1188,6 +1188,7 @@ struct interface_info {
- int dlpi_sap_length;
- struct hardware dlpi_broadcast_addr;
- # endif /* DLPI_SEND || DLPI_RECEIVE */
-+ struct hardware anycast_mac_addr;
- };
-
- struct hardware_link {
-diff -up dhcp-4.0.0/includes/dhctoken.h.anycast dhcp-4.0.0/includes/dhctoken.h
---- dhcp-4.0.0/includes/dhctoken.h.anycast 2007-12-29 06:44:46.000000000 -1000
-+++ dhcp-4.0.0/includes/dhctoken.h 2007-12-29 10:44:00.000000000 -1000
-@@ -346,7 +346,8 @@ enum dhcp_token {
- TOKEN_ALSO = 650,
- AFTER = 651,
- CONFLICT_DONE = 660,
-- BOOTP_BROADCAST_ALWAYS = 652
-+ BOOTP_BROADCAST_ALWAYS = 652,
-+ ANYCAST_MAC = 653
- };
-
- #define is_identifier(x) ((x) >= FIRST_TOKEN && \
-diff -up dhcp-4.0.0/client/clparse.c.anycast dhcp-4.0.0/client/clparse.c
---- dhcp-4.0.0/client/clparse.c.anycast 2007-12-29 06:44:46.000000000 -1000
-+++ dhcp-4.0.0/client/clparse.c 2007-12-29 10:38:55.000000000 -1000
-@@ -550,6 +550,17 @@ void parse_client_statement (cfile, ip,
- }
- return;
-
-+ case ANYCAST_MAC:
-+ token = next_token (&val, (unsigned *)0, cfile);
-+ if (ip) {
-+ parse_hardware_param (cfile, &ip -> anycast_mac_addr);
-+ } else {
-+ parse_warn (cfile, "anycast mac address parameter %s",
-+ "not allowed here.");
-+ skip_to_semi (cfile);
-+ }
-+ return;
-+
- case REQUEST:
- token = next_token (&val, (unsigned *)0, cfile);
- if (config -> requested_options == default_requested_options)
+++ /dev/null
-diff -up dhcp-4.0.0/client/dhclient.c.usage dhcp-4.0.0/client/dhclient.c
---- dhcp-4.0.0/client/dhclient.c.usage 2008-02-13 16:20:30.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.c 2008-02-13 16:21:05.000000000 -1000
-@@ -882,21 +882,30 @@ main(int argc, char **argv) {
-
- static void usage ()
- {
-- log_info ("%s %s", message, PACKAGE_VERSION);
-- log_info (copyright);
-- log_info (arr);
-- log_info (url);
-+ printf ("%s %s\n", message, PACKAGE_VERSION);
-+ printf (copyright);
-+ printf ("\n");
-+ printf (arr);
-+ printf ("\n");
-+ printf (url);
-+ printf ("\n");
-
-- log_error ("Usage: dhclient %s %s",
-+ printf ("Usage: dhclient %s %s",
- #ifdef DHCPv6
- "[-4|-6] [-1dvrx] [-nw] [-p <port>]",
- #else /* DHCPv6 */
- "[-1dvrx] [-nw] [-p <port>]",
- #endif /* DHCPv6 */
-- "[-s server]");
-- log_error (" [-cf config-file] [-lf lease-file]%s",
-- "[-pf pid-file] [-e VAR=val]");
-- log_fatal (" [-sf script-file] [interface]");
-+ "[-s server]\n");
-+ printf (" [-cf config-file] [-lf lease-file]%s",
-+ "[-pf pid-file] [-e VAR=val]\n");
-+ printf (" [ -I <dhcp-client-identifier> ] [-B]\n");
-+ printf (" [ -H <host-name> | -F <fqdn.fqdn> ] [ -T <timeout> ]\n");
-+ printf (" [ -V <vendor-class-identifier> ]\n");
-+ printf (" [ -R <request option list> ]\n");
-+ printf (" [-sf script-file] [interface]\n");
-+
-+ exit (EXIT_FAILURE);
- }
-
- isc_result_t find_class (struct class **c,
+++ /dev/null
-/* dhcp4client.h
- *
- * Interface to the ISC dhcp IPv4 client libdhcp4client library.
- *
- * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions of
- * the GNU General Public License v.2, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY expressed or implied, including the implied warranties of
- * MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
- * Public License for more details. You should have received a copy of the
- * GNU General Public License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
- * source code or documentation are not subject to the GNU General Public
- * License and may only be used or replicated with the express permission of
- * Red Hat, Inc.
- *
- * Red Hat Author(s): Jason Vas Dias
- * David Cantrell <dcantrell@redhat.com>
- */
-
-/* include libdhcp_control.h or libdhcp.h for this */
-extern struct libdhcp_control_s;
-
-/* The ISC IPv4 DHCP client main() function */
-extern int dhcpv4_client(struct libdhcp_control_s *dhc_ctl,
- int argc, char **argv, char **envp);
+++ /dev/null
---- dhcp-3.0.5/server/confpars.c.failover 2007-03-30 16:28:08.000000000 -0400
-+++ dhcp-3.0.5/server/confpars.c 2007-03-30 16:32:39.000000000 -0400
-@@ -998,10 +998,17 @@
- parse_warn (cfile, "peer address may not be omitted");
-
- /* XXX - when/if we get a port number assigned, just set as default */
-+ /* See Red Hat Bugzilla 167292:
-+ * we do now: dhcp-failover 647/tcp
-+ * dhcp-failover 647/udp
-+ * dhcp-failover 847/tcp
-+ * dhcp-failover 847/udp
-+ * IANA registration by Bernard Volz <volz@cisco.com>
-+ */
- if (!peer -> me.port)
-- parse_warn (cfile, "local port may not be omitted");
-+ peer -> me.port = 647;
- if (!peer -> partner.port)
-- parse_warn (cfile, "peer port may not be omitted");
-+ peer -> partner.port = 847;
-
- if (peer -> i_am == primary) {
- if (!peer -> hba) {
+++ /dev/null
-diff -up dhcp-4.0.0/client/dhclient.c.fast dhcp-4.0.0/client/dhclient.c
---- dhcp-4.0.0/client/dhclient.c.fast 2007-12-29 06:07:14.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.c 2007-12-29 06:08:07.000000000 -1000
-@@ -3624,10 +3624,7 @@ isc_result_t dhclient_interface_startup_
- ip -> flags |= INTERFACE_RUNNING;
- for (client = ip -> client; client; client = client -> next) {
- client -> state = S_INIT;
-- /* Set up a timeout to start the initialization
-- process. */
-- add_timeout (cur_time + random () % 5,
-- state_reboot, client, 0, 0);
-+ add_timeout (cur_time, state_reboot, client, 0, 0);
- }
- }
- return ISC_R_SUCCESS;
+++ /dev/null
-#
-# Makefile.dist for libdhcp4client
-#
-# We get the libdhcp4client library from the patched ISC source code. We
-# rebuild key C files with -DLIBDHCP to turn on the library features we
-# need. Normal build results in standard ISC code (i.e., not LIBDHCP
-# stuff enabled). We then link together a static library and a shared
-# library with the new resulting objects.
-#
-# Copyright (C) 2006, 2007 Red Hat, Inc. All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions of
-# the GNU General Public License v.2, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY expressed or implied, including the implied warranties of
-# MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
-# Public License for more details. You should have received a copy of the
-# GNU General Public License along with this program; if not, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
-# source code or documentation are not subject to the GNU General Public
-# License and may only be used or replicated with the express permission of
-# Red Hat, Inc.
-#
-# Red Hat Author(s): Jason Vas Dias
-# David Cantrell <dcantrell@redhat.com>
-#
-
-# What version of ISC DHCP is this?
-VER = $(shell grep DHCP_VERSION ../../includes/version.h | head -1 | cut -d '"' -f 2 | cut -d 'V' -f 2 | cut -d '-' -f 1)
-
-PROGS = libdhcp4client.a libdhcp4client-$(VER).so.0
-
-# NOTE: The ordering of these file lists is important! We are using the
-# whole program optimization features of gcc, so the order matters here.
-
-# Source files shared by all objects
-COMMON_SRCS = client_clparse.c client_dhclient.c common_alloc.c common_bpf.c \
- common_comapi.c common_conflex.c common_discover.c \
- common_dispatch.c common_dns.c common_ethernet.c \
- common_execute.c common_inet.c common_lpf.c common_memory.c \
- common_options.c common_packet.c common_parse.c common_print.c \
- common_socket.c common_tables.c common_tr.c common_tree.c \
- dst_dst_api.c dst_base64.c dst_hmac_link.c dst_md5_dgst.c \
- omapip_alloc.c omapip_array.c omapip_auth.c omapip_buffer.c \
- omapip_connection.c omapip_convert.c omapip_dispatch.c \
- omapip_errwarn.c omapip_handle.c omapip_hash.c \
- omapip_listener.c omapip_mrtrace.c omapip_result.c \
- omapip_support.c omapip_toisc.c omapip_trace.c
-
-# Source files for libdhcp4client.o
-CLIENT_SRCS = common_ctrace.c common_dlpi.c common_nit.c common_upf.c \
- dst_dst_support.c dst_prandom.c omapip_generic.c \
- omapip_message.c omapip_protocol.c
-
-# Source files for libres.o (minires)
-MINIRES_SRCS = minires_ns_date.c minires_ns_name.c minires_ns_parse.c \
- minires_ns_samedomain.c minires_ns_sign.c minires_ns_verify.c \
- minires_res_comp.c minires_res_findzonecut.c \
- minires_res_init.c minires_res_mkquery.c \
- minires_res_mkupdate.c minires_res_query.c minires_res_send.c \
- minires_res_sendsigned.c minires_res_update.c
-
-# ISC dhcp headers we need to copy to /usr/include/dhcp4client
-DHCP_HEADERS = dhcpd.h cdefs.h osdep.h arpa/nameser.h minires/minires.h \
- site.h cf/linux.h dhcp.h statement.h tree.h inet.h dhctoken.h \
- omapip/omapip_p.h failover.h ctrace.h minires/resolv.h \
- minires/res_update.h omapip/convert.h omapip/hash.h \
- omapip/trace.h
-
-HDRS = dhcp4client.h
-SRCS = $(COMMON_SRCS) $(CLIENT_SRCS)
-OBJS = $(SRCS:.c=.o)
-LOBJS = $(SRCS:.c=.lo)
-
-INCLUDES = -I$(TOP) -I$(TOP)/includes -I$(TOP)/dst -I.
-CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) \
- -DCLIENT_PATH=${CLIENT_PATH} -DLIBDHCP -DUSE_MD5
-
-all: $(PROGS)
-
-install: all
- install -p -m 0755 -D libdhcp4client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp4client-$(VER).so.0
- ln -sf libdhcp4client-$(VER).so.0 $(DESTDIR)/$(LIBDIR)/libdhcp4client.so
- install -p -m 0644 -D libdhcp4client.a $(DESTDIR)$(LIBDIR)/libdhcp4client.a
- install -p -m 0644 -D dhcp4client.h $(DESTDIR)$(INCDIR)/dhcp4client/dhcp4client.h
- for hdr in $(DHCP_HEADERS) ; do \
- install -p -m 0644 -D $(TOP)/includes/$${hdr} $(DESTDIR)$(INCDIR)/dhcp4client/$${hdr} ; \
- done
-
-depend:
- $(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
-
-clean:
- -rm -f $(OBJS) $(LOBJS)
-
-realclean: clean
- -rm -f $(PROG) *~ #*
-
-distclean: realclean
- -rm -f Makefile
-
-# This isn't the cleanest way to set up links, but I prefer this so I don't
-# need object targets for each subdirectory. The idea is simple. Since
-# libdhcp4client is a linked together wad of objects from across the source
-# tree, we change / to _ when linking source files here. Follow this example:
-#
-# We need to use client/dhclient.c, so we make this link:
-# rm -f client_dhclient.c
-# ln -s $(TOP)/client/dhclient.c client_dhclient.c
-#
-# Simple. Given the way the ISC build system works, this is the easiest to
-# maintain and least invasive.
-#
-# David Cantrell <dcantrell@redhat.com>
-links:
- @for target in $(SRCS); do \
- source="`echo $$target | sed -e 's|_|/|'`"; \
- if [ ! -b $$target ]; then \
- rm -f $$target; \
- fi; \
- ln -s $(TOP)/$$source $$target; \
- done; \
- for hdr in $(HDRS); do \
- if [ ! -b $$hdr ]; then \
- rm -f $$hdr; \
- fi; \
- ln -s $(TOP)/libdhcp4client/$$hdr $$hdr; \
- done
-
-# minires is difficult to build because it overrides things in common and dst,
-# so we just link with the already built libres.a since we need it all anyway
-libres.a:
- if [ ! -f ../minires/$@ ]; then \
- $(MAKE) -C ../minires; \
- fi; \
- ln ../minires/libres.a .; \
- $(AR) x libres.a
-
-%.lo: %.c
- $(CC) -o $@ $(CFLAGS) -fPIC -c $<
-
-# Create the libraries
-# minires/res_query.o contains an undefined symbol __h_errno_set, is not
-# used by any dhcp code, and is optimized out by the linker when producing
-# the dhclient executable or a shared library
-libdhcp4client.a: $(OBJS) libres.a
- $(AR) crus $@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
-
-libdhcp4client-$(VER).so.0: $(LOBJS) libres.a
- $(CC) $(LDFLAGS) $(CFLAGS) -shared -o $@ -Wl,-soname,$@ $(LOBJS) `$(AR) t libres.a | grep -v res_query.o`
-
-# Dependencies (semi-automatically-generated)
+++ /dev/null
-diff -up dhcp-4.0.0/configure.ac.libdhcp4client dhcp-4.0.0/configure.ac
---- dhcp-4.0.0/configure.ac.libdhcp4client 2007-12-14 08:24:56.000000000 -1000
-+++ dhcp-4.0.0/configure.ac 2008-01-22 17:04:28.000000000 -1000
-@@ -1,5 +1,32 @@
- AC_INIT([DHCP], [4.0.0], [dhcp-users@isc.org])
-
-+dnl Versioning
-+dnl (from glib's configure.in ...)
-+dnl Making releases:
-+dnl DHCP_MICRO_VERSION += 1;
-+dnl DHCP_INTERFACE_AGE += 1;
-+dnl DHCP_BINARY_AGE += 1;
-+dnl if any functions have been added, set DHCP_INTERFACE_AGE to 0.
-+dnl if backwards compatibility has been broken (e.g., functions removed,
-+dnl function signatures changed),
-+dnl set DHCP_BINARY_AGE and DHCP_INTERFACE_AGE to 0.
-+DHCP_MAJOR_VERSION=4
-+DHCP_MINOR_VERSION=0
-+DHCP_MICRO_VERSION=0
-+DHCP_INTERFACE_AGE=0
-+DHCP_BINARY_AGE=0
-+DHCP_VERSION_SUFFIX=
-+DHCP_VERSION=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION.$DHCP_MICRO_VERSION$DHCP_VERSION_SUFFIX
-+LT_RELEASE=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION
-+LT_CURRENT=`expr $DHCP_MICRO_VERSION - $DHCP_INTERFACE_AGE`
-+LT_REVISION=$DHCP_INTERFACE_AGE
-+LT_AGE=`expr $DHCP_BINARY_AGE - $DHCP_INTERFACE_AGE`
-+AC_SUBST(DHCP_VERSION)
-+AC_SUBST(LT_RELEASE)
-+AC_SUBST(LT_CURRENT)
-+AC_SUBST(LT_REVISION)
-+AC_SUBST(LT_AGE)
-+
- # we specify "foreign" to avoid having to have the GNU mandated files,
- # like AUTHORS, COPYING, and such
- AM_INIT_AUTOMAKE([foreign])
-@@ -20,7 +47,8 @@ if test "$GCC" = "yes"; then
- fi
- fi
-
--AC_PROG_RANLIB
-+AC_PROG_LIBTOOL
-+
- AC_CONFIG_HEADERS([includes/config.h])
-
- # we sometimes need to know byte order for building packets
-diff -up dhcp-4.0.0/omapip/Makefile.am.libdhcp4client dhcp-4.0.0/omapip/Makefile.am
---- dhcp-4.0.0/omapip/Makefile.am.libdhcp4client 2007-05-29 06:32:11.000000000 -1000
-+++ dhcp-4.0.0/omapip/Makefile.am 2008-01-22 17:04:28.000000000 -1000
-@@ -1,10 +1,18 @@
- lib_LIBRARIES = libomapi.a
-+noinst_LIBRARIES = libomapiLIBDHCP.a
- noinst_PROGRAMS = svtest
-
- libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \
- errwarn.c listener.c dispatch.c generic.c support.c \
- handle.c message.c convert.c hash.c auth.c inet_addr.c \
- array.c trace.c mrtrace.c toisc.c iscprint.c
-+
-+libomapiLIBDHCP_a_CFLAGS = -DLIBDHCP
-+libomapiLIBDHCP_a_SOURCES = alloc.c array.c auth.c buffer.c connection.c \
-+ convert.c dispatch.c errwarn.c handle.c hash.c listener.c \
-+ mrtrace.c result.c support.c toisc.c trace.c generic.c message.c \
-+ protocol.c
-+
- man_MANS = omapi.3
- EXTRA_DIST = $(man_MANS)
-
-diff -up dhcp-4.0.0/omapip/dispatch.c.libdhcp4client dhcp-4.0.0/omapip/dispatch.c
---- dhcp-4.0.0/omapip/dispatch.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
-+++ dhcp-4.0.0/omapip/dispatch.c 2008-01-22 17:04:28.000000000 -1000
-@@ -37,7 +37,7 @@
- #include <omapip/omapip_p.h>
- #include <sys/time.h>
-
--static omapi_io_object_t omapi_io_states;
-+omapi_io_object_t omapi_io_states;
- time_t cur_time;
-
- OMAPI_OBJECT_ALLOC (omapi_io,
-diff -up dhcp-4.0.0/omapip/errwarn.c.libdhcp4client dhcp-4.0.0/omapip/errwarn.c
---- dhcp-4.0.0/omapip/errwarn.c.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/omapip/errwarn.c 2008-01-22 17:04:28.000000000 -1000
-@@ -37,6 +37,11 @@
- #include <errno.h>
- #include <syslog.h>
-
-+#ifdef LIBDHCP
-+#include <isc-dhcp/libdhcp_control.h>
-+extern LIBDHCP_Control *libdhcp_control;
-+#endif
-+
- #ifdef DEBUG
- int log_perror = -1;
- #else
-@@ -46,7 +51,9 @@ int log_priority;
- void (*log_cleanup) (void);
-
- #define CVT_BUF_MAX 1023
-+#ifndef LIBDHCP
- static char mbuf [CVT_BUF_MAX + 1];
-+#endif
- static char fbuf [CVT_BUF_MAX + 1];
-
- /* Log an error message, then exit... */
-@@ -56,6 +63,16 @@ void log_fatal (const char * fmt, ... )
- va_list list;
-
- do_percentm (fbuf, fmt);
-+
-+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->eh)) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_FATAL, fbuf, list);
-+ va_end(list);
-+ libdhcp_control->finished = 1;
-+ return;
-+ }
-+#else
-
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
-@@ -89,6 +106,7 @@ void log_fatal (const char * fmt, ... )
- if (log_cleanup)
- (*log_cleanup) ();
- exit (1);
-+#endif
- }
-
- /* Log an error message... */
-@@ -99,6 +117,13 @@ int log_error (const char * fmt, ...)
-
- do_percentm (fbuf, fmt);
-
-+#ifdef LIBDHCP
-+ if (libdhcp_control && libdhcp_control->eh) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_ERR, fbuf, list);
-+ va_end(list);
-+ }
-+#else
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
- */
-@@ -114,7 +139,7 @@ int log_error (const char * fmt, ...)
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
- }
--
-+#endif
- return 0;
- }
-
-@@ -126,6 +151,13 @@ int log_info (const char *fmt, ...)
-
- do_percentm (fbuf, fmt);
-
-+#ifdef LIBDHCP
-+ if (libdhcp_control && libdhcp_control->eh) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_INFO, fbuf, list);
-+ va_end(list);
-+ }
-+#else
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
- */
-@@ -141,7 +173,7 @@ int log_info (const char *fmt, ...)
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
- }
--
-+#endif
- return 0;
- }
-
-@@ -152,7 +184,13 @@ int log_debug (const char *fmt, ...)
- va_list list;
-
- do_percentm (fbuf, fmt);
--
-+#ifdef LIBDHCP
-+ if (libdhcp_control && libdhcp_control->eh) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_DEBUG, fbuf, list);
-+ va_end(list);
-+ }
-+#else
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
- */
-@@ -168,7 +206,7 @@ int log_debug (const char *fmt, ...)
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
- }
--
-+#endif
- return 0;
- }
-
-diff -up dhcp-4.0.0/omapip/alloc.c.libdhcp4client dhcp-4.0.0/omapip/alloc.c
---- dhcp-4.0.0/omapip/alloc.c.libdhcp4client 2007-07-12 20:43:42.000000000 -1000
-+++ dhcp-4.0.0/omapip/alloc.c 2008-01-22 17:04:28.000000000 -1000
-@@ -37,6 +37,33 @@
-
- #include <omapip/omapip_p.h>
-
-+#ifdef LIBDHCP
-+/* OK, we need a quick and dirty way of freeing all memory used by libdhcp.
-+ All pointers will be stored in a glibc tree on alloc, and removed on free.
-+ This is not too expensive for light single-call library use.
-+*/
-+#include <search.h>
-+extern void tdestroy (void *root, void (*free_node)(void *nodep));
-+static void *all_pointers=0L;
-+static int ptr_comparator(const void *p1, const void *p2) {
-+ return ((p1 == p2) ? 0 : ((p1 > p2) ? 1 : -1));
-+}
-+
-+static void record_pointer(void *ptr) {
-+ tsearch(ptr, &(all_pointers), ptr_comparator);
-+}
-+
-+static void forget_pointer(void *ptr) {
-+ tdelete(ptr, &(all_pointers), ptr_comparator);
-+}
-+
-+void omapi_free_all_pointers(void) {
-+ if (all_pointers != NULL)
-+ tdestroy(all_pointers, free);
-+ all_pointers = NULL;
-+}
-+#endif
-+
- #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
- defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
- struct dmalloc_preamble *dmalloc_list;
-@@ -72,7 +99,9 @@ dmalloc(unsigned size, const char *file,
- return NULL;
-
- foo = malloc(len);
--
-+#ifdef LIBDHCP
-+ record_pointer(foo);
-+#endif
- if (!foo)
- return NULL;
- bar = (void *)(foo + DMDOFFSET);
-@@ -191,6 +220,9 @@ dfree(void *ptr, const char *file, int l
- 0, (unsigned char *)ptr + DMDOFFSET, 0, 1, RC_MALLOC);
- #endif
- free (ptr);
-+#ifdef LIBDHCP
-+ forget_pointer(ptr);
-+#endif
- }
-
- #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
-diff -up dhcp-4.0.0/dst/Makefile.am.libdhcp4client dhcp-4.0.0/dst/Makefile.am
---- dhcp-4.0.0/dst/Makefile.am.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/dst/Makefile.am 2008-01-22 17:04:28.000000000 -1000
-@@ -2,6 +2,8 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
-
- lib_LIBRARIES = libdst.a
-
-+noinst_LIBRARIES = libdstLIBDHCP.a
-+
- libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
- base64.c prandom.c
-
-@@ -10,4 +10,8 @@ libdst_a_SOURCES = dst_support.c dst_api
- libdstnomd5_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
- base64.c prandom.c
-
-+libdstLIBDHCP_a_CFLAGS = -DLIBDHCP
-+libdstLIBDHCP_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
-+ base64.c prandom.c
-+
- EXTRA_DIST = dst_internal.h md5.h md5_locl.h
-diff -up dhcp-4.0.0/dst/hmac_link.c.libdhcp4client dhcp-4.0.0/dst/hmac_link.c
---- dhcp-4.0.0/dst/hmac_link.c.libdhcp4client 2007-12-05 14:50:22.000000000 -1000
-+++ dhcp-4.0.0/dst/hmac_link.c 2008-01-22 17:04:28.000000000 -1000
-@@ -39,6 +39,10 @@ static const char rcsid[] = "$Header: /p
-
- #include "dst_internal.h"
-
-+#ifdef LIBDHCP
-+extern void* dmalloc(size_t,char *,int);
-+#endif
-+
- #ifdef USE_MD5
- # include "md5.h"
- # ifndef _MD5_H_
-@@ -87,7 +91,11 @@ dst_hmac_md5_sign(const int mode, DST_KE
- MD5_CTX *ctx = NULL;
-
- if (mode & SIG_MODE_INIT)
-+#ifdef LIBDHCP
-+ ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
-+#else
- ctx = (MD5_CTX *) malloc(sizeof(*ctx));
-+#endif
- else if (context)
- ctx = (MD5_CTX *) *context;
- if (ctx == NULL)
-@@ -154,7 +162,11 @@ dst_hmac_md5_verify(const int mode, DST_
- MD5_CTX *ctx = NULL;
-
- if (mode & SIG_MODE_INIT)
-+#ifdef LIBDHCP
-+ ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
-+#else
- ctx = (MD5_CTX *) malloc(sizeof(*ctx));
-+#endif
- else if (context)
- ctx = (MD5_CTX *) *context;
- if (ctx == NULL)
-@@ -218,8 +230,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, co
-
- if (dkey == NULL || key == NULL || keylen < 0)
- return (-1);
--
-+#ifdef LIBDHCP
-+ if ((hkey = (HMAC_Key *) dmalloc(sizeof(HMAC_Key),__FILE__,__LINE__)) == NULL)
-+#else
- if ((hkey = (HMAC_Key *) malloc(sizeof(HMAC_Key))) == NULL)
-+#endif
- return (-2);
-
- memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad));
-@@ -348,7 +363,11 @@ dst_hmac_md5_key_from_file_format(DST_KE
- if (eol == NULL)
- return (-4);
- len = eol - p;
-+#ifdef LIBDHCP
-+ tmp = dmalloc(len + 2,__FILE__,__LINE__);
-+#else
- tmp = malloc(len + 2);
-+#endif
- memcpy(tmp, p, len);
- *(tmp + len) = 0x0;
- key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /* see above */
-@@ -440,8 +459,11 @@ dst_hmac_md5_generate_key(DST_KEY *key,
- return(0);
-
- len = size > 64 ? 64 : size;
-+#ifdef LIBDHCP
-+ buff = dmalloc(len+8,__FILE__,__LINE__);
-+#else
- buff = malloc(len+8);
--
-+#endif
- n = dst_random(DST_RAND_SEMI, len, buff);
- n += dst_random(DST_RAND_KEY, len, buff);
- if (n <= len) { /* failed getting anything */
-@@ -464,7 +486,11 @@ dst_hmac_md5_init()
- {
- if (dst_t_func[KEY_HMAC_MD5] != NULL)
- return (1);
-+#ifdef LIBDHCP
-+ dst_t_func[KEY_HMAC_MD5] = dmalloc(sizeof(struct dst_func),__FILE__,__LINE__);
-+#else
- dst_t_func[KEY_HMAC_MD5] = malloc(sizeof(struct dst_func));
-+#endif
- if (dst_t_func[KEY_HMAC_MD5] == NULL)
- return (0);
- memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
-diff -up dhcp-4.0.0/common/Makefile.am.libdhcp4client dhcp-4.0.0/common/Makefile.am
---- dhcp-4.0.0/common/Makefile.am.libdhcp4client 2007-11-16 01:04:11.000000000 -1000
-+++ dhcp-4.0.0/common/Makefile.am 2008-01-22 17:04:28.000000000 -1000
-@@ -1,11 +1,17 @@
- AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"'
-
--noinst_LIBRARIES = libdhcp.a
-+noinst_LIBRARIES = libdhcp.a libdhcpLIBDHCP.a
- libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \
- dispatch.c dlpi.c dns.c ethernet.c execute.c fddi.c \
- icmp.c inet.c lpf.c memory.c nit.c options.c packet.c \
- parse.c print.c raw.c resolv.c socket.c tables.c tr.c \
- tree.c upf.c heap.c
-+libdhcpLIBDHCP_a_CFLAGS = -DLIBDHCP
-+libdhcpLIBDHCP_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c \
-+ discover.c dispatch.c dlpi.c dns.c ethernet.c \
-+ execute.c inet.c lpf.c memory.c nit.c options.c \
-+ packet.c parse.c print.c resolv.c socket.c \
-+ tables.c tr.c tree.c upf.c
- man_MANS = dhcp-eval.5 dhcp-options.5
- EXTRA_DIST = $(man_MANS)
-
-diff -up dhcp-4.0.0/common/discover.c.libdhcp4client dhcp-4.0.0/common/discover.c
---- dhcp-4.0.0/common/discover.c.libdhcp4client 2007-10-05 12:29:51.000000000 -1000
-+++ dhcp-4.0.0/common/discover.c 2008-01-22 17:04:28.000000000 -1000
-@@ -883,6 +883,10 @@ add_ipv6_addr_to_interface(struct interf
- register that interface with the network I/O software, figure out what
- subnet it's on, and add it to the list of interfaces. */
-
-+#ifdef LIBDHCP
-+int have_setup_fallback = 0;
-+#endif
-+
- void
- discover_interfaces(int state) {
- struct iface_conf_list ifaces;
-@@ -902,7 +906,9 @@ discover_interfaces(int state) {
- isc_result_t status;
- int wifcount = 0;
-
-+#ifndef LIBDHCP
- static int setup_fallback = 0;
-+#endif
-
- if (!begin_iface_scan(&ifaces)) {
- log_fatal("Can't get list of interfaces.");
-@@ -1242,10 +1248,17 @@ discover_interfaces(int state) {
- log_fatal ("Not configured to listen on any interfaces!");
- }
-
-+#ifdef LIBDHCP
-+ if ((local_family == AF_INET) && !have_setup_fallback) {
-+ have_setup_fallback = 1;
-+ maybe_setup_fallback ();
-+ }
-+#else
- if ((local_family == AF_INET) && !setup_fallback) {
- setup_fallback = 1;
- maybe_setup_fallback();
- }
-+#endif
-
- #if defined (F_SETFD)
- if (fallback_interface) {
-diff -up dhcp-4.0.0/common/tree.c.libdhcp4client dhcp-4.0.0/common/tree.c
---- dhcp-4.0.0/common/tree.c.libdhcp4client 2007-08-22 03:41:37.000000000 -1000
-+++ dhcp-4.0.0/common/tree.c 2008-01-22 17:04:28.000000000 -1000
-@@ -41,7 +41,7 @@
- # include <regex.h>
- #endif
-
--struct binding_scope *global_scope;
-+struct binding_scope __attribute__ ((visibility ("default"))) *global_scope;
-
- static int do_host_lookup PROTO ((struct data_string *,
- struct dns_host_entry *));
-@@ -2859,6 +2859,7 @@ int evaluate_numeric_expression (result,
- result of that evaluation. There should never be both an expression
- and a valid data_string. */
-
-+__attribute__ ((visibility ("default")))
- int evaluate_option_cache (result, packet, lease, client_state,
- in_options, cfg_options, scope, oc, file, line)
- struct data_string *result;
-diff -up dhcp-4.0.0/common/options.c.libdhcp4client dhcp-4.0.0/common/options.c
---- dhcp-4.0.0/common/options.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
-+++ dhcp-4.0.0/common/options.c 2008-01-22 17:04:28.000000000 -1000
-@@ -3392,6 +3392,7 @@ fqdn6_universe_decode(struct option_stat
- return 0;
- }
-
-+__attribute__ ((visibility ("default")))
- void option_space_foreach (struct packet *packet, struct lease *lease,
- struct client_state *client_state,
- struct option_state *in_options,
-diff -up dhcp-4.0.0/common/dispatch.c.libdhcp4client dhcp-4.0.0/common/dispatch.c
---- dhcp-4.0.0/common/dispatch.c.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/common/dispatch.c 2008-01-22 17:04:28.000000000 -1000
-@@ -34,8 +34,24 @@
-
- #include "dhcpd.h"
-
--struct timeout *timeouts;
--static struct timeout *free_timeouts;
-+struct timeout {
-+#ifndef LIBDHCP
-+ struct timeout *next;
-+#endif
-+ TIME when;
-+ void (*func) PROTO ((void *));
-+ void *what;
-+ tvref_t ref;
-+ tvunref_t unref;
-+};
-+
-+#ifdef LIBDHCP
-+static struct timeout *timeouts = NULL;
-+static int ntimeouts = 0;
-+#else
-+static struct timeout *timeouts = NULL;
-+static struct timeout *free_timeouts = NULL;
-+#endif
-
- void set_time(TIME t)
- {
-@@ -48,9 +64,41 @@ void set_time(TIME t)
-
- struct timeval *process_outstanding_timeouts (struct timeval *tvp)
- {
-+#ifdef LIBDHCP
-+ int i;
-+ struct timeout t = { 0 };
-+#endif
- /* Call any expired timeouts, and then if there's
- still a timeout registered, time out the select
- call then. */
-+#ifdef LIBDHCP
-+ if (!ntimeouts)
-+ return NULL;
-+
-+ for (i = 0; i < ntimeouts && timeouts[i].when <= cur_time;) {
-+ struct timeout *new_timeouts;
-+ size_t n;
-+
-+ memmove(&t, &timeouts[i], sizeof (t));
-+
-+ n = (ntimeouts - i - 1) * sizeof (t);
-+ memmove(&timeouts[i+1], &timeouts[i], n);
-+
-+ n = --ntimeouts * sizeof (t);
-+ new_timeouts = realloc(timeouts, n);
-+ /* XXX broken API, no way to return error here */
-+ if (new_timeouts || !n)
-+ timeouts = new_timeouts;
-+
-+ if (t.func)
-+ t.func(t.what);
-+ if (t.unref)
-+ t.unref(t.what, MDL);
-+ }
-+ if (tvp && ntimeouts) {
-+ tvp->tv_sec = timeouts[0].when;
-+ tvp->tv_usec = 0;
-+#else
- another:
- if (timeouts) {
- struct timeout *t;
-@@ -68,9 +116,15 @@ struct timeval *process_outstanding_time
- tvp -> tv_sec = timeouts -> when;
- tvp -> tv_usec = 0;
- }
-+#endif
- return tvp;
-+#ifdef LIBDHCP
-+ }
-+ return NULL;
-+#else
- } else
- return (struct timeval *)0;
-+#endif
- }
-
- /* Wait for packets to come in using select(). When one does, call
-@@ -99,13 +153,28 @@ void add_timeout (when, where, what, ref
- tvref_t ref;
- tvunref_t unref;
- {
-+#ifdef LIBDHCP
-+ struct timeout t = {
-+ .when = when,
-+ .func = where,
-+ .what = what,
-+ .ref = ref,
-+ .unref = unref
-+ };
-+ struct timeout *new_timeouts;
-+ int i, pos = 0;
-+#else
- struct timeout *t, *q;
-+#endif
-
- /* See if this timeout supersedes an existing timeout. */
-+#ifdef LIBDHCP
-+ for (i = 0; i < ntimeouts; i++) {
-+ struct timeout *q = &timeouts[i];
-+#else
- t = (struct timeout *)0;
- for (q = timeouts; q; q = q -> next) {
-- if ((where == NULL || q -> func == where) &&
-- q -> what == what) {
-+ if ((where == NULL || q -> func == where) && q -> what == what) {
- if (t)
- t -> next = q -> next;
- else
-@@ -114,7 +183,29 @@ void add_timeout (when, where, what, ref
- }
- t = q;
- }
-+#endif
-
-+#ifdef LIBDHCP
-+ /* If this one is already in the list with a different time,
-+ * remove it and re-add */
-+ if ((where == NULL || q->func == where) &&
-+ q->what == what) {
-+ size_t n = (--ntimeouts - i) * sizeof (*q);
-+ memmove(&t, q, sizeof (t));
-+
-+ if (n)
-+ memmove(&timeouts[i], &timeouts[i+1], n);
-+
-+ if (ntimeouts) {
-+ new_timeouts = realloc(timeouts, ntimeouts * sizeof (*q));
-+ /* XXX broken API, no way to return error here */
-+ if (new_timeouts)
-+ timeouts = new_timeouts;
-+ } else {
-+ timeouts = NULL;
-+ }
-+ add_timeout(when, where, what, ref, unref);
-+#else
- /* If we didn't supersede a timeout, allocate a timeout
- structure now. */
- if (!q) {
-@@ -123,7 +214,7 @@ void add_timeout (when, where, what, ref
- free_timeouts = q -> next;
- } else {
- q = ((struct timeout *)
-- dmalloc (sizeof (struct timeout), MDL));
-+ dmalloc (sizeof (struct timeout), MDL));
- if (!q)
- log_fatal ("add_timeout: no memory!");
- }
-@@ -153,22 +244,76 @@ void add_timeout (when, where, what, ref
- if (t -> next -> when > q -> when) {
- q -> next = t -> next;
- t -> next = q;
-+#endif
- return;
-+#ifdef LIBDHCP
-+ } else if (timeouts[i].when > when) {
-+ pos = i;
-+#endif
- }
- }
-
-+#ifdef LIBDHCP
-+ /* If we didn't supersede an existing timeout, then pos is set
-+ * to the timeout which will post after this one. Insert this
-+ * one before it. */
-+
-+ new_timeouts = realloc(timeouts, sizeof (t) * (ntimeouts+1));
-+ /* XXX broken API, no way to return error here */
-+ if (new_timeouts) {
-+ /* ntimeouts = 10
-+ * pos = 3;
-+ * n = 10-3 * sizeof (t) = 7 * sizeof (t)
-+ */
-+ size_t n = (ntimeouts - pos) * sizeof (t);
-+
-+ timeouts = new_timeouts;
-+ memmove(&timeouts[pos+1], &timeouts[pos], n);
-+ memmove(&timeouts[pos], &t, sizeof (t));
-+ ntimeouts++;
-+ }
-+#else
- /* End of list. */
- t -> next = q;
- q -> next = (struct timeout *)0;
-+#endif
- }
-
- void cancel_timeout (where, what)
- void (*where) PROTO ((void *));
- void *what;
- {
-+#ifdef LIBDHCP
-+ struct timeout t;
-+ int i = 0;
-+#else
- struct timeout *t, *q;
-+#endif
-
- /* Look for this timeout on the list, and unlink it if we find it. */
-+#ifdef LIBDHCP
-+ for (i = 0; i < ntimeouts; i++) {
-+ struct timeout *new_timeouts, *q = &timeouts[i];
-+
-+ if (q->func == where && q->what == what) {
-+ size_t n;
-+
-+ memmove(&t, q, sizeof (t));
-+
-+ n = (ntimeouts - i - 1) * sizeof (t);
-+ memmove(&timeouts[i+1], &timeouts[i], n);
-+
-+ n = --ntimeouts * sizeof (t);
-+ new_timeouts = realloc(timeouts, n);
-+ /* XXX broken API, no way to return error here */
-+ if (new_timeouts || !n)
-+ timeouts = new_timeouts;
-+
-+ if (t.unref)
-+ t.unref(t.what, MDL);
-+ }
-+ }
-+#else
- t = (struct timeout *)0;
- for (q = timeouts; q; q = q -> next) {
- if (q -> func == where && q -> what == what) {
-@@ -188,10 +333,15 @@ void cancel_timeout (where, what)
- q -> next = free_timeouts;
- free_timeouts = q;
- }
-+#endif
- }
-
- void cancel_all_timeouts ()
- {
-+#ifdef LIBDHCP
-+ cur_time = TIME_MAX;
-+ process_outstanding_timeouts(NULL);
-+#else
- struct timeout *t, *n;
- for (t = timeouts; t; t = n) {
- n = t -> next;
-@@ -200,13 +350,20 @@ void cancel_all_timeouts ()
- t -> next = free_timeouts;
- free_timeouts = t;
- }
-+#endif
- }
-
-+__attribute__ ((visibility ("default")))
- void relinquish_timeouts ()
- {
-+#ifdef LIBDHCP
-+ while (ntimeouts)
-+ cancel_timeout(timeouts[0].func, timeouts[0].what);
-+#else
- struct timeout *t, *n;
- for (t = free_timeouts; t; t = n) {
- n = t -> next;
- dfree (t, MDL);
- }
-+#endif
- }
-diff -up dhcp-4.0.0/common/alloc.c.libdhcp4client dhcp-4.0.0/common/alloc.c
---- dhcp-4.0.0/common/alloc.c.libdhcp4client 2007-10-23 14:54:11.000000000 -1000
-+++ dhcp-4.0.0/common/alloc.c 2008-01-22 17:04:28.000000000 -1000
-@@ -1004,7 +1004,11 @@ int executable_statement_reference (ptr,
- return 1;
- }
-
-+#ifdef LIBDHCP
-+struct packet *free_packets;
-+#else
- static struct packet *free_packets;
-+#endif
-
- #if defined (DEBUG_MEMORY_LEAKAGE) || \
- defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
-diff -up dhcp-4.0.0/includes/dhcpd.h.libdhcp4client dhcp-4.0.0/includes/dhcpd.h
---- dhcp-4.0.0/includes/dhcpd.h.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/includes/dhcpd.h 2008-01-22 17:05:02.000000000 -1000
-@@ -1199,14 +1199,6 @@ struct hardware_link {
-
- typedef void (*tvref_t)(void *, void *, const char *, int);
- typedef void (*tvunref_t)(void *, const char *, int);
--struct timeout {
-- struct timeout *next;
-- TIME when;
-- void (*func) PROTO ((void *));
-- void *what;
-- tvref_t ref;
-- tvunref_t unref;
--};
-
- struct protocol {
- struct protocol *next;
-@@ -1664,7 +1656,6 @@ extern const char *path_dhcpd_pid;
-
- extern int dhcp_max_agent_option_packet_length;
-
--int main(int, char **);
- void postconf_initialization(int);
- void postdb_startup(void);
- void cleanup PROTO ((void));
-@@ -2337,7 +2328,6 @@ extern void (*bootp_packet_handler) PROT
- extern void (*dhcpv6_packet_handler)(struct interface_info *,
- const char *, int,
- int, const struct iaddr *, isc_boolean_t);
--extern struct timeout *timeouts;
- extern omapi_object_type_t *dhcp_type_interface;
- #if defined (TRACING)
- extern trace_type_t *interface_trace;
-@@ -2392,6 +2382,10 @@ extern struct universe dhcpv6_universe;
- extern struct universe nwip_universe;
- extern struct universe fqdn_universe;
- extern struct universe vsio_universe;
-+extern struct universe vendor_class_universe;
-+extern struct universe vendor_universe;
-+extern struct universe isc_universe;
-+extern struct universe isc6_universe;
- extern int dhcp_option_default_priority_list [];
- extern int dhcp_option_default_priority_list_count;
- extern const char *hardware_types [256];
-diff -up dhcp-4.0.0/client/Makefile.am.libdhcp4client dhcp-4.0.0/client/Makefile.am
---- dhcp-4.0.0/client/Makefile.am.libdhcp4client 2007-12-12 09:23:42.000000000 -1000
-+++ dhcp-4.0.0/client/Makefile.am 2008-01-22 17:04:28.000000000 -1000
-@@ -1,10 +1,18 @@
- dist_sysconf_DATA = dhclient.conf
- sbin_PROGRAMS = dhclient
-+lib_LTLIBRARIES = libdhcp4client.la
- dhclient_SOURCES = clparse.c dhclient.c dhc6.c \
- scripts/bsdos scripts/freebsd scripts/linux scripts/netbsd \
- scripts/nextstep scripts/openbsd scripts/solaris
- dhclient_LDADD = ../common/libdhcp.a ../minires/libres.a \
- ../omapip/libomapi.a ../dst/libdst.a
-+libdhcp4client_la_CFLAGS = -DLIBDHCP -DLOCALSTATEDIR='"@localstatedir@"'
-+libdhcp4client_la_LDFLAGS = -version-info \
-+ $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-+ -release $(LT_RELEASE)
-+libdhcp4client_la_SOURCES = clparse.c dhclient.c dhc6.c
-+libdhcp4client_la_LIBADD = ../common/libdhcpLIBDHCP.a ../minires/libres.a \
-+ ../omapip/libomapiLIBDHCP.a ../dst/libdstLIBDHCP.a
- man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5
- EXTRA_DIST = $(man_MANS)
-
-diff -up dhcp-4.0.0/client/dhclient.c.libdhcp4client dhcp-4.0.0/client/dhclient.c
---- dhcp-4.0.0/client/dhclient.c.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.c 2008-01-22 17:05:47.000000000 -1000
-@@ -83,14 +83,50 @@ int nowait=0;
- char *mockup_relay = NULL;
- int bootp_broadcast_always = 0;
-
-+#ifdef LIBDHCP
-+FILE *leaseFile = NULL;
-+#endif
-+
- extern u_int32_t default_requested_options[];
-
- static void usage PROTO ((void));
-
- static isc_result_t write_duid(struct data_string *duid);
-
--int
--main(int argc, char **argv) {
-+#ifdef LIBDHCP
-+#include "isc-dhcp/libdhcp_control.h"
-+LIBDHCP_Control *libdhcp_control;
-+static void libdhcp_dispatch(void)
-+{
-+ struct timeval tv = { 0, 0 }, *tvp;
-+ isc_result_t status;
-+
-+ /* Wait for a packet, or a timeout, or libdhcp being finished */
-+ do {
-+ tvp = process_outstanding_timeouts(&tv);
-+ status = omapi_one_dispatch(0, tvp);
-+
-+ if (libdhcp_control && ((status == ISC_R_TIMEDOUT) || (libdhcp_control->timeout && (time(NULL) >= (libdhcp_control->timeout + libdhcp_control->now))))) {
-+ if (libdhcp_control->callback)
-+ libdhcp_control->callback(libdhcp_control, DHC_TIMEDOUT, NULL);
-+
-+ break;
-+ }
-+ } while ((status != ISC_R_TIMEDOUT) && ((!libdhcp_control) || (!(libdhcp_control->finished))));
-+}
-+
-+extern void omapi_free_all_pointers(void);
-+
-+__attribute__ ((visibility ("default")))
-+int dhcpv4_client (LIBDHCP_Control *libdhcp_ctl, int argc, char **argv,
-+ char **envp)
-+#else
-+int main(int argc, char **argv, char **envp)
-+#endif
-+{
-+#ifdef LIBDHCP
-+ libdhcp_control = libdhcp_ctl;
-+#endif
- int fd;
- int i;
- struct interface_info *ip;
-@@ -122,6 +158,7 @@ main(int argc, char **argv) {
- /* Initialize client globals. */
- memset(&default_duid, 0, sizeof(default_duid));
-
-+#ifndef LIBDHCP
- /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
- 2 (stderr) are open. To do this, we assume that when we
- open a file the lowest available file descriptor is used. */
-@@ -140,6 +177,7 @@ main(int argc, char **argv) {
- #if !(defined (DEBUG) || defined (__CYGWIN32__))
- setlogmask (LOG_UPTO (LOG_INFO));
- #endif
-+#endif
-
- /* Set up the OMAPI. */
- status = omapi_init ();
-@@ -485,8 +523,12 @@ main(int argc, char **argv) {
- }
- }
-
-+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
-+#endif
- write_client_pid_file();
-
-+#ifndef LIBDHCP
- if (!quiet) {
- log_info ("%s %s", message, PACKAGE_VERSION);
- log_info (copyright);
-@@ -497,6 +539,7 @@ main(int argc, char **argv) {
- log_perror = 0;
- quiet_interface_discovery = 1;
- }
-+#endif
-
- /* If we're given a relay agent address to insert, for testing
- purposes, figure out what it is. */
-@@ -702,11 +745,17 @@ main(int argc, char **argv) {
- arg_conf_len = 0;
- }
-
-+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE)) {
-+#endif
- /* Parse the lease database. */
- read_client_leases ();
-
- /* Rewrite the lease database... */
- rewrite_client_leases ();
-+#ifdef LIBDHCP
-+ }
-+#endif
-
- /* XXX */
- /* config_counter(&snd_counter, &rcv_counter); */
-@@ -725,7 +774,7 @@ main(int argc, char **argv) {
- if (!persist) {
- /* Nothing more to do. */
- log_info ("No broadcast interfaces found - exiting.");
-- exit (0);
-+ return (0);
- }
- } else if (!release_mode && !exit_mode) {
- /* Call the script with the list of interfaces. */
-@@ -863,6 +912,7 @@ main(int argc, char **argv) {
- dmalloc_outstanding = 0;
- #endif
-
-+#ifndef LIBDHCP
- /* If we're not supposed to wait before getting the address,
- don't. */
- if (nowait)
-@@ -875,6 +925,132 @@ main(int argc, char **argv) {
-
- /* Start dispatching packets and timeouts... */
- dispatch ();
-+#else
-+ if (libdhcp_control) {
-+ if (libdhcp_control->timeout)
-+ libdhcp_control->now = time(NULL);
-+ else
-+ libdhcp_control->now = 0;
-+ }
-+
-+ libdhcp_dispatch();
-+
-+ /* libdhcp is finished with us. */
-+
-+ /* close all file descriptors: */
-+ for (ip = interfaces; ip; ip = ip->next) {
-+ shutdown(ip->wfdesc, SHUT_RDWR);
-+ close(ip->wfdesc);
-+
-+ if (ip->rfdesc != ip->wfdesc)
-+ close(ip->rfdesc);
-+ }
-+
-+ if (fallback_interface != 0) {
-+ ip = fallback_interface;
-+ shutdown(ip->wfdesc, SHUT_RDWR);
-+ close(ip->wfdesc);
-+
-+ if (ip->rfdesc != ip->wfdesc)
-+ close(ip->rfdesc);
-+ }
-+
-+ if (leaseFile)
-+ fclose (leaseFile);
-+
-+ closelog();
-+
-+ char *current_pid_file = _PATH_DHCLIENT_PID;
-+
-+ /* Free ALL allocated memory: */
-+ omapi_free_all_pointers();
-+
-+ /* Re-Initialize globals: */
-+ client_env = 0;
-+ client_env_count = 0;
-+ default_lease_time = 43200;
-+
-+ dhcp_max_agent_option_packet_length = 0;
-+ iaddr_any.len = 4;
-+ memset(&(iaddr_any.iabuf[0]), '\0', 4);
-+ iaddr_broadcast.len = 4;
-+ memset(&(iaddr_broadcast.iabuf[0]), 0xff, 4);
-+ interfaces_requested = 0;
-+ leaseFile = 0;
-+
-+ libdhcp_control = 0;
-+
-+ local_port = 0;
-+ no_daemon = 0;
-+ nowait = 0;
-+ onetry = 0;
-+ quiet = 0;
-+ max_lease_time = 86400;
-+ path_dhclient_conf = _PATH_DHCLIENT_CONF;
-+ path_dhclient_db = _PATH_DHCLIENT_DB;
-+ path_dhclient_pid = _PATH_DHCLIENT_PID;
-+ strcpy(&(path_dhclient_script_array[0]), _PATH_DHCLIENT_SCRIPT);
-+ path_dhclient_script = path_dhclient_script_array;
-+ remote_port = 0;
-+ resolver_inited = 0;
-+ log_perror = 1;
-+ global_scope = NULL;
-+ root_group = NULL;
-+ group_name_hash = NULL;
-+ interfaces = NULL;
-+ dummy_interfaces = NULL;
-+ fallback_interface = NULL;
-+ extern int have_setup_fallback;
-+ have_setup_fallback = 0;
-+ quiet_interface_discovery = 1;
-+#ifndef LIBDHCP
-+ timeouts = NULL;
-+#endif
-+ dhcp_type_interface = NULL;
-+ interface_vector = NULL;
-+ interface_count = 0;
-+ interface_max = 0;
-+ name_servers = 0;
-+ domains = 0;
-+ dhcp_type_interface = NULL;
-+ dhcp_type_group = NULL;
-+ dhcp_type_shared_network = NULL;
-+ dhcp_type_control = NULL;
-+ memset(&dhcp_universe, '\0', sizeof(struct universe));
-+ memset(&dhcpv6_universe, '\0', sizeof(struct universe));
-+ memset(&nwip_universe, '\0', sizeof(struct universe));
-+ memset(&fqdn_universe, '\0', sizeof(struct universe));
-+ memset(&vendor_class_universe, '\0', sizeof(struct universe));
-+ memset(&vendor_universe, '\0', sizeof(struct universe));
-+ memset(&vsio_universe, '\0', sizeof(struct universe));
-+ memset(&isc_universe, '\0', sizeof(struct universe));
-+ memset(&isc6_universe, '\0', sizeof(struct universe));
-+ universe_hash = 0;
-+ universes = 0;
-+ universe_count = 0;
-+ universe_max = 0;
-+ config_universe = 0;
-+ extern struct hash_bucket *free_hash_buckets;
-+ free_hash_buckets = NULL;
-+ extern struct dhcp_packet *dhcp_free_list;
-+ dhcp_free_list = NULL;
-+ extern struct packet *packet_free_list;
-+ packet_free_list = NULL;
-+ extern struct binding_value *free_binding_values;
-+ free_binding_values = NULL;
-+ extern struct expression *free_expressions;
-+ free_expressions = NULL;
-+ extern struct option_cache *free_option_caches;
-+ free_option_caches = NULL;
-+ extern struct packet *free_packets;
-+ free_packets = NULL;
-+ extern pair free_pairs;
-+ free_pairs = NULL;
-+ extern omapi_io_object_t omapi_io_states;
-+ memset(&omapi_io_states, '\0', sizeof(omapi_io_states));
-+ dhcp_control_object = NULL;
-+ unlink(current_pid_file);
-+#endif
-
- /*NOTREACHED*/
- return 0;
-@@ -1270,7 +1446,20 @@ void dhcpack (packet)
- if (client -> new -> rebind < cur_time)
- client -> new -> rebind = TIME_MAX;
-
-+#ifdef LIBDHCP
-+ /* We need the server's siaddr for the 'bootServer'
-+ * pump option
-+ */
-+ u_int32_t set_siaddr = 0;
-+ set_siaddr = client->packet.siaddr.s_addr;
-+ client->packet.siaddr.s_addr = packet->raw->siaddr.s_addr;
-+#endif
-+
- bind_lease (client);
-+
-+#ifdef LIBDHCP
-+ client->packet.siaddr.s_addr = set_siaddr;
-+#endif
- }
-
- void bind_lease (client)
-@@ -1306,6 +1495,9 @@ void bind_lease (client)
- return;
- }
-
-+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
-+#endif
- /* Write out the new lease. */
- write_client_lease (client, client -> new, 0, 0);
-
-@@ -1398,10 +1590,12 @@ void state_stop (cpp)
- }
- }
-
-+#ifndef LIBDHCP
- int commit_leases ()
- {
- return 0;
- }
-+#endif
-
- int write_lease (lease)
- struct lease *lease;
-@@ -2074,6 +2268,10 @@ void state_panic (cpp)
- tell the shell script that we failed to allocate an address,
- and try again later. */
- if (onetry) {
-+#ifdef LIBDHCP
-+ script_init (client, "FAIL", (struct string_list *)0);
-+ return;
-+#endif
- if (!quiet)
- log_info ("Unable to obtain a lease on first try.%s",
- " Exiting.");
-@@ -2691,7 +2889,9 @@ void destroy_client_lease (lease)
- free_client_lease (lease, MDL);
- }
-
-+#ifndef LIBDHCP
- FILE *leaseFile = NULL;
-+#endif
- int leases_written = 0;
-
- void rewrite_client_leases ()
-@@ -3218,6 +3418,54 @@ void script_write_params (client, prefix
- int script_go (client)
- struct client_state *client;
- {
-+#ifdef LIBDHCP
-+ struct string_list *sp;
-+
-+ if (libdhcp_control && libdhcp_control->callback) {
-+ int dhcmsg;
-+ char *reason="";
-+
-+ for (sp = client->env; sp; sp = sp->next)
-+ if (strncmp(sp->string, "reason=", 7) == 0) {
-+ reason = sp->string + 7;
-+ break;
-+ }
-+
-+ if (strcmp(reason,"NBI") == 0)
-+ dhcmsg = DHC4_NBI;
-+ else if (strcmp(reason,"PREINIT") == 0)
-+ dhcmsg = DHC4_PREINIT;
-+ else if (strcmp(reason,"BOUND") == 0)
-+ dhcmsg = DHC4_BOUND;
-+ else if (strcmp(reason,"RENEW") == 0)
-+ dhcmsg = DHC4_RENEW;
-+ else if (strcmp(reason,"REBOOT") == 0)
-+ dhcmsg = DHC4_REBOOT;
-+ else if (strcmp(reason,"REBIND") == 0)
-+ dhcmsg = DHC4_REBIND;
-+ else if (strcmp(reason,"STOP") == 0)
-+ dhcmsg = DHC4_STOP;
-+ else if (strcmp(reason,"MEDIUM") == 0)
-+ dhcmsg = DHC4_MEDIUM;
-+ else if (strcmp(reason,"TIMEOUT") == 0)
-+ dhcmsg = DHC4_TIMEOUT;
-+ else if (strcmp(reason,"FAIL") == 0)
-+ dhcmsg = DHC4_FAIL;
-+ else if (strcmp(reason,"EXPIRE") == 0)
-+ dhcmsg = DHC4_EXPIRE;
-+ else if (strcmp(reason,"RELEASE") == 0)
-+ dhcmsg = DHC4_RELEASE;
-+ else
-+ dhcmsg = DHC4_NBI;
-+
-+ (*libdhcp_control->callback) (libdhcp_control, dhcmsg, client);
-+
-+ if (libdhcp_control->decline)
-+ return 1;
-+ }
-+
-+ return 0;
-+#else
- char *scriptName;
- char *argv [2];
- char **envp;
-@@ -3294,6 +3542,7 @@ int script_go (client)
- time(&cur_time);
- return (WIFEXITED (wstatus) ?
- WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
-+#endif
- }
-
- void client_envadd (struct client_state *client,
-@@ -3376,6 +3625,9 @@ void go_daemon ()
-
- /* Don't become a daemon if the user requested otherwise. */
- if (no_daemon) {
-+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
-+#endif
- write_client_pid_file ();
- return;
- }
-@@ -3385,6 +3637,10 @@ void go_daemon ()
- return;
- state = 1;
-
-+#ifdef LIBDHCP
-+ return;
-+#endif
-+
- /* Stop logging to stderr... */
- log_perror = 0;
-
+++ /dev/null
-Name: libdhcp4client
-Description: ISC DHCP IPv4 client library
-Version: @DHCP_VERSION@
-Libs: -ldhcp4client
-Cflags: -I/usr/include/dhcp4client
+++ /dev/null
-/* libdhcp_control.h
- *
- * DHCP client control API for libdhcp, a minimal interface to the
- * ISC dhcp IPv4 client libdhcp4client library,
- * and to the dhcpv6 DHCPv6 client libdhcp6client library.
- *
- * Each DHCP client library must include this file to be controlled
- * by libdhcp.
- *
- * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions of
- * the GNU General Public License v.2, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY expressed or implied, including the implied warranties of
- * MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
- * Public License for more details. You should have received a copy of the
- * GNU General Public License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
- * source code or documentation are not subject to the GNU General Public
- * License and may only be used or replicated with the express permission of
- * Red Hat, Inc.
- *
- * Red Hat Author(s): Jason Vas Dias
- * David Cantrell <dcantrell@redhat.com>
- */
-
-#ifndef LIBDHCP_CONTROL_H
-#define LIBDHCP_CONTROL_H
-
-#include <stdarg.h>
-#include <stdint.h>
-
-#define LOG_FATAL 8
-
-typedef enum dhcp_state_e {
- /* DHCPv4 client states
- * third callback arg will be a 'struct client_state *'
- */
- DHC4_NBI, /* failed: no broadcast interfaces found */
- DHC4_PREINIT, /* configuration started - bring the interface "UP" */
- DHC4_BOUND, /* lease obtained */
- DHC4_RENEW, /* lease renewed */
- DHC4_REBOOT, /* have valid lease, but now obtained a different one */
- DHC4_REBIND, /* new, different lease */
- DHC4_STOP, /* remove old lease */
- DHC4_MEDIUM, /* media selection begun */
- DHC4_TIMEOUT, /* timed out contacting DHCP server */
- DHC4_FAIL, /* all attempts to contact server timed out, sleeping */
- DHC4_EXPIRE, /* lease has expired, renewing */
- DHC4_RELEASE, /* releasing lease */
-
- /* This state raised by both clients: */
- DHC_TIMEDOUT, /* libdhcp_control timeout has been exceeded */
-
- /* DHCPv6 client states: */
- DHC6_BOUND, /* new lease obtained - arg is optinfo * */
- DHC6_REBIND, /* existing expired lease rebound - arg is optinfo * */
- DHC6_RELEASE /* existing lease expired - arg is dhcp6_iaidaddr*/
-} DHCP_State;
-
-struct libdhcp_control_s;
-
-/* ala syslog(3): LOG_EMERG=0 - LOG_DEBUG=7 (+ LOG_FATAL=8 : finished -> 1) */
-typedef int (*LIBDHCP_Error_Handler) (struct libdhcp_control_s *ctl,
- int priority, const char *fmt,
- va_list ap);
-
-/* The DHCP clients will call the users' callback on important state change
- * events, with the second arg set to the client DHCP_State, and the third
- * arg set to a client specific pointer as described below. */
-typedef int (*LIBDHCP_Callback) (struct libdhcp_control_s *control,
- enum dhcp_state_e, void*);
-
-typedef struct libdhcp_control_s {
- /* the DHCP clients' main loop calls this on state changes */
- LIBDHCP_Callback callback;
-
- /* LIBDHCP_Capability bits to enable */
- uint16_t capability;
-
- /* set to one to make clients exit their main loop */
- uint8_t finished;
-
- /* set to one to decline the lease (DHCPv4 only) */
- uint8_t decline;
-
- /* (timeout+now) == time after which clients MUST return */
- time_t timeout;
-
- /* clients set this to time(0) on entering main loop */
- time_t now;
-
- /* user data pointer */
- void *arg;
- LIBDHCP_Error_Handler eh;
-} LIBDHCP_Control;
-
-/* DHCP client "capabilities" */
-typedef enum libdhcp_capability_e {
- /* use / do not use persistent lease database files */
- DHCP_USE_LEASE_DATABASE = 1,
-
- /* use / do not use pid file */
- DHCP_USE_PID_FILE = 2,
-
- /*
- * DHCPv6 supports these capabilities in process,
- * while the DHCPv4 client will fork and exec the dhclient-script to
- * implement them if these bits are set - otherwise, if no bits are set,
- * the callback is called and the script is not run.
- */
- /* configure interfaces UP/DOWN as required */
- DHCP_CONFIGURE_INTERFACES = 4,
-
- /* configure interface addresses as required */
- DHCP_CONFIGURE_ADDRESSES = 8,
-
- /* configure routes as required */
- DHCP_CONFIGURE_ROUTES = 16,
-
- /* configure resolv.conf as required */
- DHCP_CONFIGURE_RESOLVER = 32,
-
- /* DHCPv6 only: */
- /* configure radvd.conf & restart radvd as required */
- DHCP_CONFIGURE_RADVD = 64,
-} LIBDHCP_Capability;
-
-#endif
-diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
---- dhcp-4.0.0/server/dhcpd.conf.5.manpages 2007-11-20 08:34:37.000000000 -1000
-+++ dhcp-4.0.0/server/dhcpd.conf.5 2008-01-02 11:26:38.000000000 -1000
-@@ -513,6 +513,9 @@ pool {
+diff -up dhcp-4.2.5b1/client/dhclient.conf.5.man dhcp-4.2.5b1/client/dhclient.conf.5
+--- dhcp-4.2.5b1/client/dhclient.conf.5.man 2012-12-05 02:17:38.000000000 +0100
++++ dhcp-4.2.5b1/client/dhclient.conf.5 2012-12-17 12:49:52.818451301 +0100
+@@ -202,7 +202,8 @@ responding to the client send the client
+ options. Only the option names should be specified in the request
+ statement - not option parameters. By default, the DHCPv4 client
+ requests the subnet-mask, broadcast-address, time-offset, routers,
+-domain-name, domain-name-servers and host-name options while the DHCPv6
++domain-search, domain-name, domain-name-servers, host-name, nis-domain,
++nis-servers, ntp-servers and interface-mtu options while the DHCPv6
+ client requests the dhcp6 name-servers and domain-search options. Note
+ that if you enter a \'request\' statement, you over-ride these defaults
+ and these options will not be requested.
+@@ -688,6 +689,17 @@ know the DHCP service(s) anycast MAC add
+ client. The \fIlink-type\fR and \fImac-address\fR parameters are configured
+ in a similar manner to the \fBhardware\fR statement.
+ .PP
++ \fBbootp-broadcast-always;\fR
++.PP
++The
++.B bootp-broadcast-always
++statement instructs dhclient to always set the bootp broadcast flag in
++request packets, so that servers will always broadcast replies.
++This is equivalent to supplying the dhclient -B argument, and has
++the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
++This option is provided as an extension to enable dhclient to work
++on IBM s390 Linux guests.
++.PP
+ .SH SAMPLE
+ The following configuration file is used on a laptop running NetBSD
+ 1.3. The laptop has an IP alias of 192.5.5.213, and has one
+@@ -713,7 +725,7 @@ interface "ep0" {
+ supersede domain-search "fugue.com", "rc.vix.com", "home.vix.com";
+ prepend domain-name-servers 127.0.0.1;
+ request subnet-mask, broadcast-address, time-offset, routers,
+- domain-name, domain-name-servers, host-name;
++ domain-search, domain-name, domain-name-servers, host-name;
+ require subnet-mask, domain-name-servers;
+ script "CLIENTBINDIR/dhclient-script";
+ media "media 10baseT/UTP", "media 10base2/BNC";
+diff -up dhcp-4.2.5b1/client/dhclient-script.8.man dhcp-4.2.5b1/client/dhclient-script.8
+--- dhcp-4.2.5b1/client/dhclient-script.8.man 2012-12-05 02:17:38.000000000 +0100
++++ dhcp-4.2.5b1/client/dhclient-script.8 2012-12-17 12:47:48.410130998 +0100
+@@ -48,7 +48,7 @@ customizations are needed, they should b
+ exit hooks provided (see HOOKS for details). These hooks will allow the
+ user to override the default behaviour of the client in creating a
+ .B /etc/resolv.conf
+-file.
++file, and to handle DHCP options not handled by default.
+ .PP
+ No standard client script exists for some operating systems, even though
+ the actual client may work, so a pioneering user may well need to create
+@@ -92,6 +92,26 @@ present. The
+ .B ETCDIR/dhclient-exit-hooks
+ script can modify the valid of exit_status to change the exit status
+ of dhclient-script.
++.PP
++Immediately after dhclient brings an interface UP with a new IP address,
++subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
++existence of an executable
++.B ETCDIR/dhclient-up-hooks
++script, and source it if found. This script can handle DHCP options in
++the environment that are not handled by default. A per-interface.
++.B ETCDIR/dhclient-${IF}-up-hooks
++script will override the generic script and be sourced when interface
++$IF has been brought up.
++.PP
++Immediately before dhclient brings an interface DOWN, removing its IP
++address, subnet mask, and routes, in the STOP/RELEASE states, it will
++check for the existence of an executable
++.B ETCDIR/dhclient-down-hooks
++script, and source it if found. This script can handle DHCP options in
++the environment that are not handled by default. A per-interface
++.B ETCDIR/dhclient-${IF}-down-hooks
++script will override the generic script and be sourced when interface
++$IF is about to be brought down.
+ .SH OPERATION
+ When dhclient needs to invoke the client configuration script, it
+ defines a set of variables in the environment, and then invokes
+diff -up dhcp-4.2.5b1/common/dhcp-options.5.man dhcp-4.2.5b1/common/dhcp-options.5
+--- dhcp-4.2.5b1/common/dhcp-options.5.man 2012-12-05 02:17:38.000000000 +0100
++++ dhcp-4.2.5b1/common/dhcp-options.5 2012-12-17 12:47:48.411130985 +0100
+@@ -914,6 +914,21 @@ classless IP routing - it does not inclu
+ classless IP routing is now the most widely deployed routing standard,
+ this option is virtually useless, and is not implemented by any of the
+ popular DHCP clients, for example the Microsoft DHCP client.
++.PP
++NOTE to @PRODUCTNAME@ dhclient users:
++.br
++dhclient-script interprets trailing 0 octets of the target as indicating
++the subnet class of the route, so for the following static-routes value:
++.br
++ option static-routes 172.0.0.0 172.16.2.254,
++.br
++ 192.168.0.0 192.168.2.254;
++.br
++dhclient-script will create routes:
++.br
++ 172/8 via 172.16.2.254 dev $interface
++.br
++ 192.168/16 via 192.168.2.254 dev $interface
+ .RE
+ .PP
+ .nf
+diff -up dhcp-4.2.5b1/server/dhcpd.conf.5.man dhcp-4.2.5b1/server/dhcpd.conf.5
+--- dhcp-4.2.5b1/server/dhcpd.conf.5.man 2012-12-05 02:17:39.000000000 +0100
++++ dhcp-4.2.5b1/server/dhcpd.conf.5 2012-12-17 12:50:52.117650542 +0100
+@@ -519,6 +519,9 @@ pool {
};
.fi
.PP
The server currently does very little sanity checking, so if you
configure it wrong, it will just fail in odd ways. I would recommend
therefore that you either do failover or don't do failover, but don't
-@@ -527,9 +530,9 @@ primary server might look like this:
+@@ -533,9 +536,9 @@ primary server might look like this:
failover peer "foo" {
primary;
address anthrax.rc.vix.com;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
-@@ -588,9 +591,7 @@ statement
- .B port \fIport-number\fR\fB;\fR
- .PP
- The \fBport\fR statement declares the TCP port on which the server
--should listen for connections from its failover peer. This statement
--may not currently be omitted, because the failover protocol does not
--yet have a reserved TCP port number.
-+should listen for connections from its failover peer.
- .RE
- .PP
- The
-@@ -602,10 +603,8 @@ statement
- .PP
- The \fBpeer port\fR statement declares the TCP port to which the
- server should connect to reach its failover peer for failover
--messages. This statement may not be omitted because the failover
--protocol does not yet have a reserved TCP port number. The port
--number declared in the \fBpeer port\fR statement may be the same as
--the port number declared in the \fBport\fR statement.
-+messages. The port number declared in the \fBpeer port\fR statement
-+may be the same as the port number declared in the \fBport\fR statement.
- .RE
- .PP
- The
-@@ -1272,7 +1271,7 @@ the zone containing PTR records - for IS
+@@ -1318,7 +1321,7 @@ the zone containing PTR records - for IS
.PP
.nf
key DHCP_UPDATER {
secret pRP5FapFoJ95JEL06sv4PQ==;
};
-@@ -1295,7 +1294,7 @@ dhcpd.conf file:
+@@ -1341,7 +1344,7 @@ dhcpd.conf file:
.PP
.nf
key DHCP_UPDATER {
secret pRP5FapFoJ95JEL06sv4PQ==;
};
-@@ -2433,7 +2432,8 @@ statement
+@@ -2555,7 +2558,8 @@ statement
The \fInext-server\fR statement is used to specify the host address of
the server from which the initial boot file (specified in the
- \fIfilename\fR statement) is to be loaded. \fIServer-name\fR should
+ \fIfilename\fR statement) is to be loaded. \fIServer-name\fR should
-be a numeric IP address or a domain name.
+be a numeric IP address or a domain name. If no \fInext-server\fR statement
+applies to a given client, the address 0.0.0.0 is used.
.RE
.PP
The
-diff -up dhcp-4.0.0/common/dhcp-options.5.manpages dhcp-4.0.0/common/dhcp-options.5
---- dhcp-4.0.0/common/dhcp-options.5.manpages 2007-09-17 07:52:01.000000000 -1000
-+++ dhcp-4.0.0/common/dhcp-options.5 2008-01-02 11:26:38.000000000 -1000
-@@ -896,6 +896,21 @@ classless IP routing - it does not inclu
- classless IP routing is now the most widely deployed routing standard,
- this option is virtually useless, and is not implemented by any of the
- popular DHCP clients, for example the Microsoft DHCP client.
-+.PP
-+NOTE to @PRODUCTNAME@ dhclient users:
-+.br
-+dhclient-script interprets trailing 0 octets of the target as indicating
-+the subnet class of the route, so for the following static-routes value:
-+.br
-+ option static-routes 172.0.0.0 172.16.2.254,
-+.br
-+ 192.168.0.0 192.168.2.254;
-+.br
-+dhclient-script will create routes:
-+.br
-+ 172/8 via 172.16.2.254 dev $interface
-+.br
-+ 192.168/16 via 192.168.2.254 dev $interface
- .RE
- .PP
- .nf
-diff -up dhcp-4.0.0/client/dhclient-script.8.manpages dhcp-4.0.0/client/dhclient-script.8
---- dhcp-4.0.0/client/dhclient-script.8.manpages 2006-02-24 13:16:27.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient-script.8 2008-01-02 11:26:38.000000000 -1000
-@@ -47,7 +47,7 @@ customizations are needed, they should b
- exit hooks provided (see HOOKS for details). These hooks will allow the
- user to override the default behaviour of the client in creating a
- .B /etc/resolv.conf
--file.
-+file, and to handle DHCP options not handled by default.
- .PP
- No standard client script exists for some operating systems, even though
- the actual client may work, so a pioneering user may well need to create
-@@ -91,6 +91,26 @@ present. The
- .B ETCDIR/dhclient-exit-hooks
- script can modify the valid of exit_status to change the exit status
- of dhclient-script.
-+.PP
-+Immediately after dhclient brings an interface UP with a new IP address,
-+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
-+existence of an executable
-+.B ETCDIR/dhclient-up-hooks
-+script, and source it if found. This script can handle DHCP options in
-+the environment that are not handled by default. A per-interface.
-+.B ETCDIR/dhclient-${IF}-up-hooks
-+script will override the generic script and be sourced when interface
-+$IF has been brought up.
-+.PP
-+Immediately before dhclient brings an interface DOWN, removing its IP
-+address, subnet mask, and routes, in the STOP/RELEASE states, it will
-+check for the existence of an executable
-+.B ETCDIR/dhclient-down-hooks
-+script, and source it if found. This script can handle DHCP options in
-+the environment that are not handled by default. A per-interface
-+.B ETCDIR/dhclient-${IF}-down-hooks
-+script will override the generic script and be sourced when interface
-+$IF is about to be brought down.
- .SH OPERATION
- When dhclient needs to invoke the client configuration script, it
- defines a set of variables in the environment, and then invokes
-diff -up dhcp-4.0.0/client/dhclient.conf.5.manpages dhcp-4.0.0/client/dhclient.conf.5
---- dhcp-4.0.0/client/dhclient.conf.5.manpages 2007-08-23 06:06:08.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.conf.5 2008-01-02 11:26:38.000000000 -1000
-@@ -186,9 +186,9 @@ responding to the client send the client
- options. Only the option names should be specified in the request
- statement - not option parameters. By default, the DHCP server
- requests the subnet-mask, broadcast-address, time-offset, routers,
--domain-name, domain-name-servers and host-name options. Note that if
--you enter a 'request' statement, you over-ride this default and these
--options will not be requested.
-+domain-name, domain-name-servers host-name, nis-domain, nis-servers,
-+and ntp-servers options. Note that if you enter a 'request' statement,
-+you over-ride this default and these options will not be requested.
- .PP
- In some cases, it may be desirable to send no parameter request list
- at all. To do this, simply write the request statement but specify
-@@ -626,6 +626,18 @@ database and will record the media type
- Whenever the client tries to renew the lease, it will use that same
- media type. The lease must expire before the client will go back to
- cycling through media types.
-+.PP
-+ \fBbootp-broadcast-always;\fR
-+.PP
-+The
-+.B bootp-broadcast-always
-+statement instructs dhclient to always set the bootp broadcast flag in
-+request packets, so that servers will always broadcast replies.
-+This is equivalent to supplying the dhclient -B argument, and has
-+the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
-+This option is provided as an extension to enable dhclient to work
-+on IBM s390 Linux guests.
-+.PP
- .SH SAMPLE
- The following configuration file is used on a laptop running NetBSD
- 1.3. The laptop has an IP alias of 192.5.5.213, and has one
-diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
---- dhcp-4.0.0/client/dhclient.8.manpages 2007-10-04 07:13:25.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.8 2008-01-02 11:26:38.000000000 -1000
-@@ -91,6 +91,33 @@ relay
- .B -w
- ]
- [
-+.B -B
-+]
-+[
-+.B -I
-+.I dhcp-client-identifier
-+]
-+[
-+.B -H
-+.I host-name
-+]
-+[
-+.B -F
-+.I fqdn.fqdn
-+]
-+[
-+.B -V
-+.I vendor-class-identifier
-+]
-+[
-+.B -R
-+.I request-option-list
-+]
-+[
-+.B -T
-+.I timeout
-+]
-+[
- .B -v
- ]
- [
-@@ -118,16 +145,6 @@ important details about the network to w
- the location of a default router, the location of a name server, and
- so on.
- .PP
--If given the -4 command line argument (default), dhclient will use the
--DHCPv4 protocol to obtain an IPv4 address and configuration parameters.
--.PP
--If given the -6 command line argument, dhclient will use the DHCPv6
--protocol to obtain whatever IPv6 addresses are available along with
--configuration parameters. Information-request is not yet supported.
--.PP
--If given the --version command line argument, dhclient will print its
--version number and exit.
--.PP
- On startup, dhclient reads the
- .IR dhclient.conf
- for configuration instructions. It then gets a list of all the
-@@ -181,67 +198,183 @@ file. If interfaces are specified in t
- only configure interfaces that are either specified in the
- configuration file or on the command line, and will ignore all other
- interfaces.
--.PP
--If the DHCP client should listen and transmit on a port other than the
--standard (port 68), the
--.B -p
--flag may used. It should be followed by the udp port number that
--dhclient should use. This is mostly useful for debugging purposes.
--If a different port is specified for the client to listen on and
--transmit on, the client will also use a different destination port -
--one less than the specified port.
--.PP
--The DHCP client normally transmits any protocol messages it sends
--before acquiring an IP address to, 255.255.255.255, the IP limited
--broadcast address. For debugging purposes, it may be useful to have
--the server transmit these messages to some other address. This can
--be specified with the
--.B -s
--flag, followed by the IP address or domain name of the destination.
--.PP
--For testing purposes, the giaddr field of all packets that the client
--sends can be set using the
--.B -g
--flag, followed by the IP address to send. This is only useful for testing,
--and should not be expected to work in any consistent or useful way.
--.PP
--The DHCP client will normally run in the foreground until it has
--configured an interface, and then will revert to running in the
--background. To run force dhclient to always run as a foreground
--process, the
--.B -d
--flag should be specified. This is useful when running the client
--under a debugger, or when running it out of inittab on System V
--systems.
--.PP
--The dhclient daemon creates its own environment when executing the
--dhclient-script to do the grunt work of interface configuration.
--To define extra environment variables and their values, use the
--.B -e
--flag, followed by the environment variable name and value assignment,
--just as one would assign a variable in a shell. Eg:
--.B -e
--.I IF_METRIC=1
--.PP
--The client normally prints no output during its startup sequence. It
--can be made to emit verbose messages displaying the startup sequence events
--until it has acquired an address by supplying the
--.B -v
--command line argument. In either case, the client logs messages using
--the
--.B syslog (3)
--facility. A
--.B -q
--command line argument is provided for backwards compatibility, but since
--dhclient is quiet by default, it has no effect.
--.PP
--The client normally doesn't release the current lease as it is not
--required by the DHCP protocol. Some cable ISPs require their clients
--to notify the server if they wish to release an assigned IP address.
-+.SH OPTIONS
-+.TP
-+.BI \-4
-+Use the DHCPv4 protocol to obtain an IPv4 address and configuration
-+parameters.
-+
-+.TP
-+.BI \-6
-+Use the DHCPv6 protocol to obtain whatever IPv6 addresses are available
-+along with configuration parameters. Information-request is not yet
-+supported.
-+
-+.TP
-+.BI \-p\ <port\ number>
-+The UDP port number the DHCP client should listen and transmit on. If
-+unspecified,
-+.B dhclient
-+uses the default port 68. This option is mostly useful for debugging
-+purposes. If a different port is specified for the client to listen and
-+transmit on, the client will also use a different destination port - one
-+less than the specified port.
-+
-+.TP
-+.BI \-d
-+Force
-+.B dhclient
-+to run as a foreground process. This is useful when running the client
-+under a debugger, or when running it out of inittab on System V systems.
-+
-+.TP
-+.BI \-e\ VAR=value
-+Define additional environment variables for the environment where
-+dhclient-script executes. You may specify multiple
-+.B \-e
-+options on the command line.
-+
-+.TP
-+.BI \-q
-+Suppress all terminal and log output except error messages.
-+
-+.TP
-+.BI \-1
-+Try one to get a lease. On failure, exit with code 2.
-+
-+.TP
-+.BI \-r
-+Tell
-+.B dhclient
-+to release the current lease it has from the server. This is not required
-+by the DHCP protocol, but some ISPs require their clients to notify the
-+server if they wish to release an assigned IP address.
-+
-+.TP
-+.BI \-lf\ <lease-file>
-+Path to the lease database file. If unspecified, the default
-+.B DBDIR/dhclient.leases
-+is used.
-+
-+.TP
-+.BI \-pf\ <pid-file>
-+Path to the process ID file. If unspecified, the default
-+.B RUNDIR/dhclient.pid
-+is used.
-+
-+.TP
-+.BI \-cf\ <config-file>
-+Path to the client configuration file. If unspecified, the default
-+.B ETCDIR/dhclient.conf
-+is used.
-+
-+.TP
-+.BI \-sf\ <script-file>
-+Path to the network configuration script invoked by
-+.B dhclient
-+when it gets a lease. If unspecified, the default
-+.B CLIENTBINDIR/dhclient-script
-+is used.
-+
-+.TP
-+.BI \-s\ <server>
-+Specifiy the server IP address or fully qualified domain name to transmit
-+DHCP protocol messages to. Normally,
-+.B dhclient
-+transmits these messages to 255.255.255.255 (the IP limited broadcast
-+address). Overriding this is mostly useful for debugging purposes.
-+
-+.TP
-+.BI \-g\ <relay>
-+Only for debugging. Set the giaddr field of all packets the client
-+sends to the IP address specified. This should not be expected to work
-+in any consistent or useful way.
-+
-+.TP
-+.BI \-n
-+Do not configure any interfaces. Most useful combined with the
-+.B -w
-+option.
-+
-+.TP
-+.BI \-nw
-+Become a daemon process immediately (nowait) rather than waiting until an IP
-+address has been acquired.
-+
-+.TP
-+.BI \-w
-+Keep running even if no network interfaces are found. The
-+.B omshell
-+program can be used to notify the client when a network interface has been
-+added or removed so it can attempt to configure an IP address on that
-+interface.
-+
-+.TP
-+.BI \-B
-+Set the BOOTP broadcast flag in request packets so servers will always
-+broadcast replies.
-+
-+.TP
-+.BI \-I\ <dhcp-client-identifier>
-+Specify the dhcp-client-identifier option to send to the DHCP server.
-+
-+.TP
-+.BI \-H\ <host-name>
-+Specify the host-name option to send to the DHCP server. The host-name
-+string only contains the client's hostname prefix, to which the server will
-+append the ddns-domainname or domain-name options, if any, to derive the
-+fully qualified domain name of the client. The
-+.B -H
-+option cannot be used with the
-+.B -F
-+option.
-+
-+.TP
-+.BI \-F\ <fqdn.fqdn>
-+Specify the fqdn.fqdn option to send to the DHCP server. This option cannot
-+be used with the
-+.B -H
-+option. The fqdn.fqdn option must specify the complete domain name of the
-+client host, which the server may use for dynamic DNS updates.
-+
-+.TP
-+.BI \-V\ <vendor-class-identifier>
-+Specify the vendor-class-identifier option to send to the DHCP server.
-+
-+.TP
-+.BI \-R\ <option>[,<option>...]
-+Specify the list of options the client is to request from the server. The
-+option list must be a single string consisting of option names separated
-+by at least one command and optional space characters. The default option
-+list is:
-+
-+.BR
-+ subnet-mask, broadcast-address, time-offset, routers,
-+.BR
-+ domain-name, domain-name-servers, host-name, nis-domain,
-+.BR
-+ nis-servers, ntp-servers
-+
- The
--.B -r
--flag explicitly releases the current lease, and once the lease has been
--released, the client exits.
-+.B -R
-+option does not append options to the default request, it overrides the
-+default request list. Keep this in mind if you want to request an
-+additional option besides the default request list. You will have to
-+specify all option names for the
-+.B -R
-+parameter.
-+
-+.TP
-+.BI \-T\ <timeout>
-+Specify the time after which
-+.B dhclient
-+will decide that no DHCP servers can be contacted when no responses have been
-+received.
-+
-+.TP
-+.BI \-v
-+Enable verbose log messages.
-+
- .PP
- If the client is killed by a signal (for example at shutdown or reboot)
- it won't execute the
-@@ -253,57 +386,7 @@ or
- it will execute
- .B dhclient-script (8)
- at shutdown with the specific reason for calling the script set.
--.PP
--The
--.B -1
--flag will cause dhclient to try once to get a lease. If it fails, dhclient
--exits with exit code two.
--.PP
--The DHCP client normally gets its configuration information from
--.B ETCDIR/dhclient.conf,
--its lease database from
--.B DBDIR/dhclient.leases,
--stores its process ID in a file called
--.B RUNDIR/dhclient.pid,
--and configures the network interface using
--.B CLIENTBINDIR/dhclient-script
--To specify different names and/or locations for these files, use the
--.B -cf,
--.B -lf,
--.B -pf
--and
--.B -sf
--flags, respectively, followed by the name of the file. This can be
--particularly useful if, for example,
--.B DBDIR
--or
--.B RUNDIR
--has not yet been mounted when the DHCP client is started.
--.PP
--The DHCP client normally exits if it isn't able to identify any
--network interfaces to configure. On laptop computers and other
--computers with hot-swappable I/O buses, it is possible that a
--broadcast interface may be added after system startup. The
--.B -w
--flag can be used to cause the client not to exit when it doesn't find
--any such interfaces. The
--.B omshell (1)
--program can then be used to notify the client when a network interface
--has been added or removed, so that the client can attempt to configure an IP
--address on that interface.
--.PP
--The DHCP client can be directed not to attempt to configure any interfaces
--using the
--.B -n
--flag. This is most likely to be useful in combination with the
--.B -w
--flag.
--.PP
--The client can also be instructed to become a daemon immediately, rather
--than waiting until it has acquired an IP address. This can be done by
--supplying the
--.B -nw
--flag.
-+
- .SH CONFIGURATION
- The syntax of the dhclient.conf(5) file is discussed separately.
- .SH OMAPI
-diff -up dhcp-4.0.0/common/conflex.c.options dhcp-4.0.0/common/conflex.c
---- dhcp-4.0.0/common/conflex.c.options 2007-12-29 11:13:51.000000000 -1000
-+++ dhcp-4.0.0/common/conflex.c 2007-12-29 11:13:51.000000000 -1000
-@@ -769,6 +769,8 @@ intern(char *atom, enum dhcp_token dfv)
- return BALANCE;
- if (!strcasecmp (atom + 1, "ound"))
- return BOUND;
-+ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
-+ return BOOTP_BROADCAST_ALWAYS;
- break;
- case 'c':
- if (!strcasecmp (atom + 1, "ase"))
-diff -up dhcp-4.0.0/includes/dhcpd.h.options dhcp-4.0.0/includes/dhcpd.h
---- dhcp-4.0.0/includes/dhcpd.h.options 2007-12-29 11:13:51.000000000 -1000
-+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 11:13:51.000000000 -1000
-@@ -1055,6 +1055,9 @@ struct client_config {
- int do_forward_update; /* If nonzero, and if we have the
- information we need, update the
- A record for the address we get. */
-+
-+ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
-+ flag in requests */
- };
+diff -up dhcp-4.2.1b1/client/dhclient.8.man dhcp-4.2.1b1/client/dhclient.8
+--- dhcp-4.2.1b1/client/dhclient.8.man 2010-07-14 22:09:34.000000000 +0200
++++ dhcp-4.2.1b1/client/dhclient.8 2011-01-27 18:19:07.000000000 +0100
+@@ -115,6 +115,33 @@ dhclient - Dynamic Host Configuration Pr
+ .B -w
+ ]
+ [
++.B -B
++]
++[
++.B -I
++.I dhcp-client-identifier
++]
++[
++.B -H
++.I host-name
++]
++[
++.B -F
++.I fqdn.fqdn
++]
++[
++.B -V
++.I vendor-class-identifier
++]
++[
++.B -R
++.I request-option-list
++]
++[
++.B -timeout
++.I timeout
++]
++[
+ .B -v
+ ]
+ [
+@@ -264,6 +291,69 @@ not to exit when it doesn't find any suc
+ program can then be used to notify the client when a network interface
+ has been added or removed, so that the client can attempt to configure an IP
+ address on that interface.
++
++.TP
++.BI \-B
++Set the BOOTP broadcast flag in request packets so servers will always
++broadcast replies.
++
++.TP
++.BI \-I\ <dhcp-client-identifier>
++Specify the dhcp-client-identifier option to send to the DHCP server.
++
++.TP
++.BI \-H\ <host-name>
++Specify the host-name option to send to the DHCP server. The host-name
++string only contains the client's hostname prefix, to which the server will
++append the ddns-domainname or domain-name options, if any, to derive the
++fully qualified domain name of the client. The
++.B -H
++option cannot be used with the
++.B -F
++option.
++
++.TP
++.BI \-F\ <fqdn.fqdn>
++Specify the fqdn.fqdn option to send to the DHCP server. This option cannot
++be used with the
++.B -H
++option. The fqdn.fqdn option must specify the complete domain name of the
++client host, which the server may use for dynamic DNS updates.
++
++.TP
++.BI \-V\ <vendor-class-identifier>
++Specify the vendor-class-identifier option to send to the DHCP server.
++
++.TP
++.BI \-R\ <option>[,<option>...]
++Specify the list of options the client is to request from the server. The
++option list must be a single string consisting of option names separated
++by at least one command and optional space characters. The default option
++list is:
++
++.BR
++ subnet-mask, broadcast-address, time-offset, routers,
++.BR
++ domain-search, domain-name, domain-name-servers, host-name,
++.BR
++ nis-domain, nis-servers, ntp-servers, interface-mtu
++
++.TP
++.B -R
++option does not append options to the default request, it overrides the
++default request list. Keep this in mind if you want to request an
++additional option besides the default request list. You will have to
++specify all option names for the
++.B -R
++parameter.
++
++.TP
++.BI \-timeout\ <timeout>
++Specify the time after which
++.B dhclient
++will decide that no DHCP servers can be contacted when no responses have been
++received.
++
+ .TP
+ .BI \-n
+ Do not configure any interfaces. This is most likely to be useful in
+diff -up dhcp-4.2.4-P2/client/clparse.c.options dhcp-4.2.4-P2/client/clparse.c
+--- dhcp-4.2.4-P2/client/clparse.c.options 2012-08-24 21:11:21.000000000 +0200
++++ dhcp-4.2.4-P2/client/clparse.c 2012-09-26 10:34:27.140049896 +0200
+@@ -154,6 +154,7 @@ isc_result_t read_client_conf ()
+ /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
+ */
+ top_level_config.requested_lease = 7200;
++ top_level_config.bootp_broadcast_always = 0;
- /* Per-interface state used in the dhcp client... */
-diff -up dhcp-4.0.0/includes/dhctoken.h.options dhcp-4.0.0/includes/dhctoken.h
---- dhcp-4.0.0/includes/dhctoken.h.options 2007-10-31 09:13:33.000000000 -1000
-+++ dhcp-4.0.0/includes/dhctoken.h 2007-12-29 11:13:51.000000000 -1000
-@@ -345,7 +345,8 @@ enum dhcp_token {
- WHITESPACE = 649,
- TOKEN_ALSO = 650,
- AFTER = 651,
-- CONFLICT_DONE = 660
-+ CONFLICT_DONE = 660,
-+ BOOTP_BROADCAST_ALWAYS = 652
- };
+ group_allocate (&top_level_config.on_receipt, MDL);
+ if (!top_level_config.on_receipt)
+@@ -320,7 +321,8 @@ void read_client_leases ()
+ interface-declaration |
+ LEASE client-lease-statement |
+ ALIAS client-lease-statement |
+- KEY key-definition */
++ KEY key-definition |
++ BOOTP_BROADCAST_ALWAYS */
- #define is_identifier(x) ((x) >= FIRST_TOKEN && \
-diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
---- dhcp-4.0.0/client/dhclient.c.options 2007-11-30 11:51:42.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.c 2007-12-29 11:14:15.000000000 -1000
-@@ -37,6 +37,12 @@
- #include <sys/wait.h>
+ void parse_client_statement (cfile, ip, config)
+ struct parse *cfile;
+@@ -739,6 +741,12 @@ void parse_client_statement (cfile, ip,
+ parse_reject_statement (cfile, config);
+ return;
+
++ case BOOTP_BROADCAST_ALWAYS:
++ token = next_token(&val, (unsigned*)0, cfile);
++ config -> bootp_broadcast_always = 1;
++ parse_semi (cfile);
++ return;
++
+ default:
+ lose = 0;
+ stmt = (struct executable_statement *)0;
+diff -up dhcp-4.2.4-P2/client/dhclient.c.options dhcp-4.2.4-P2/client/dhclient.c
+--- dhcp-4.2.4-P2/client/dhclient.c.options 2012-08-28 04:13:03.000000000 +0200
++++ dhcp-4.2.4-P2/client/dhclient.c 2012-09-26 10:36:10.396967531 +0200
+@@ -39,6 +39,12 @@
#include <limits.h>
+ #include <dns/result.h>
+/*
+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
TIME default_lease_time = 43200; /* 12 hours... */
TIME max_lease_time = 86400; /* 24 hours... */
-@@ -75,6 +81,9 @@ int onetry=0;
- int quiet=1;
- int nowait=0;
+@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute
+ int wanted_ia_ta = 0;
+ int wanted_ia_pd = 0;
char *mockup_relay = NULL;
+int bootp_broadcast_always = 0;
+
+extern u_int32_t default_requested_options[];
- static void usage PROTO ((void));
+ void run_stateless(int exit_mode);
-@@ -100,6 +109,15 @@ main(int argc, char **argv) {
- int no_dhclient_script = 0;
+@@ -123,6 +132,15 @@ main(int argc, char **argv) {
int local_family_set = 0;
+ #endif /* DHCPv6 */
char *s;
+ char *dhcp_client_identifier_arg = NULL;
+ char *dhcp_host_name_arg = NULL;
/* Initialize client globals. */
memset(&default_duid, 0, sizeof(default_duid));
-@@ -224,6 +242,88 @@ main(int argc, char **argv) {
- } else if (!strcmp (argv [i], "--version")) {
- log_info ("isc-dhclient-%s", PACKAGE_VERSION);
- exit (0);
-+ } else if (!strcmp (argv [i], "-I")) {
+@@ -310,6 +328,88 @@ main(int argc, char **argv) {
+ } else if (!strcmp(argv[i], "--version")) {
+ log_info("isc-dhclient-%s", PACKAGE_VERSION);
+ exit(0);
++ } else if (!strcmp(argv[i], "-I")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage ();
-+ return EXIT_FAILURE;
++ usage();
++ exit(1);
+ }
+
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
+ dhcp_client_identifier_arg = argv[i];
-+ } else if (!strcmp (argv [i], "-B")) {
++ } else if (!strcmp(argv[i], "-B")) {
+ bootp_broadcast_always = 1;
-+ } else if (!strcmp (argv [i], "-H")) {
++ } else if (!strcmp(argv[i], "-H")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage ();
-+ return EXIT_FAILURE;
++ usage();
++ exit(1);
+ }
+
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
+ }
+
+ dhcp_host_name_arg = argv[i];
-+ } else if (!strcmp (argv [i], "-F")) {
++ } else if (!strcmp(argv[i], "-F")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage ();
-+ return EXIT_FAILURE;
++ usage();
++ exit(1);
+ }
+
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
+ }
+
+ dhcp_fqdn_arg = argv[i];
-+ } else if (!strcmp (argv [i], "-T")) {
++ } else if (!strcmp(argv[i], "-timeout")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage ();
-+ return EXIT_FAILURE;
++ usage();
++ exit(1);
+ }
+
+ if ((timeout_arg = atoi(argv[i])) <= 0) {
-+ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
++ log_error("timeout option must be > 0 - bad value: %s",argv[i]);
+ exit(1);
+ }
-+ } else if (!strcmp (argv [i], "-V")) {
++ } else if (!strcmp(argv[i], "-V")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage ();
-+ return EXIT_FAILURE;
++ usage();
++ exit(1);
+ }
+
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
+ dhcp_vendor_class_identifier_arg = argv[i];
-+ } else if (!strcmp (argv [i], "-R")) {
++ } else if (!strcmp(argv[i], "-R")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage ();
-+ return EXIT_FAILURE;
++ usage();
++ exit(1);
+ }
+
-+ dhclient_request_options=argv[i];
- } else if (argv [i][0] == '-') {
- usage ();
- } else {
-@@ -370,6 +470,166 @@ main(int argc, char **argv) {
++ dhclient_request_options = argv[i];
+ } else if (argv[i][0] == '-') {
+ usage();
+ } else if (interfaces_requested < 0) {
+@@ -484,6 +584,156 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */
- read_client_conf ();
+ read_client_conf();
+ /* Parse any extra command line configuration arguments: */
+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
+ } else {
+ char *last_arg_conf = arg_conf;
+ arg_conf = NULL;
-+ arg_conf_len = asprintf( &arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
+
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
+ log_fatal("Unable to send -H option host-name");
+ } else {
+ char *last_arg_conf = arg_conf;
+ arg_conf = NULL;
-+ arg_conf_len = asprintf( &arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
+
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
+ log_fatal("Unable to send -F option fqdn.fqdn");
+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
+
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to process -T timeout argument");
++ log_fatal("Unable to process -timeout timeout argument");
+ } else {
+ char *last_arg_conf = arg_conf;
+ arg_conf = NULL;
-+ arg_conf_len = asprintf( &arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
++ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
+
+ if ((arg_conf == 0) || (arg_conf_len == 0))
-+ log_fatal("Unable to process -T timeout argument");
++ log_fatal("Unable to process -timeout timeout argument");
+
+ free(last_arg_conf);
+ }
+ if (arg_conf_len == 0)
+ if ((arg_conf_len = strlen(arg_conf)) == 0)
+ /* huh ? cannot happen ! */
-+ log_fatal("Unable to process -I/-H/-F/-T/-V/-R configuration arguments");
++ log_fatal("Unable to process -I/-H/-F/-timeout/-V/-R configuration arguments");
+
+ /* parse the extra dhclient.conf configuration arguments
+ * into top level config: */
+ const char *val = NULL;
+ int token;
+
-+ status = new_parse (&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-T/-V/-R configuration arguments", 0);
++ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
+
+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
-+ log_fatal("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
++ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
+ /* more detailed parse failures will be logged */
+
+ do {
-+ token = peek_token (&val, (unsigned *)0, cfile);
++ token = peek_token(&val, (unsigned *)0, cfile);
+ if (token == END_OF_FILE)
+ break;
+
-+ parse_client_statement (cfile, (struct interface_info *)0, &top_level_config);
++ parse_client_statement(cfile, (struct interface_info *)0, &top_level_config);
+ } while (1);
+
+ if (cfile -> warnings_occurred)
-+ log_fatal ("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
-+ end_parse (&cfile);
++ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
++ end_parse(&cfile);
+
+ if (timeout_arg) {
+ /* we just set the toplevel timeout, but per-client
-+ * timeouts may still be at defaults. Also, it makes no
-+ * sense having the reboot_timeout or backoff_cutoff
-+ * greater than the timeout:
++ * timeouts may still be at defaults.
+ */
-+ if ((top_level_config.backoff_cutoff == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
-+ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
-+
-+ for (ip = interfaces; ip; ip = ip -> next) {
++ for (ip=interfaces; ip; ip = ip->next) {
+ if (ip->client->config->timeout == 60)
+ ip->client->config->timeout = timeout_arg;
-+
-+ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
-+ ip->client->config->reboot_timeout = ip->client->config->timeout;
-+ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
-+ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
+ }
+ }
+
+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
-+ for (ip = interfaces; ip; ip = ip -> next) {
++ for (ip=interfaces; ip; ip = ip->next) {
+ if (ip->client->config->requested_options == default_requested_options)
+ ip->client->config->requested_options = top_level_config.requested_options;
+ }
+ }
+
/* Parse the lease database. */
- read_client_leases ();
+ read_client_leases();
-@@ -2105,7 +2365,8 @@ void make_discover (client, lease)
+@@ -715,6 +965,10 @@ static void usage()
+ " [-s server-addr] [-cf config-file] "
+ "[-lf lease-file]\n"
+ " [-pf pid-file] [--no-pid] [-e VAR=val]\n"
++ " [-I <dhcp-client-identifier>] [-B]\n"
++ " [-H <host-name> | -F <fqdn.fqdn>] [-timeout <timeout>]\n"
++ " [-V <vendor-class-identifier>]\n"
++ " [-R <request option list>]\n"
+ " [-sf script-file] [interface]");
+ }
+
+@@ -2421,7 +2675,8 @@ void make_discover (client, lease)
client -> packet.xid = random ();
client -> packet.secs = 0; /* filled in by send_discover. */
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2189,7 +2450,9 @@ void make_request (client, lease)
+@@ -2505,7 +2760,9 @@ void make_request (client, lease)
} else {
memset (&client -> packet.ciaddr, 0,
sizeof client -> packet.ciaddr);
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2248,7 +2511,8 @@ void make_decline (client, lease)
+@@ -2567,7 +2824,8 @@ void make_decline (client, lease)
client -> packet.hops = 0;
client -> packet.xid = client -> xid;
client -> packet.secs = 0; /* Filled in by send_request. */
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
-diff -up dhcp-4.0.0/client/clparse.c.options dhcp-4.0.0/client/clparse.c
---- dhcp-4.0.0/client/clparse.c.options 2007-12-08 09:36:00.000000000 -1000
-+++ dhcp-4.0.0/client/clparse.c 2007-12-29 11:13:51.000000000 -1000
-@@ -132,6 +132,7 @@ isc_result_t read_client_conf ()
- /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
- */
- top_level_config.requested_lease = 7200;
-+ top_level_config.bootp_broadcast_always = 0;
-
- group_allocate (&top_level_config.on_receipt, MDL);
- if (!top_level_config.on_receipt)
-@@ -295,7 +296,8 @@ void read_client_leases ()
- interface-declaration |
- LEASE client-lease-statement |
- ALIAS client-lease-statement |
-- KEY key-definition */
-+ KEY key-definition |
-+ BOOTP_BROADCAST_ALWAYS */
+diff -up dhcp-4.2.4-P2/common/conflex.c.options dhcp-4.2.4-P2/common/conflex.c
+--- dhcp-4.2.4-P2/common/conflex.c.options 2012-08-28 04:13:03.000000000 +0200
++++ dhcp-4.2.4-P2/common/conflex.c 2012-09-26 10:34:27.142049876 +0200
+@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
+ return BALANCE;
+ if (!strcasecmp (atom + 1, "ound"))
+ return BOUND;
++ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
++ return BOOTP_BROADCAST_ALWAYS;
+ break;
+ case 'c':
+ if (!strcasecmp(atom + 1, "ase"))
+diff -up dhcp-4.2.4-P2/includes/dhcpd.h.options dhcp-4.2.4-P2/includes/dhcpd.h
+--- dhcp-4.2.4-P2/includes/dhcpd.h.options 2012-08-28 04:13:22.000000000 +0200
++++ dhcp-4.2.4-P2/includes/dhcpd.h 2012-09-26 10:34:27.143049865 +0200
+@@ -1153,6 +1153,9 @@ struct client_config {
+ int do_forward_update; /* If nonzero, and if we have the
+ information we need, update the
+ A record for the address we get. */
++
++ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
++ flag in requests */
+ };
- void parse_client_statement (cfile, ip, config)
- struct parse *cfile;
-@@ -685,6 +687,12 @@ void parse_client_statement (cfile, ip,
- parse_reject_statement (cfile, config);
- return;
+ /* Per-interface state used in the dhcp client... */
+diff -up dhcp-4.2.4-P2/includes/dhctoken.h.options dhcp-4.2.4-P2/includes/dhctoken.h
+--- dhcp-4.2.4-P2/includes/dhctoken.h.options 2012-08-28 04:13:03.000000000 +0200
++++ dhcp-4.2.4-P2/includes/dhctoken.h 2012-09-26 10:34:27.144049854 +0200
+@@ -364,7 +364,8 @@ enum dhcp_token {
+ GETHOSTBYNAME = 665,
+ PRIMARY6 = 666,
+ SECONDARY6 = 667,
+- TOKEN_INFINIBAND = 668
++ TOKEN_INFINIBAND = 668,
++ BOOTP_BROADCAST_ALWAYS = 669
+ };
-+ case BOOTP_BROADCAST_ALWAYS:
-+ token = next_token(&val, (unsigned*)0, cfile);
-+ config -> bootp_broadcast_always = 1;
-+ parse_semi (cfile);
-+ return;
-+
- default:
- lose = 0;
- stmt = (struct executable_statement *)0;
+ #define is_identifier(x) ((x) >= FIRST_TOKEN && \
+++ /dev/null
---- dhcp-3.0.5/dst/dst_api.c.prototypes 2007-04-01 16:29:10.000000000 -0400
-+++ dhcp-3.0.5/dst/dst_api.c 2007-04-01 16:29:10.000000000 -0400
-@@ -58,6 +58,10 @@
-
- #include "dst_internal.h"
-
-+/* prototypes */
-+extern int b64_pton(char const *src, u_char *target, size_t targsize);
-+extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
-+
- /* static variables */
- static int done_init = 0;
- dst_func *dst_t_func[DST_MAX_ALGS];
---- dhcp-3.0.5/dst/dst_support.c.prototypes 2001-02-22 02:22:08.000000000 -0500
-+++ dhcp-3.0.5/dst/dst_support.c 2007-04-01 16:29:10.000000000 -0400
-@@ -32,6 +32,10 @@
-
- #include "dst_internal.h"
-
-+/* prototypes */
-+extern int b64_pton(char const *src, u_char *target, size_t targsize);
-+extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
-+
- /*
- * dst_s_conv_bignum_u8_to_b64
- * This function converts binary data stored as a u_char[] to a
---- dhcp-3.0.5/includes/minires/minires.h.prototypes 2004-06-10 13:59:37.000000000 -0400
-+++ dhcp-3.0.5/includes/minires/minires.h 2007-04-01 16:29:10.000000000 -0400
-@@ -65,7 +65,6 @@
- #define res_protocolname MRres_protocolname
- #define res_servicename MRres_servicename
- #define ns_datetosecs MRns_datetosecs
--#define b64_pton MRb64_pton
- #define res_ninit minires_ninit
- #define res_randomid MRres_randomid
- #define res_findzonecut MRres_findzonecut
---- dhcp-3.0.5/minires/res_mkupdate.c.prototypes 2007-04-01 16:29:10.000000000 -0400
-+++ dhcp-3.0.5/minires/res_mkupdate.c 2007-04-01 16:30:12.000000000 -0400
-@@ -49,6 +49,10 @@
- #include "minires/minires.h"
- #include "arpa/nameser.h"
-
-+/* prototypes */
-+extern int b64_pton(char const *src, u_char *target, size_t targsize);
-+int dn_comp(const char *src, u_char *dst, unsigned dstsiz, u_char **dnptrs, u_char **lastdnptr);
-+
- /* Options. Leave them on. */
- #define DEBUG
- #define MAXPORT 1024
---- dhcp-3.0.5/minires/res_comp.c.prototypes 2004-06-10 13:59:42.000000000 -0400
-+++ dhcp-3.0.5/minires/res_comp.c 2007-04-01 16:31:02.000000000 -0400
-@@ -91,6 +91,11 @@
- #include "minires/minires.h"
- #include "arpa/nameser.h"
-
-+/* prototypes */
-+int ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, char *dst, size_t dstsiz);
-+int ns_name_compress(const char *src, u_char *dst, size_t dstsiz, const u_char **dnptrs, const u_char **lastdnptr);
-+int ns_name_skip(const u_char **ptrptr, const u_char *eom);
-+
- /*
- * Expand compressed domain name 'comp_dn' to full domain name.
- * 'msg' is a pointer to the begining of the message,
---- dhcp-3.0.5/minires/res_init.c.prototypes 2004-06-10 13:59:43.000000000 -0400
-+++ dhcp-3.0.5/minires/res_init.c 2007-04-01 16:31:38.000000000 -0400
-@@ -102,6 +102,7 @@
- #define DEBUG
-
- static void res_setoptions (res_state, const char *, const char *);
-+u_int res_randomid(void);
-
- #ifdef RESOLVSORT
- static const char sort_mask[] = "/&";
-diff -up dhcp-4.0.0/common/nit.c.xen dhcp-4.0.0/common/nit.c
---- dhcp-4.0.0/common/nit.c.xen 2007-09-05 07:32:10.000000000 -1000
-+++ dhcp-4.0.0/common/nit.c 2007-12-29 06:39:16.000000000 -1000
-@@ -366,7 +366,7 @@ ssize_t receive_packet (interface, buf,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
+diff -up dhcp-4.2.2b1/common/bpf.c.xen dhcp-4.2.2b1/common/bpf.c
+--- dhcp-4.2.2b1/common/bpf.c.xen 2009-11-20 02:48:59.000000000 +0100
++++ dhcp-4.2.2b1/common/bpf.c 2011-07-01 14:00:16.936959001 +0200
+@@ -485,7 +485,7 @@ ssize_t receive_packet (interface, buf,
+ offset = decode_udp_ip_header (interface,
+ interface -> rbuf,
+ interface -> rbuf_offset,
+- from, hdr.bh_caplen, &paylen);
++ from, hdr.bh_caplen, &paylen, 0);
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0)
-diff -up dhcp-4.0.0/common/dlpi.c.xen dhcp-4.0.0/common/dlpi.c
---- dhcp-4.0.0/common/dlpi.c.xen 2007-10-08 04:27:53.000000000 -1000
-+++ dhcp-4.0.0/common/dlpi.c 2007-12-29 06:39:13.000000000 -1000
-@@ -689,7 +689,7 @@ ssize_t receive_packet (interface, buf,
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0) {
+diff -up dhcp-4.2.2b1/common/dlpi.c.xen dhcp-4.2.2b1/common/dlpi.c
+--- dhcp-4.2.2b1/common/dlpi.c.xen 2011-05-11 16:20:59.000000000 +0200
++++ dhcp-4.2.2b1/common/dlpi.c 2011-07-01 14:00:16.937958997 +0200
+@@ -693,7 +693,7 @@ ssize_t receive_packet (interface, buf,
length -= offset;
#endif
offset = decode_udp_ip_header (interface, dbuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0) {
-diff -up dhcp-4.0.0/common/upf.c.xen dhcp-4.0.0/common/upf.c
---- dhcp-4.0.0/common/upf.c.xen 2007-07-12 20:43:42.000000000 -1000
-+++ dhcp-4.0.0/common/upf.c 2007-12-29 06:39:24.000000000 -1000
-@@ -317,7 +317,7 @@ ssize_t receive_packet (interface, buf,
-
- /* Decode the IP and UDP headers... */
- offset = decode_udp_ip_header (interface, ibuf, bufix,
-- from, length, &paylen);
-+ from, length, &paylen, 0);
-
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0)
-diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
---- dhcp-4.0.0/common/lpf.c.xen 2007-12-29 06:37:53.000000000 -1000
-+++ dhcp-4.0.0/common/lpf.c 2007-12-29 06:43:08.000000000 -1000
-@@ -29,18 +29,33 @@
+ /*
+ * If the IP or UDP checksum was bad, skip the packet...
+diff -up dhcp-4.2.2b1/common/lpf.c.xen dhcp-4.2.2b1/common/lpf.c
+--- dhcp-4.2.2b1/common/lpf.c.xen 2011-05-10 16:38:58.000000000 +0200
++++ dhcp-4.2.2b1/common/lpf.c 2011-07-01 14:11:24.725748028 +0200
+@@ -29,19 +29,33 @@
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
#include <sys/ioctl.h>
#include <linux/if_ether.h>
+#include <linux/if_packet.h>
#include <netinet/in_systm.h>
+-#include <net/if_packet.h>
#include "includes/netinet/ip.h"
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
-@@ -66,10 +81,14 @@ int if_register_lpf (info)
+@@ -67,10 +81,14 @@ int if_register_lpf (info)
struct interface_info *info;
{
int sock;
htons((short)ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
-@@ -84,11 +103,16 @@ int if_register_lpf (info)
+@@ -85,11 +103,17 @@ int if_register_lpf (info)
log_fatal ("Open a socket for LPF: %m");
}
+ memset (&ifr, 0, sizeof ifr);
+ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
++ ifr.ifr_name[IFNAMSIZ-1] = '\0';
+ if (ioctl (sock, SIOCGIFINDEX, &ifr))
+ log_fatal ("Failed to get interface index: %m");
+
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
-@@ -170,9 +194,18 @@ static void lpf_gen_filter_setup (struct
+@@ -171,9 +195,18 @@ static void lpf_gen_filter_setup (struct
void if_register_receive (info)
struct interface_info *info;
{
#if defined (HAVE_TR_SUPPORT)
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
lpf_tr_filter_setup (info);
-@@ -291,7 +324,6 @@ ssize_t send_packet (interface, packet,
+@@ -295,7 +328,6 @@ ssize_t send_packet (interface, packet,
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
-- struct sockaddr sa;
+- struct sockaddr_pkt sa;
int result;
int fudge;
-@@ -309,15 +341,7 @@ ssize_t send_packet (interface, packet,
+@@ -316,17 +348,7 @@ ssize_t send_packet (interface, packet,
(unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len);
- /* For some reason, SOCK_PACKET sockets can't be connected,
- so we have to do a sentdo every time. */
- memset (&sa, 0, sizeof sa);
-- sa.sa_family = AF_PACKET;
-- strncpy (sa.sa_data,
-- (const char *)interface -> ifp, sizeof sa.sa_data);
+- sa.spkt_family = AF_PACKET;
+- strncpy ((char *)sa.spkt_device,
+- (const char *)interface -> ifp, sizeof sa.spkt_device);
+- sa.spkt_protocol = htons(ETH_P_IP);
-
- result = sendto (interface -> wfdesc,
-- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
+- buf + fudge, ibufp + len - fudge, 0,
+- (const struct sockaddr *)&sa, sizeof sa);
+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
if (result < 0)
log_error ("send_packet: %m");
return result;
-@@ -334,14 +358,35 @@ ssize_t receive_packet (interface, buf,
+@@ -343,14 +365,35 @@ ssize_t receive_packet (interface, buf,
{
int length = 0;
int offset = 0;
bufix = 0;
/* Decode the physical header... */
offset = decode_hw_header (interface, ibuf, bufix, hfrom);
-@@ -358,7 +403,7 @@ ssize_t receive_packet (interface, buf,
+@@ -367,7 +410,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
-diff -up dhcp-4.0.0/common/bpf.c.xen dhcp-4.0.0/common/bpf.c
---- dhcp-4.0.0/common/bpf.c.xen 2007-08-22 23:49:51.000000000 -1000
-+++ dhcp-4.0.0/common/bpf.c 2007-12-29 06:39:09.000000000 -1000
-@@ -482,7 +482,7 @@ ssize_t receive_packet (interface, buf,
- offset = decode_udp_ip_header (interface,
- interface -> rbuf,
- interface -> rbuf_offset,
-- from, hdr.bh_caplen, &paylen);
-+ from, hdr.bh_caplen, &paylen, 0);
+diff -up dhcp-4.2.2b1/common/nit.c.xen dhcp-4.2.2b1/common/nit.c
+--- dhcp-4.2.2b1/common/nit.c.xen 2009-11-20 02:49:01.000000000 +0100
++++ dhcp-4.2.2b1/common/nit.c 2011-07-01 14:00:16.939958989 +0200
+@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf,
- /* If the IP or UDP checksum was bad, skip the packet... */
- if (offset < 0) {
-diff -up dhcp-4.0.0/common/packet.c.xen dhcp-4.0.0/common/packet.c
---- dhcp-4.0.0/common/packet.c.xen 2007-12-29 06:37:53.000000000 -1000
-+++ dhcp-4.0.0/common/packet.c 2007-12-29 06:39:20.000000000 -1000
-@@ -210,7 +210,7 @@ ssize_t
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-4.2.2b1/common/packet.c.xen dhcp-4.2.2b1/common/packet.c
+--- dhcp-4.2.2b1/common/packet.c.xen 2009-07-23 20:52:20.000000000 +0200
++++ dhcp-4.2.2b1/common/packet.c 2011-07-01 14:00:16.939958989 +0200
+@@ -211,7 +211,7 @@ ssize_t
decode_udp_ip_header(struct interface_info *interface,
unsigned char *buf, unsigned bufix,
struct sockaddr_in *from, unsigned buflen,
{
unsigned char *data;
struct ip ip;
-@@ -321,7 +321,7 @@ decode_udp_ip_header(struct interface_in
+@@ -322,7 +322,7 @@ decode_udp_ip_header(struct interface_in
8, IPPROTO_UDP + ulen))));
udp_packets_seen++;
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
-diff -up dhcp-4.0.0/includes/dhcpd.h.xen dhcp-4.0.0/includes/dhcpd.h
---- dhcp-4.0.0/includes/dhcpd.h.xen 2007-12-29 06:37:53.000000000 -1000
-+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 06:39:27.000000000 -1000
-@@ -2561,7 +2561,7 @@ ssize_t decode_hw_header PROTO ((struct
- unsigned, struct hardware *));
- ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- unsigned, struct sockaddr_in *,
-- unsigned, unsigned *));
-+ unsigned, unsigned *, int));
+diff -up dhcp-4.2.2b1/common/upf.c.xen dhcp-4.2.2b1/common/upf.c
+--- dhcp-4.2.2b1/common/upf.c.xen 2009-11-20 02:49:01.000000000 +0100
++++ dhcp-4.2.2b1/common/upf.c 2011-07-01 14:00:16.940958986 +0200
+@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-4.2.2b1/includes/dhcpd.h.xen dhcp-4.2.2b1/includes/dhcpd.h
+--- dhcp-4.2.2b1/includes/dhcpd.h.xen 2011-07-01 14:00:16.000000000 +0200
++++ dhcp-4.2.2b1/includes/dhcpd.h 2011-07-01 14:12:18.069642470 +0200
+@@ -2796,7 +2796,7 @@ ssize_t decode_hw_header (struct interfa
+ unsigned, struct hardware *);
+ ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *,
+ unsigned, struct sockaddr_in *,
+- unsigned, unsigned *);
++ unsigned, unsigned *, int);
/* ethernet.c */
- void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
+ void assemble_ethernet_header (struct interface_info *, unsigned char *,
Source3: %{name}-relay.init
Source4: %{name}.sysconfig
Source5: %{name}-relay.sysconfig
-Source6: %{name}-libdhcp4client.pc
-Source7: %{name}-dhcp4client.h
-Source8: %{name}-libdhcp4client.make
-Source9: %{name}-libdhcp_control.h
Source10: %{name}.schema
Source11: %{name}-README.ldap
Source12: draft-ietf-dhc-ldap-schema-01.txt
Patch3: %{name}-paths.patch
Patch5: %{name}-timeouts.patch
Patch6: %{name}-options.patch
-Patch7: %{name}-libdhcp4client.patch
-Patch8: %{name}-prototypes.patch
Patch9: %{name}-errwarn-message.patch
Patch10: %{name}-memory.patch
Patch11: %{name}-dhclient-decline-backoff.patch
Patch12: %{name}-unicast-bootp.patch
-Patch13: %{name}-fast-timeout.patch
-Patch14: %{name}-failover-ports.patch
-Patch15: %{name}-dhclient-usage.patch
Patch16: %{name}-default-requested-options.patch
Patch17: %{name}-xen-checksum.patch
-Patch18: %{name}-dhclient-anycast.patch
Patch19: %{name}-manpages.patch
Patch20: %{name}-NetworkManager-crash.patch
URL: http://www.isc.org/sw/dhcp/
Provides: dhclient = %{epoch}:%{version}-%{release}
Obsoletes: dhclient
Obsoletes: dhcpv6-client
+Obsoletes: libdhcp4client
+Obsoletes: libdhcp4client-devel
+Obsoletes: libdhcp4client-static
%description client
Dynamic Host Configuration Protocol Client.
dhcpctl to zbiór funkcji tworzących API, które może być używane do
komunikacji z działającym serwerem ISC DHCP i jego kontroli.
-%package -n libdhcp4client
-Summary: The DHCP client in a library for invocation by other programs
-Summary(pl.UTF-8): Klient DHCP w postaci biblioteki do wykorzystania w innych programach
-Group: Development/Libraries
-
-%description -n libdhcp4client
-Provides the client for the DHCP protocol.
-
-%description -n libdhcp4client -l pl.UTF-8
-Ten pakiet zawiera klienta protokołu DHCP.
-
-%package -n libdhcp4client-devel
-Summary: Header files for development with the DHCP client library
-Summary(pl.UTF-8): Pliki nagłówkowe do programowania z użyciem biblioteki klienckiej DHCP
-License: GPL v2+
-Group: Development/Libraries
-Requires: libdhcp4client = %{epoch}:%{version}-%{release}
-
-%description -n libdhcp4client-devel
-Header files for development with the DHCP client library.
-
-%description -n libdhcp4client-devel -l pl.UTF-8
-Pliki nagłówkowe do programowania z użyciem biblioteki klienckiej
-DHCP.
-
-%package -n libdhcp4client-static
-Summary: Static DHCP client library
-Summary(pl.UTF-8): Statyczna biblioteka kliencka DHCP
-Group: Development/Libraries
-Requires: libdhcp4client-devel = %{epoch}:%{version}-%{release}
-
-%description -n libdhcp4client-static
-Static DHCP client library.
-
-%description -n libdhcp4client-static -l pl.UTF-8
-Statyczna biblioteka kliencka DHCP.
-
%prep
%setup -q -n %{name}-%{ver}%{pverdir}
%patch0 -p1
%patch3 -p1
%patch5 -p1
%patch6 -p1
-%patch7 -p1
-%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
-%patch13 -p1
-%patch14 -p1
-%patch15 -p1
%patch16 -p1
%patch17 -p1
-%patch18 -p1
%patch19 -p1
%patch20 -p1
cp -a %{SOURCE12} doc
cp -a %{SOURCE13} contrib
-# Copy in the libdhcp4client headers and Makefile.dist
-install -d libdhcp4client
-cp %{SOURCE7} libdhcp4client/dhcp4client.h
-cp %{SOURCE8} libdhcp4client/Makefile.dist
-
-# Copy in libdhcp_control.h to the isc-dhcp includes directory
-cp -p %{SOURCE9} includes/isc-dhcp/libdhcp_control.h
-
# Replace @PRODUCTNAME@
%{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
%{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
-e 's|ETCDIR|%{_sysconfdir}|g' $page
done
-sed 's/@DHCP_VERSION@/'%{version}'/' < %{SOURCE6} > libdhcp4client.pc
-
%build
%{__libtoolize}
%{__aclocal}
install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay
install %{SOURCE14} $RPM_BUILD_ROOT/sbin/dhclient-script
-install server/dhcpd.conf $RPM_BUILD_ROOT%{_sysconfdir}
-:> $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
+install server/dhcpd.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf
+install doc/examples/dhcpd-dhcpv6.conf $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
%if %{with ldap}
install -d $RPM_BUILD_ROOT%{schemadir}
install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir}
%endif
-# Install headers for libdhcp4client-devel
-install -d $RPM_BUILD_ROOT%{_includedir}/dhcp4client
-install libdhcp4client/dhcp4client.h $RPM_BUILD_ROOT%{_includedir}/dhcp4client/dhcp4client.h
-install -d $RPM_BUILD_ROOT%{_includedir}/dhcp4client/minires
-for hdr in cdefs.h ctrace.h dhcp.h dhcp6.h dhcpd.h dhctoken.h failover.h \
- heap.h inet.h minires/minires.h minires/res_update.h \
- minires/resolv.h osdep.h site.h statement.h tree.h; do
- install -p -m 0644 includes/${hdr} $RPM_BUILD_ROOT%{_includedir}/dhcp4client/${hdr}
-done
-
:> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases
touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases
touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases
-# Install pkg-config file
-install libdhcp4client.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libdhcp4client.pc
-cp -a includes/isc-dhcp/libdhcp_control.h $RPM_BUILD_ROOT%{_includedir}/isc-dhcp
-
%if %{with static_libs}
# HACK: strip doesn't like .a inside .a
install -d stripworkdir
mv /etc/dhclient-exit-hooks /etc/dhclient-exit-hooks.d/
fi
-%post -n libdhcp4client -p /sbin/ldconfig
-%postun -n libdhcp4client -p /sbin/ldconfig
-
%files
%defattr(644,root,root,755)
-%doc doc/* README RELNOTES server/dhcpd.conf LICENSE
+%doc doc/* README RELNOTES server/dhcpd.conf.example LICENSE
%doc contrib/ms2isc %{?with_ldap:contrib/dhcpd-conf-to-ldap README.ldap}
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcpd
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd.conf
%files client
%defattr(644,root,root,755)
-%doc contrib/sethostname.sh client/dhclient.conf
+%doc contrib/sethostname.sh client/dhclient.conf.example
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhclient.conf
%attr(755,root,root) /sbin/dhclient
%attr(755,root,root) /sbin/dhclient-script
%{_mandir}/man3/dhcpctl.3*
%{_mandir}/man3/omapi.3*
-%files -n libdhcp4client
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libdhcp4client-*.so.*
-
-%files -n libdhcp4client-devel
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libdhcp4client.so
-%{_includedir}/dhcp4client
-%{_pkgconfigdir}/libdhcp4client.pc
-%{_libdir}/libdhcp4client.la
-
-%if %{with static_libs}
-%files -n libdhcp4client-static
-%defattr(644,root,root,755)
-%{_libdir}/libdhcp4client.a
-%endif
-
%if %{with ldap}
%files -n openldap-schema-dhcp
%defattr(644,root,root,755)