Update isc-dhcp to 3.0.2rc3 using patch infrastructure.
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Tue, 4 Jan 2005 19:58:54 +0000 (19:58 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Tue, 4 Jan 2005 19:58:54 +0000 (19:58 +0000)
Also include the server and relay, but currently without rcNG script.

Submitted-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
31 files changed:
sbin/dhclient/Makefile
sbin/dhclient/Makefile.common [new file with mode: 0644]
sbin/dhclient/Makefile.inc
sbin/dhclient/client/Makefile
sbin/dhclient/client/clparse.c.patch [new file with mode: 0644]
sbin/dhclient/client/dhclient.8.no_obj.patch [new file with mode: 0644]
sbin/dhclient/client/dhclient.8.patch [new file with mode: 0644]
sbin/dhclient/client/dhclient.c.patch [new file with mode: 0644]
sbin/dhclient/client/scripts,freebsd.no_obj.patch [new file with mode: 0644]
sbin/dhclient/client/scripts,freebsd.patch [new file with mode: 0644]
sbin/dhclient/common/Makefile
sbin/dhclient/common/dhcp-options.5.patch [new file with mode: 0644]
sbin/dhclient/common/discover.c.patch [new file with mode: 0644]
sbin/dhclient/common/dispatch.c.patch [new file with mode: 0644]
sbin/dhclient/common/parse.c.patch [new file with mode: 0644]
sbin/dhclient/dhclient-script.sh [deleted file]
sbin/dhclient/dst/Makefile
sbin/dhclient/includes/Makefile [new file with mode: 0644]
sbin/dhclient/includes/dhcpd.h.patch [new file with mode: 0644]
sbin/dhclient/includes/osdep.h.patch [new file with mode: 0644]
sbin/dhclient/minires/Makefile
sbin/dhclient/omapip/Makefile
usr.sbin/Makefile
usr.sbin/dhcp/Makefile [new file with mode: 0644]
usr.sbin/dhcp/Makefile.common [new file with mode: 0644]
usr.sbin/dhcp/Makefile.inc [new file with mode: 0644]
usr.sbin/dhcp/dhcpctl/Makefile [new file with mode: 0644]
usr.sbin/dhcp/dhcpctl/Makefile.bin [new file with mode: 0644]
usr.sbin/dhcp/dhcpctl/Makefile.lib [new file with mode: 0644]
usr.sbin/dhcp/relay/Makefile [new file with mode: 0644]
usr.sbin/dhcp/server/Makefile [new file with mode: 0644]

index cb186fe..ee18ae3 100644 (file)
@@ -1,55 +1,7 @@
 # Makefile for ISC DHCP client.
 # $FreeBSD: src/sbin/dhclient/Makefile,v 1.6.2.7 2002/04/11 10:21:20 murray Exp $
-# $DragonFly: src/sbin/dhclient/Makefile,v 1.2 2003/06/17 04:27:32 dillon Exp $
+# $DragonFly: src/sbin/dhclient/Makefile,v 1.3 2005/01/04 19:58:54 joerg Exp $
 
-SUBDIR= common dst minires omapip client
-
-
-# Our directory structure confuses crunchgen, so we must explicitly
-# list the requisite object files when building crunched binaries for
-# release floppies.
-
-.ifdef(RELEASE_CRUNCH)
-
-# client
-OBJS=  client/clparse.o client/dhclient.o
-
-# common
-OBJS+= common/alloc.o common/bpf.o common/comapi.o common/conflex.o \
-       common/ctrace.o common/discover.o common/dispatch.o common/dlpi.o \
-       common/dns.o common/ethernet.o common/execute.o common/fddi.o \
-       common/icmp.o common/inet.o common/lpf.o common/memory.o \
-       common/nit.o common/options.o common/packet.o common/parse.o \
-       common/print.o common/raw.o common/resolv.o common/socket.o \
-       common/tables.o common/tr.o common/tree.o common/upf.o
-
-# dst
-OBJS+= dst/base64.o dst/dst_api.o dst/dst_support.o dst/hmac_link.o \
-       dst/md5_dgst.o dst/prandom.o
-
-# minires
-OBJS+= minires/ns_date.o minires/ns_name.o minires/ns_parse%FIXED.o \
-       minires/ns_samedomain.o minires/ns_sign.o minires/ns_verify.o \
-       minires/res_comp.o minires/res_findzonecut.o minires/res_init.o \
-       minires/res_mkquery.o minires/res_mkupdate.o minires/res_query%FIXED.o \
-       minires/res_send.o minires/res_sendsigned.o minires/res_update.o
-
-# omapi
-OBJS+= omapip/alloc.o omapip/array.o omapip/auth.o omapip/buffer.o \
-       omapip/connection.o omapip/convert.o omapip/dispatch.o \
-       omapip/errwarn.o omapip/generic.o omapip/handle.o omapip/hash.o \
-       omapip/inet_addr.o omapip/listener.o omapip/message.o \
-       omapip/mrtrace.o omapip/protocol.o omapip/result.o \
-       omapip/support.o omapip/toisc.o omapip/trace.o
-
-# src/release/Makefile (release.4) tries to invokes this makefile with
-# the target set to the list of all objects defined above.  This
-# top-level Makefile doesn't actually know how to build those objects
-# though, so we must run ``make all'' instead when we are asked to
-# generate an individual object file.
-
-${OBJS}: all
-
-.endif
+SUBDIR=        includes/ common dst minires omapip client
 
 .include <bsd.subdir.mk>
diff --git a/sbin/dhclient/Makefile.common b/sbin/dhclient/Makefile.common
new file mode 100644 (file)
index 0000000..951b46c
--- /dev/null
@@ -0,0 +1,7 @@
+# $DragonFly: src/sbin/dhclient/Attic/Makefile.common,v 1.1 2005/01/04 19:58:54 joerg Exp $
+
+DIST_DIR= ${.CURDIR}/../../../contrib/dhcp-3.0
+CURSUBDIR?=    ${.CURDIR:C|^.*/||}
+CONTRIBDIR=    ${DIST_DIR}/${CURSUBDIR}
+
+.PATH: ${CONTRIBDIR}
index 256a4ec..7c2883a 100644 (file)
@@ -1,9 +1,8 @@
 # $FreeBSD: src/sbin/dhclient/Makefile.inc,v 1.2.2.1 2002/04/11 10:21:20 murray Exp $
-# $DragonFly: src/sbin/dhclient/Attic/Makefile.inc,v 1.5 2004/07/21 02:07:23 dillon Exp $
+# $DragonFly: src/sbin/dhclient/Attic/Makefile.inc,v 1.6 2005/01/04 19:58:54 joerg Exp $
 
 WARNS=         0
-CFLAGS+= -I${DIST_DIR}/includes
-CFLAGS+= -D__FreeBSD__
+CFLAGS+=       -I.. -I../includes -I${DIST_DIR} -I${DIST_DIR}/includes
 
 CLIENTBINDIR=  /sbin
 RUNDIR=                /var/run
index d366e2b..bc2a798 100644 (file)
@@ -1,15 +1,16 @@
 # client
 # $FreeBSD: src/sbin/dhclient/client/Makefile,v 1.2.2.1 2002/04/11 10:21:20 murray Exp $
-# $DragonFly: src/sbin/dhclient/client/Attic/Makefile,v 1.2 2003/06/17 04:27:32 dillon Exp $
+# $DragonFly: src/sbin/dhclient/client/Attic/Makefile,v 1.3 2005/01/04 19:58:54 joerg Exp $
 
-DIST_DIR= ${.CURDIR}/../../../contrib/isc-dhcp
-
-.PATH: ${DIST_DIR}/client
+.include "${.CURDIR}/../Makefile.common"
 
 PROG=  dhclient
 SRCS=  clparse.c dhclient.c
 
-CFLAGS+= -DCLIENT_PATH='"PATH=/sbin:/bin:/usr/sbin:/usr/bin"' -Dwarn=dhcp_warn
+PATCHES=clparse.c.patch dhclient.8.patch dhclient.c.patch \
+       scripts,freebsd.patch
+
+CFLAGS+= -I../includes -DCLIENT_PATH='"PATH=/sbin:/bin:/usr/sbin:/usr/bin"' -Dwarn=dhcp_warn
 
 DPADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST}
 LDADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST} 
diff --git a/sbin/dhclient/client/clparse.c.patch b/sbin/dhclient/client/clparse.c.patch
new file mode 100644 (file)
index 0000000..bb88c48
--- /dev/null
@@ -0,0 +1,12 @@
+$DragonFly: src/sbin/dhclient/client/Attic/clparse.c.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- clparse.c.orig     2004-06-10 19:59:11.000000000 +0200
++++ clparse.c  2004-06-24 16:35:45.000000000 +0200
+@@ -776,7 +776,7 @@
+               if (status != ISC_R_SUCCESS)
+                       log_fatal ("Can't record interface %s: %s",
+                                  name, isc_result_totext (status));
+-              strcpy (ip -> name, name);
++              strlcpy (ip -> name, name, IFNAMSIZ);
+               if (dummy_interfaces) {
+                       interface_reference (&ip -> next,
+                                            dummy_interfaces, MDL);
diff --git a/sbin/dhclient/client/dhclient.8.no_obj.patch b/sbin/dhclient/client/dhclient.8.no_obj.patch
new file mode 100644 (file)
index 0000000..cd4a062
--- /dev/null
@@ -0,0 +1,84 @@
+$DragonFly: src/sbin/dhclient/client/Attic/dhclient.8.no_obj.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- dhclient.8.orig    2004-06-10 19:59:12.000000000 +0200
++++ dhclient.8 2004-06-24 16:35:57.000000000 +0200
+@@ -23,6 +23,10 @@
+ .\"
+ .\" $Id: dhclient.8,v 1.12.2.8 2004/06/10 17:59:12 dhankins Exp $
+ .\"
++.\" Portions copyright (c) 2000 David E. O'Brien.
++.\" All rights reserved.
++.\" $FreeBSD: ports/net/isc-dhcp3-server/files/patch-client::dhclient.8,v 1.3 2004/03/22 23:33:09 des Exp $
++.\"
+ .TH dhclient 8
+ .SH NAME
+ dhclient - Dynamic Host Configuration Protocol Client
+@@ -33,12 +37,18 @@
+ .I port
+ ]
+ [
++.B -D
++]
++[
+ .B -d
+ ]
+ [
+ .B -q
+ ]
+ [
++.B -v
++]
++[
+ .B -1
+ ]
+ [
+@@ -69,6 +79,10 @@
+ relay
+ ]
+ [
++.B -i
++interval
++]
++[
+ .B -n
+ ]
+ [
+@@ -153,6 +167,15 @@
+ configuration file or on the command line, and will ignore all other
+ interfaces.
+ .PP
++The
++.B -D
++flag causes
++.B dhclient
++to save the script it creates for use in conjunction with
++.B dhclient-script
++in
++.IR /tmp.
++.PP
+ If the DHCP client should listen and transmit on a port other than the
+ standard (port 68), the
+ .B -p
+@@ -176,6 +199,12 @@
+ 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
++On FreeBSD, dhclient can be enabled to automatically handle the
++link status of the network card. Normally polling is done every
++five seconds. The polling interval can be set using the
++.B -i
++flag, followed by the numbers of seconds. Minimum is one second.
++.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
+@@ -193,6 +222,10 @@
+ .B -q
+ flag prevents any messages other than errors from being printed to the
+ standard error descriptor.
++.B -v
++flag turns on all messages.
++Opposite of
++.B -q .
+ .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
diff --git a/sbin/dhclient/client/dhclient.8.patch b/sbin/dhclient/client/dhclient.8.patch
new file mode 100644 (file)
index 0000000..a087064
--- /dev/null
@@ -0,0 +1,84 @@
+$DragonFly: src/sbin/dhclient/client/Attic/dhclient.8.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- dhclient.8.orig    2004-06-10 19:59:12.000000000 +0200
++++ dhclient.8 2004-06-24 16:35:57.000000000 +0200
+@@ -23,6 +23,10 @@
+ .\"
+ .\" $Id: dhclient.8,v 1.12.2.8 2004/06/10 17:59:12 dhankins Exp $
+ .\"
++.\" Portions copyright (c) 2000 David E. O'Brien.
++.\" All rights reserved.
++.\" $FreeBSD: ports/net/isc-dhcp3-server/files/patch-client::dhclient.8,v 1.3 2004/03/22 23:33:09 des Exp $
++.\"
+ .TH dhclient 8
+ .SH NAME
+ dhclient - Dynamic Host Configuration Protocol Client
+@@ -33,12 +37,18 @@
+ .I port
+ ]
+ [
++.B -D
++]
++[
+ .B -d
+ ]
+ [
+ .B -q
+ ]
+ [
++.B -v
++]
++[
+ .B -1
+ ]
+ [
+@@ -69,6 +79,10 @@
+ relay
+ ]
+ [
++.B -i
++interval
++]
++[
+ .B -n
+ ]
+ [
+@@ -153,6 +167,15 @@
+ configuration file or on the command line, and will ignore all other
+ interfaces.
+ .PP
++The
++.B -D
++flag causes
++.B dhclient
++to save the script it creates for use in conjunction with
++.B dhclient-script
++in
++.IR /tmp.
++.PP
+ If the DHCP client should listen and transmit on a port other than the
+ standard (port 68), the
+ .B -p
+@@ -176,6 +199,12 @@
+ 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
++On FreeBSD, dhclient can be enabled to automatically handle the
++link status of the network card. Normally polling is done every
++five seconds. The polling interval can be set using the
++.B -i
++flag, followed by the numbers of seconds. Minimum is one second.
++.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
+@@ -193,6 +222,10 @@
+ .B -q
+ flag prevents any messages other than errors from being printed to the
+ standard error descriptor.
++.B -v
++flag turns on all messages.
++Opposite of
++.B -q .
+ .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
diff --git a/sbin/dhclient/client/dhclient.c.patch b/sbin/dhclient/client/dhclient.c.patch
new file mode 100644 (file)
index 0000000..2b35c60
--- /dev/null
@@ -0,0 +1,538 @@
+$DragonFly: src/sbin/dhclient/client/Attic/dhclient.c.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- dhclient.c.orig    2004-06-10 19:59:12.000000000 +0200
++++ dhclient.c 2004-06-24 17:02:09.000000000 +0200
+@@ -38,6 +38,13 @@
+ #include "dhcpd.h"
+ #include "version.h"
++#include <sys/ioctl.h>
++#include <net/if_media.h>
++#if defined(DRAGONFLY_FUTURE)
++#include <net80211/ieee80211_ioctl.h>
++#include <net80211/ieee80211.h>
++#endif
++
+ TIME cur_time;
+ TIME default_lease_time = 43200; /* 12 hours... */
+ TIME max_lease_time = 86400; /* 24 hours... */
+@@ -73,8 +80,11 @@
+ struct string_list *client_env=NULL;
+ int client_env_count=0;
+ int onetry=0;
+-int quiet=0;
++int quiet=1;
+ int nowait=0;
++#ifdef ENABLE_POLLING_MODE
++int polling_interval = 5;
++#endif
+ static void usage PROTO ((void));
+@@ -175,6 +185,9 @@
+               } else if (!strcmp (argv [i], "-q")) {
+                       quiet = 1;
+                       quiet_interface_discovery = 1;
++              } else if (!strcmp (argv [i], "-v")) {
++                      quiet = 0;
++                      quiet_interface_discovery = 0;
+               } else if (!strcmp (argv [i], "-s")) {
+                       if (++i == argc)
+                               usage ();
+@@ -188,6 +201,19 @@
+               } else if (!strcmp (argv [i], "-n")) {
+                       /* do not start up any interfaces */
+                       interfaces_requested = 1;
++#ifdef ENABLE_POLLING_MODE
++              } else if (!strcmp (argv [i], "-i")) {
++                      if (++i == argc)
++                              usage ();
++                      polling_interval = (int)strtol (argv [i],
++                          (char **)NULL, 10);
++                      if (polling_interval <= 0) {
++                              log_info ("Incorrect polling interval %d",
++                                  polling_interval);
++                              log_info ("Using a default of 5 seconds");
++                              polling_interval = 5;
++                      }
++#endif
+               } else if (!strcmp (argv [i], "-w")) {
+                       /* do not exit if there are no broadcast interfaces. */
+                       persist = 1;
+@@ -216,7 +242,17 @@
+                   if (strlen (argv [i]) > sizeof tmp -> name)
+                           log_fatal ("%s: interface name too long (max %ld)",
+                                      argv [i], (long)strlen (argv [i]));
+-                  strcpy (tmp -> name, argv [i]);
++                  strlcpy (tmp -> name, argv [i], IFNAMSIZ);
++#if defined(DRAGONFLY_FUTURE)
++                  set_ieee80211 (tmp);
++#endif
++                  /* Init some interface vars, enable polling */
++#ifdef ENABLE_POLLING_MODE
++                  tmp -> forcediscover = 0;
++                  tmp -> linkstate = HAVELINK;
++                  tmp -> polling = 1;
++#endif /* ifdef ENABLE_POLLING_MODE */
++
+                   if (interfaces) {
+                           interface_reference (&tmp -> next,
+                                                interfaces, MDL);
+@@ -376,6 +412,16 @@
+                                            INTERFACE_AUTOMATIC)) !=
+                            INTERFACE_REQUESTED))
+                               continue;
++#if defined(DRAGONFLY_FUTURE)
++                      set_ieee80211 (ip);
++#endif
++#ifdef ENABLE_POLLING_MODE
++                      ip -> forcediscover = 0;
++                      if (ip -> client -> config -> media != NULL)
++                              ip -> havemedia = 1;
++                      else
++                              ip -> havemedia = 0;
++#endif
+                       script_init (ip -> client,
+                                    "PREINIT", (struct string_list *)0);
+                       if (ip -> client -> alias)
+@@ -418,8 +464,13 @@
+                               client -> state = S_INIT;
+                               /* Set up a timeout to start the initialization
+                                  process. */
++#ifdef ENABLE_POLLING_MODE
++                              add_timeout (cur_time + random () % 5 + 2,
++                                           state_polling, client, 0, 0);
++#else
+                               add_timeout (cur_time + random () % 5,
+                                            state_reboot, client, 0, 0);
++#endif
+                       }
+               }
+       }
+@@ -477,9 +528,9 @@
+       log_info (arr);
+       log_info (url);
+-      log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
+-                 "[-s server]");
+-      log_error ("                [-cf config-file] [-lf lease-file]%s",
++      log_error ("Usage: dhclient [-1Ddqrv] [-i polling-interval] %s",
++                 "[-nw] [-p <port>] [-s server]");
++      log_error ("                [-cf config-file] [-lf lease-file] %s",
+                  "[-pf pid-file] [-e VAR=val]");
+       log_fatal ("                [-sf script-file] [interface]");
+ }
+@@ -882,6 +933,15 @@
+       /* Write out the new lease. */
+       write_client_lease (client, client -> new, 0, 0);
++      /*
++       * It's now possible that state_reboot can be called
++       * after a interface link went down and is up again.
++       * To prevent tons of equal leases saved on disk, we rewrite
++       * them.
++       */
++      read_client_leases ();
++      rewrite_client_leases ();
++
+       /* Replace the old active lease with the new one. */
+       if (client -> active)
+               destroy_client_lease (client -> active);
+@@ -896,6 +956,12 @@
+             piaddr (client -> active -> address),
+             (long)(client -> active -> renewal - cur_time));
+       client -> state = S_BOUND;
++#ifdef ENABLE_POLLING_MODE
++      /* Init some interface vars, enable polling */
++      client -> interface -> linkstate = HAVELINK;
++      client -> interface -> forcediscover = 0;
++      client -> interface -> polling = 1;
++#endif /* ifdef ENABLE_POLLING_MODE */
+       reinitialize_interfaces ();
+       go_daemon ();
+       if (client -> config -> do_forward_update) {
+@@ -1358,6 +1424,11 @@
+       int interval;
+       int increase = 1;
++#ifdef ENABLE_POLLING_MODE
++      /* Disable polling for this interface */
++      client -> interface -> polling = 0;
++#endif
++
+       /* Figure out how long it's been since we started transmitting. */
+       interval = cur_time - client -> first_sending;
+@@ -1463,6 +1534,9 @@
+       struct client_lease *loop;
+       struct client_lease *lp;
++      if (client -> interface -> linkstate == NOLINK)
++              return;
++
+       loop = lp = client -> active;
+       log_info ("No DHCPOFFERS received.");
+@@ -1495,6 +1569,10 @@
+                               log_info ("bound: renewal in %ld %s.",
+                                         (long)(client -> active -> renewal -
+                                                cur_time), "seconds");
++#ifdef ENABLE_POLLING_MODE
++                              /* Enable polling for this interface */
++                              client -> interface -> polling = 1;
++#endif
+                               add_timeout (client -> active -> renewal,
+                                            state_bound, client, 0, 0);
+                           } else {
+@@ -1502,6 +1580,11 @@
+                               log_info ("bound: immediate renewal.");
+                               state_bound (client);
+                           }
++                          /*
++                           * Set the link status back to nolink, even
++                           * if we have media settings.
++                           */
++                          client -> interface -> linkstate = NOLINK;
+                           reinitialize_interfaces ();
+                           go_daemon ();
+                           return;
+@@ -1547,6 +1630,12 @@
+       }
+       log_info ("No working leases in persistent database - sleeping.");
++
++#ifdef ENABLE_POLLING_MODE
++      /* Enable polling for this interface */
++      client -> interface -> polling = 1;
++#endif
++
+       script_init (client, "FAIL", (struct string_list *)0);
+       if (client -> alias)
+               script_write_params (client, "alias_", client -> alias);
+@@ -1687,6 +1776,18 @@
+                       client -> packet.secs = htons (65535);
+       }
++      /*
++       * Only try the first ten seconds to renew a lease from a
++       * given dhcp-server adress. After that, fall back to use
++       * state_reboot with INADDR_BROADCAST.
++       */
++      if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
++         (client -> state == S_RENEWING || client -> state == S_REBINDING)) {
++              if (client -> active && client -> active -> expiry > cur_time &&
++                      interval >= 10)
++                      goto cancel;
++      }
++
+       log_info ("DHCPREQUEST on %s to %s port %d",
+             client -> name ? client -> name : client -> interface -> name,
+             inet_ntoa (destination.sin_addr),
+@@ -1708,6 +1809,16 @@
+                                     from, &destination,
+                                     (struct hardware *)0);
++      /*
++       * If sendto() for a direct request fails, fall back to use
++       * state_reboot with INADDR_BROADCAST.
++       */
++      if (result == -1 && destination.sin_addr.s_addr != INADDR_BROADCAST &&
++         (client -> state == S_RENEWING || client -> state == S_REBINDING)) {
++              if (client -> active && client -> active -> expiry > cur_time)
++                      goto cancel;
++      }
++
+       add_timeout (cur_time + client -> interval,
+                    send_request, client, 0, 0);
+ }
+@@ -2603,6 +2714,13 @@
+                       wstatus = 0;
+               }
+       } else {
++              if ((i = open(_PATH_DEVNULL, O_RDWR)) != -1) {
++                      dup2(i, STDIN_FILENO);
++                      dup2(i, STDOUT_FILENO);
++                      dup2(i, STDERR_FILENO);
++                      if (i > STDERR_FILENO)
++                              close(i);
++              }
+               execve (scriptName, argv, envp);
+               log_error ("execve (%s, ...): %m", scriptName);
+               exit (0);
+@@ -2789,8 +2907,10 @@
+                             case S_STOPPED:
+                               break;
+                       }
++#ifndef ENABLE_POLLING_MODE
+                       client -> state = S_INIT;
+                       state_reboot (client);
++#endif
+               }
+       }
+ }
+@@ -3016,7 +3136,9 @@
+                   break;
+                 case server_awaken:
++#ifndef ENABLE_POLLING_MODE
+                   state_reboot (client);
++#endif
+                   break;
+               }
+           }
+@@ -3153,3 +3275,256 @@
+       data_string_forget (&ddns_dhcid, MDL);
+       return rcode;
+ }
++
++/* Check to see if there's a wire plugged in */
++int
++interface_active(struct interface_info *ip) {
++      struct ifmediareq ifmr;
++      int *media_list, i;
++      char *ifname;
++      int sock;
++
++      ifname = ip -> name;
++
++      if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
++              log_fatal ("Can't create interface_active socket");
++
++      memset (&ifmr, 0, sizeof (ifmr));
++      strncpy (ifmr.ifm_name, ifname, sizeof (ifmr.ifm_name));
++
++      if (ioctl (sock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
++              /*
++               * Interface doesn't support SIOCGIFMEDIA, presume okay
++               */
++              close (sock);
++              return (HAVELINK);
++      }
++      close (sock);
++
++      if (ifmr.ifm_count == 0) {
++              /*
++               * Assume that this means interface
++               * does not support SIOCGIFMEDIA
++               */
++              log_fatal ("%s: no media types?", ifname);
++              return (HAVELINK);
++      }
++
++      if (ifmr.ifm_status & IFM_AVALID) {
++              if (ip -> ieee80211) {
++                      /*
++                       * Wavelan devices need to be checked if they are
++                       * associated.
++                       */
++                      if ((IFM_TYPE(ifmr.ifm_active) == IFM_IEEE80211) &&
++                           (ifmr.ifm_status & IFM_ACTIVE)) {
++                              return (HAVELINK);
++                      }
++              } else {
++                      if (ifmr.ifm_status & IFM_ACTIVE) {
++                              return (HAVELINK);
++                      }
++              }
++              /*
++               * We really have no link.
++               */
++              return (NOLINK);
++      }
++      /*
++       * IFM_AVALID is not set. We cannot check
++       * the link state. Assume HAVELINK.
++       */
++
++      return (HAVELINK);
++}
++
++#if defined(DRAGONFLY_FUTURE)
++void
++set_ieee80211 (struct interface_info *ip) {
++      struct ieee80211req     ireq;
++      u_int8_t                data[32];
++      int                     associated = 0;
++      int *media_list, i;
++      char *ifname;
++      int sock;
++
++      ifname = ip -> name;
++
++      if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
++              log_fatal ("Can't create interface_active socket");
++
++      memset (&ireq, 0, sizeof (ireq));
++      strncpy (ireq.i_name, ifname, sizeof (ireq.i_name));
++      ireq.i_data = &data;
++      ireq.i_type = IEEE80211_IOC_SSID;
++      ireq.i_val = -1;
++      /*
++       * If we can't get the SSID,
++       * this isn't an 802.11 device.
++       */
++      if (ioctl (sock, SIOCG80211, &ireq) < 0)
++              ip -> ieee80211 = 0;
++      else {
++#ifdef DEBUG
++              printf ("Device %s has 802.11\n", ifname);
++#endif
++              ip -> ieee80211 = 1;
++      }
++      close (sock);
++}
++#endif
++
++#ifdef ENABLE_POLLING_MODE
++/* Go to background after some time */
++void state_background (void *cpp)
++{
++      go_daemon ();
++}
++
++/* Check the state of the NICs if we have link */
++void state_polling (void *cpp)
++{
++      static int doinitcheck = 0;
++      struct interface_info *ip;
++      struct client_state *client;
++      int result;
++
++      for (ip = interfaces; ip; ip = ip -> next) {
++              if (! ip -> polling)
++                      continue;
++#ifdef DEBUG
++              printf ("%s: Polling interface state\n", ip -> name);
++              for (client = ip -> client;
++                   client; client = client -> next) {
++                      printf ("%s: client state of %d\n", ip -> name, ip -> client -> state);
++                      printf ("%s: link = %d\n", ip -> name, ip -> linkstate);
++              }
++#endif
++
++              result = interface_active (ip);
++              /*
++               * If dhclient.conf contains media settings, we cannot
++               * abort if the interface is not set to active mode.
++               */
++              if (ip -> havemedia && ip -> client -> state != S_BOUND) {
++                      if (result == HAVELINK)
++                              ip -> forcediscover = 1;
++                      result = HAVELINK;
++              }
++
++              /*
++               * The last status of the interface tells us
++               * the we've got no link ...
++               */
++              if (ip -> linkstate == NOLINK || ! doinitcheck) {
++                      /*
++                       * ... but we have now link. Let's send
++                       * requests.
++                       */
++                      if (result == HAVELINK) {
++#ifdef DEBUG
++                              if (ip -> havemedia)
++                                      printf ("%s: Trying media settings on interface\n",
++                                              ip -> name);
++                              else
++                                      printf ("%s: Found Link on interface\n", ip -> name);
++#endif
++                              /*
++                               * Set the interface to state_bound. We assume that we have
++                               * a working link. If we cannot reach the server directly,
++                               * INADDR_BROADCAST is used.
++                               */
++                              for (client = ip -> client;
++                                   client; client = client -> next) {
++                                      cancel_timeout (state_init, client);
++                                      cancel_timeout (state_reboot, client);
++                                      cancel_timeout (state_selecting, client);
++                                      if (client -> active) {
++                                              add_timeout (cur_time + random () % 5,
++                                                 state_bound, client, 0, 0);
++                                      } else {
++                                              add_timeout (cur_time + random () % 5,
++                                                 state_reboot, client, 0, 0);
++                                      }
++                              }
++                              ip -> linkstate = HAVELINK;
++                      } else {
++#ifdef DEBUG
++                              printf ("%s: No link on interface\n", ip -> name);
++#endif
++                              for (client = ip -> client;
++                                   client; client = client -> next) {
++                                      /*
++                                       * Without this add_timout(), dhclient does
++                                       * not poll on a interface if there
++                                       * is no cable plugged in at startup
++                                       * time. Because we add one additional second
++                                       * to the time of a normal timeout, we always
++                                       * skip and block a running one. This prevents
++                                       * that polling is done twice at the same time.
++                                       */
++                                      if (client -> state == S_INIT) {
++                                              add_timeout (cur_time + (polling_interval + 1),
++                                                          state_polling, client, 0, 0);
++                                      }
++                              }
++                              ip -> linkstate = NOLINK;
++                              /*
++                               * Automatically go into the background after
++                               * some time. Do this only if there are no
++                               * media options available for a interface.
++                               */
++                              if (! ip -> havemedia && ! doinitcheck) {
++                                      add_timeout (cur_time + (polling_interval * 2),
++                                                  state_background, client, 0, 0);
++                              }
++                      }
++              }
++
++              /*
++               * The last status of the interface tells us
++               * the we previously had link.
++               */
++              if (ip -> linkstate == HAVELINK && doinitcheck) {
++                      if (result == NOLINK) {
++                              /*
++                               * We lost link on the interface, or it isn't
++                               * associated anymore.
++                               */
++#ifdef DEBUG
++                              printf ("%s: Lost Link on interface\n", ip -> name);
++#endif
++                              /*
++                               * After we lost link, cycle again through the
++                               * different media settings if available. Else
++                               * set NOLINK.
++                               */
++                              if (ip -> havemedia)
++                                      ip -> forcediscover = 1;
++                              else
++                                      ip -> linkstate = NOLINK;
++                      }
++                      /*
++                       * If we happen to have a real link, but no
++                       * active lease, force the interface into
++                       * state_reboot. Do the same if media settings
++                       * are available.
++                       */
++                      if (ip -> forcediscover) {
++                              for (client = ip -> client;
++                                   client; client = client -> next) {
++                                      if (client -> state != S_REBOOTING &&
++                                          client -> state != S_SELECTING) {
++                                              add_timeout (cur_time + random () % 5,
++                                                          state_reboot, client, 0, 0);
++                                      }
++                              }
++                              ip -> forcediscover = 0;
++                              ip -> linkstate = HAVELINK;
++                      }
++                      /* We still have link, do nothing. */
++              }
++      }
++      doinitcheck = 1;
++}
++#endif /* ifdef ENABLE_POLLING_MODE */
diff --git a/sbin/dhclient/client/scripts,freebsd.no_obj.patch b/sbin/dhclient/client/scripts,freebsd.no_obj.patch
new file mode 100644 (file)
index 0000000..d652e6b
--- /dev/null
@@ -0,0 +1,54 @@
+$DragonFly: src/sbin/dhclient/client/Attic/scripts,freebsd.no_obj.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- freebsd.orig       2003-09-12 21:31:03.000000000 +0200
++++ freebsd    2004-06-24 17:25:30.000000000 +0200
+@@ -50,12 +50,7 @@
+   fi
+ fi
+-if [ x$new_network_number != x ]; then
+-   $LOGGER New Network Number: $new_network_number
+-fi
+-
+ if [ x$new_broadcast_address != x ]; then
+- $LOGGER New Broadcast Address: $new_broadcast_address
+   new_broadcast_arg="broadcast $new_broadcast_address"
+ fi
+ if [ x$old_broadcast_address != x ]; then
+@@ -71,6 +66,15 @@
+   alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++# Get the interface to which our default route is bound to.
++if [ -x /usr/bin/netstat ]; then
++  if_defaultroute=`/usr/bin/netstat -rn \
++    | /usr/bin/grep "^default" \
++    | /usr/bin/awk '{print $6}'`
++else
++  if_defaultroute="x"
++fi
++
+ if [ x$reason = xMEDIUM ]; then
+   eval "ifconfig $interface $medium"
+   eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
+@@ -113,7 +117,9 @@
+     eval "ifconfig $interface inet -alias $old_ip_address $medium"
+     route delete $old_ip_address 127.1 >/dev/null 2>&1
+     for router in $old_routers; do
+-      route delete default $router >/dev/null 2>&1
++      if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
++      route delete default $router >/dev/null 2>&1
++      fi
+     done
+     if [ -n "$old_static_routes" ]; then
+       set -- $old_static_routes
+@@ -166,7 +172,9 @@
+     eval "ifconfig $interface inet -alias $old_ip_address $medium"
+     route delete $old_ip_address 127.1 >/dev/null 2>&1
+     for router in $old_routers; do
+-      route delete default $router >/dev/null 2>&1
++      if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
++      route delete default $router >/dev/null 2>&1
++      fi
+     done
+     if [ -n "$old_static_routes" ]; then
+       set -- $old_static_routes
diff --git a/sbin/dhclient/client/scripts,freebsd.patch b/sbin/dhclient/client/scripts,freebsd.patch
new file mode 100644 (file)
index 0000000..f1a0338
--- /dev/null
@@ -0,0 +1,54 @@
+$DragonFly: src/sbin/dhclient/client/Attic/scripts,freebsd.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- freebsd.orig       2003-09-12 21:31:03.000000000 +0200
++++ freebsd    2004-06-24 17:25:30.000000000 +0200
+@@ -50,12 +50,7 @@
+   fi
+ fi
+-if [ x$new_network_number != x ]; then
+-   $LOGGER New Network Number: $new_network_number
+-fi
+-
+ if [ x$new_broadcast_address != x ]; then
+- $LOGGER New Broadcast Address: $new_broadcast_address
+   new_broadcast_arg="broadcast $new_broadcast_address"
+ fi
+ if [ x$old_broadcast_address != x ]; then
+@@ -71,6 +66,15 @@
+   alias_subnet_arg="netmask $alias_subnet_mask"
+ fi
++# Get the interface to which our default route is bound to.
++if [ -x /usr/bin/netstat ]; then
++  if_defaultroute=`/usr/bin/netstat -rn \
++    | /usr/bin/grep "^default" \
++    | /usr/bin/awk '{print $6}'`
++else
++  if_defaultroute="x"
++fi
++
+ if [ x$reason = xMEDIUM ]; then
+   eval "ifconfig $interface $medium"
+   eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
+@@ -113,7 +117,9 @@
+     eval "ifconfig $interface inet -alias $old_ip_address $medium"
+     route delete $old_ip_address 127.1 >/dev/null 2>&1
+     for router in $old_routers; do
+-      route delete default $router >/dev/null 2>&1
++      if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
++      route delete default $router >/dev/null 2>&1
++      fi
+     done
+     if [ -n "$old_static_routes" ]; then
+       set -- $old_static_routes
+@@ -166,7 +172,9 @@
+     eval "ifconfig $interface inet -alias $old_ip_address $medium"
+     route delete $old_ip_address 127.1 >/dev/null 2>&1
+     for router in $old_routers; do
+-      route delete default $router >/dev/null 2>&1
++      if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
++      route delete default $router >/dev/null 2>&1
++      fi
+     done
+     if [ -n "$old_static_routes" ]; then
+       set -- $old_static_routes
index 350378f..de26722 100644 (file)
@@ -1,20 +1,22 @@
 # common
 # $FreeBSD: src/sbin/dhclient/common/Makefile,v 1.2.2.2 2002/07/19 18:46:27 ru Exp $
-# $DragonFly: src/sbin/dhclient/common/Attic/Makefile,v 1.2 2003/06/17 04:27:32 dillon Exp $
+# $DragonFly: src/sbin/dhclient/common/Attic/Makefile,v 1.3 2005/01/04 19:58:54 joerg Exp $
 
-DIST_DIR= ${.CURDIR}/../../../contrib/isc-dhcp
-
-.PATH: ${DIST_DIR}/common
+.include "${.CURDIR}/../Makefile.common"
 
 LIB=   dhcp
 INTERNALLIB=           true
 
+.if defined(BUILDING_SERVER)   # only install for dhclient
+NOMAN= true
+.endif
+
 SRCS=  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
+       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
 
-CFLAGS+= -I${DIST_DIR}
+PATCHES=dhcp-options.5.patch discover.c.patch dispatch.c.patch parse.c.patch
 
 MAN=   dhcp-eval.5 dhcp-options.5
 
diff --git a/sbin/dhclient/common/dhcp-options.5.patch b/sbin/dhclient/common/dhcp-options.5.patch
new file mode 100644 (file)
index 0000000..5c4deb6
--- /dev/null
@@ -0,0 +1,33 @@
+$DragonFly: src/sbin/dhclient/common/Attic/dhcp-options.5.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- dhcp-options.5.orig        2004-06-10 19:59:15.000000000 +0200
++++ dhcp-options.5     2004-06-24 16:36:09.000000000 +0200
+@@ -421,7 +421,10 @@
+ the domain-name option to specify the domain name).  See RFC 1035 for
+ character set restrictions.  This option is only honored by
+ .B dhclient-script(8)
+-if the hostname for the client machine is not set.
++if the hostname for the client machine is not set (i.e., set to the empty
++string in
++.B rc.conf(5)
++).
+ .RE
+ .PP
+ .B option \fBieee802-3-encapsulation\fR \fIflag\fR\fB;\fR
+@@ -644,7 +647,7 @@
+ This option specifies whether the client should configure its IP
+ layer to allow forwarding of datagrams with non-local source routes
+ (see Section 3.3.5 of [4] for a discussion of this topic).  A value
+-of false means disallow forwarding of such datagrams, and a value of true
++of 0 means disallow forwarding of such datagrams, and a value of true
+ means allow forwarding.
+ .RE
+ .PP
+@@ -938,7 +941,7 @@
+ .PP
+ This option specifies whether or not the client should negotiate the
+ use of trailers (RFC 893 [14]) when using the ARP protocol.  A value
+-of false indicates that the client should not attempt to use trailers.  A
++of 0 indicates that the client should not attempt to use trailers.  A
+ value of true means that the client should attempt to use trailers.
+ .RE
+ .PP
diff --git a/sbin/dhclient/common/discover.c.patch b/sbin/dhclient/common/discover.c.patch
new file mode 100644 (file)
index 0000000..4f9996b
--- /dev/null
@@ -0,0 +1,239 @@
+$DragonFly: src/sbin/dhclient/common/Attic/discover.c.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- discover.c.orig    2004-06-10 19:59:16.000000000 +0200
++++ discover.c 2004-06-24 16:36:10.000000000 +0200
+@@ -38,6 +38,7 @@
+ #endif /* not lint */
+ #include "dhcpd.h"
++#include <ifaddrs.h>
+ #include <sys/ioctl.h>
+ struct interface_info *interfaces, *dummy_interfaces, *fallback_interface;
+@@ -126,10 +127,7 @@
+ {
+       struct interface_info *tmp, *ip;
+       struct interface_info *last, *next;
+-      char buf [2048];
+-      struct ifconf ic;
+-      struct ifreq ifr;
+-      int i;
++      struct ifaddrs *ifap, *ifa;
+       int sock;
+       int address_count = 0;
+       struct subnet *subnet;
+@@ -148,61 +146,6 @@
+       if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+               log_fatal ("Can't create addrlist socket");
+-      /* Get the interface configuration information... */
+-
+-#ifdef SIOCGIFCONF_ZERO_PROBE
+-      /* linux will only tell us how long a buffer it wants if we give it
+-       * a null buffer first. So, do a dry run to figure out the length.
+-       * 
+-       * XXX this code is duplicated from below because trying to fold
+-       * the logic into the if statement and goto resulted in excesssive
+-       * obfuscation. The intent is that unless you run Linux you shouldn't
+-       * have to deal with this. */
+-
+-      ic.ifc_len = 0;
+-      ic.ifc_ifcu.ifcu_buf = (caddr_t)NULL;
+-#else
+-      /* otherwise, we just feed it a starting size, and it'll tell us if
+-       * it needs more */
+-
+-      ic.ifc_len = sizeof buf;
+-      ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
+-#endif
+-
+-      gifconf_again:
+-      i = ioctl(sock, SIOCGIFCONF, &ic);
+-
+-      if (i < 0)
+-              log_fatal ("ioctl: SIOCGIFCONF: %m");
+-
+-#ifdef SIOCGIFCONF_ZERO_PROBE
+-      /* Workaround for SIOCGIFCONF bug on some Linux versions. */
+-      if (ic.ifc_ifcu.ifcu_buf == 0 && ic.ifc_len == 0) {
+-              ic.ifc_len = sizeof buf;
+-              ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
+-              goto gifconf_again;
+-      }
+-#endif
+-
+-      /* If the SIOCGIFCONF resulted in more data than would fit in
+-         a buffer, allocate a bigger buffer. */
+-      if ((ic.ifc_ifcu.ifcu_buf == buf 
+-#ifdef SIOCGIFCONF_ZERO_PROBE
+-           || ic.ifc_ifcu.ifcu_buf == 0
+-#endif
+-              ) && ic.ifc_len > sizeof buf) {
+-              ic.ifc_ifcu.ifcu_buf = dmalloc ((size_t)ic.ifc_len, MDL);
+-              if (!ic.ifc_ifcu.ifcu_buf)
+-                      log_fatal ("Can't allocate SIOCGIFCONF buffer.");
+-              goto gifconf_again;
+-#ifdef SIOCGIFCONF_ZERO_PROBE
+-      } else if (ic.ifc_ifcu.ifcu_buf == 0) {
+-              ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
+-              ic.ifc_len = sizeof buf;
+-              goto gifconf_again;
+-#endif
+-      }
+-
+               
+       /* If we already have a list of interfaces, and we're running as
+          a DHCP server, the interfaces were requested. */
+@@ -215,51 +158,38 @@
+       else
+               ir = INTERFACE_REQUESTED;
++      if (getifaddrs(&ifap) != 0)
++              log_fatal ("getifaddrs failed");
++
+       /* Cycle through the list of interfaces looking for IP addresses. */
+-      for (i = 0; i < ic.ifc_len;) {
+-              struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i);
+-#ifdef HAVE_SA_LEN
+-              if (ifp -> ifr_addr.sa_len > sizeof (struct sockaddr))
+-                      i += (sizeof ifp -> ifr_name) + ifp -> ifr_addr.sa_len;
+-              else
+-#endif
+-                      i += sizeof *ifp;
++      for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
+ #ifdef ALIAS_NAMES_PERMUTED
+-              if ((s = strrchr (ifp -> ifr_name, ':'))) {
++              if ((s = strrchr (ifa -> ifa_name, ':'))) {
+                       *s = 0;
+               }
+ #endif
+ #ifdef SKIP_DUMMY_INTERFACES
+-              if (!strncmp (ifp -> ifr_name, "dummy", 5))
++              if (!strncmp (ifa -> ifa_name, "dummy", 5))
+                       continue;
+ #endif
+-
+-              /* See if this is the sort of interface we want to
+-                 deal with. */
+-              strcpy (ifr.ifr_name, ifp -> ifr_name);
+-              if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0)
+-                      log_fatal ("Can't get interface flags for %s: %m",
+-                             ifr.ifr_name);
+-
+               /* See if we've seen an interface that matches this one. */
+               for (tmp = interfaces; tmp; tmp = tmp -> next)
+-                      if (!strcmp (tmp -> name, ifp -> ifr_name))
++                      if (!strcmp (tmp -> name, ifa -> ifa_name))
+                               break;
+-              /* Skip non broadcast interfaces (plus loopback and
+-                 point-to-point in case an OS incorrectly marks them
+-                 as broadcast). Also skip down interfaces unless we're
++              /* See if this is the sort of interface we want to
++                 deal with.  Skip loopback, point-to-point and down
++                 interfaces, except don't skip down interfaces if we're
+                  trying to get a list of configurable interfaces. */
+-              if (((!(ifr.ifr_flags & IFF_BROADCAST) ||
+-                    ifr.ifr_flags & IFF_LOOPBACK ||
+-                    ifr.ifr_flags & IFF_POINTOPOINT) && !tmp) ||
+-                  (!(ifr.ifr_flags & IFF_UP) &&
++              if ((ifa->ifa_flags & IFF_LOOPBACK) ||
++                   (ifa->ifa_flags & IFF_POINTOPOINT) ||
++                   (!(ifa->ifa_flags & IFF_UP) &&
+                    state != DISCOVER_UNCONFIGURED))
+                       continue;
+-              
++
+               /* If there isn't already an interface by this name,
+                  allocate one. */
+               if (!tmp) {
+@@ -267,9 +197,9 @@
+                       status = interface_allocate (&tmp, MDL);
+                       if (status != ISC_R_SUCCESS)
+                               log_fatal ("Error allocating interface %s: %s",
+-                                         ifp -> ifr_name,
++                                         ifa -> ifa_name,
+                                          isc_result_totext (status));
+-                      strcpy (tmp -> name, ifp -> ifr_name);
++                      strcpy (tmp -> name, ifa -> ifa_name);
+                       interface_snorf (tmp, ir);
+                       interface_dereference (&tmp, MDL);
+                       tmp = interfaces; /* XXX */
+@@ -281,9 +211,9 @@
+               /* If we have the capability, extract link information
+                  and record it in a linked list. */
+ #ifdef HAVE_AF_LINK
+-              if (ifp -> ifr_addr.sa_family == AF_LINK) {
++              if (ifa -> ifa_addr->sa_family == AF_LINK) {
+                       struct sockaddr_dl *foo = ((struct sockaddr_dl *)
+-                                                 (&ifp -> ifr_addr));
++                                                 (ifa -> ifa_addr));
+ #if defined (HAVE_SIN_LEN)
+                       tmp -> hw_address.hlen = foo -> sdl_alen;
+ #else
+@@ -296,12 +226,11 @@
+               } else
+ #endif /* AF_LINK */
+-              if (ifp -> ifr_addr.sa_family == AF_INET) {
++              if (ifa -> ifa_addr->sa_family == AF_INET) {
+                       struct iaddr addr;
+                       /* Get a pointer to the address... */
+-                      memcpy (&foo, &ifp -> ifr_addr,
+-                              sizeof ifp -> ifr_addr);
++                      bcopy(ifa->ifa_addr, &foo, sizeof(foo));
+                       /* We don't want the loopback interface. */
+                       if (foo.sin_addr.s_addr == htonl (INADDR_LOOPBACK) &&
+@@ -314,16 +243,15 @@
+                          found, keep a pointer to ifreq structure in
+                          which we found it. */
+                       if (!tmp -> ifp) {
+-#ifdef HAVE_SA_LEN
+-                              unsigned len = ((sizeof ifp -> ifr_name) +
+-                                              ifp -> ifr_addr.sa_len);
+-#else
+-                              unsigned len = sizeof *ifp;
+-#endif
++
++                              int len = (IFNAMSIZ +
++                                      ifa -> ifa_addr->sa_len);
+                               tif = (struct ifreq *)dmalloc (len, MDL);
+                               if (!tif)
+                                       log_fatal ("no space for ifp.");
+-                              memcpy (tif, ifp, len);
++                              strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ);
++                              memcpy(&tif->ifr_addr, ifa->ifa_addr,
++                                      ifa->ifa_addr->sa_len);
+                               tmp -> ifp = tif;
+                               tmp -> primary_address = foo.sin_addr;
+                       }
+@@ -337,9 +265,6 @@
+               }
+       }
+-      /* If we allocated a buffer, free it. */
+-      if (ic.ifc_ifcu.ifcu_buf != buf)
+-              dfree (ic.ifc_ifcu.ifcu_buf, MDL);
+ #if defined (LINUX_SLASHPROC_DISCOVERY)
+       /* On Linux, interfaces that don't have IP addresses don't
+@@ -520,6 +445,7 @@
+          be able to configure, we can quit now. */
+       if (state == DISCOVER_UNCONFIGURED) {
+               close (sock);
++              freeifaddrs(ifap);
+               return;
+       }
+@@ -665,6 +591,7 @@
+       }
+       close (sock);
++      freeifaddrs(ifap);
+       if (state == DISCOVER_SERVER && wifcount == 0) {
+               log_info ("%s", "");
diff --git a/sbin/dhclient/common/dispatch.c.patch b/sbin/dhclient/common/dispatch.c.patch
new file mode 100644 (file)
index 0000000..838e385
--- /dev/null
@@ -0,0 +1,30 @@
+$DragonFly: src/sbin/dhclient/common/Attic/dispatch.c.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- dispatch.c.orig    2004-06-10 19:59:16.000000000 +0200
++++ dispatch.c 2004-06-24 17:09:15.000000000 +0200
+@@ -86,11 +86,26 @@
+ void dispatch ()
+ {
+       struct timeval tv, *tvp;
++#ifdef ENABLE_POLLING_MODE
++      struct timeval *tvp_new;
++      TIME cur_time;
++#endif
+       isc_result_t status;
++      tvp = NULL;
++#ifdef ENABLE_POLLING_MODE
++      tvp_new = NULL;
++#endif
+       /* Wait for a packet or a timeout... XXX */
+       do {
+               tvp = process_outstanding_timeouts (&tv);
++#ifdef ENABLE_POLLING_MODE
++              GET_TIME (&cur_time);
++              add_timeout(cur_time + polling_interval, state_polling, 0, 0, 0);
++              tvp_new = process_outstanding_timeouts(&tv);
++              if (tvp != NULL && (tvp -> tv_sec > tvp_new -> tv_sec))
++                      tvp = tvp_new;
++#endif /* ENABLE_POLLING_MODE */
+               status = omapi_one_dispatch (0, tvp);
+       } while (status == ISC_R_TIMEDOUT || status == ISC_R_SUCCESS);
+       log_fatal ("omapi_one_dispatch failed: %s -- exiting.",
diff --git a/sbin/dhclient/common/parse.c.patch b/sbin/dhclient/common/parse.c.patch
new file mode 100644 (file)
index 0000000..9f76e44
--- /dev/null
@@ -0,0 +1,23 @@
+$DragonFly: src/sbin/dhclient/common/Attic/parse.c.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- parse.c.orig       2004-06-17 22:54:38.000000000 +0200
++++ parse.c    2004-06-24 16:36:17.000000000 +0200
+@@ -405,6 +405,7 @@
+ {
+       const char *val;
+       enum dhcp_token token;
++      int32_t num;
+       token = next_token (&val, (unsigned *)0, cfile);
+       if (token != NUMBER) {
+@@ -412,9 +413,9 @@
+               skip_to_semi (cfile);
+               return;
+       }
+-      convert_num (cfile, (unsigned char *)timep, val, 10, 32);
++      convert_num (cfile, (unsigned char *)&num, val, 10, 32);
+       /* Unswap the number - convert_num returns stuff in NBO. */
+-      *timep = ntohl (*timep); /* XXX */
++      *timep = ntohl (num);
+       parse_semi (cfile);
+ }
diff --git a/sbin/dhclient/dhclient-script.sh b/sbin/dhclient/dhclient-script.sh
deleted file mode 100644 (file)
index 1e68f03..0000000
+++ /dev/null
@@ -1,515 +0,0 @@
-#!/bin/sh
-
-#############################################################################
-#
-# Copyright (c) 1999, MindStep Corporation
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-#############################################################################
-#
-# This script was written by Patrick Bihan-Faou, patrick@mindstep.com,
-# Please contact us for bug reports, etc.
-#
-#############################################################################
-# $MindStep_Id: dhclient-script.sh,v 1.8 1999/12/07 22:11:08 patrick Exp $
-# $MindStep_Tag: CONTRIB_19991207 $
-# $FreeBSD: src/sbin/dhclient/dhclient-script.sh,v 1.2.2.1 2002/04/11 10:21:20 murray Exp $
-# $DragonFly: src/sbin/dhclient/Attic/dhclient-script.sh,v 1.2 2003/06/17 04:27:32 dillon Exp $
-#############################################################################
-
-
-#############################################################################
-# hook functions prototypes
-#
-# The "pre_state_XXX_hook" functions are called before the main
-# work is done for the state XXX
-#
-# The "post_state_XXX_hook" functions are called after the main
-# work is done for the state XXX
-#
-# These functions are meant to be overridden by the user's
-# dhclient-enter-hooks file
-#############################################################################
-
-pre_state_MEDIUM_hook () { }
-pre_state_PREINIT_hook () { }
-pre_state_ARPCHECK_hook () { }
-pre_state_ARPSEND_hook () { }
-pre_state_RENEW_hook () { }
-pre_state_REBIND_hook () { }
-pre_state_BOUND_hook () { }
-pre_state_REBOOT_hook () { }
-pre_state_EXPIRE_hook () { }
-pre_state_FAIL_hook () { }
-pre_state_TIMEOUT_hook () { }
-post_state_MEDIUM_hook () { }
-post_state_PREINIT_hook () { }
-post_state_ARPCHECK_hook () { }
-post_state_ARPSEND_hook () { }
-post_state_RENEW_hook () { }
-post_state_REBIND_hook () { }
-post_state_BOUND_hook () { }
-post_state_REBOOT_hook () { }
-post_state_EXPIRE_hook () { }
-post_state_FAIL_hook () { }
-post_state_TIMEOUT_hook () { }
-
-#############################################################################
-# make_resolv_conf
-#
-# This function is called to update the information related to the
-# DNS configuration (the resolver part)
-#############################################################################
-make_resolv_conf () 
-{
-   if [ "x$new_domain_name" != x ] && [ "x$new_domain_name_servers" != x ]; then
-     echo search $new_domain_name >/etc/resolv.conf
-     for nameserver in $new_domain_name_servers; do
-       echo nameserver $nameserver >>/etc/resolv.conf
-     done
-   fi
-}
-
-# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
-exit_with_hooks () {
-  exit_status=$1
-  if [ -x /etc/dhclient-exit-hooks ]; then
-    . /etc/dhclient-exit-hooks
-  fi
-# probably should do something with exit status of the local script
-  return $exit_status
-}
-
-#############################################################################
-# set_XXX
-# unset_XXX
-#
-# These function each deal with one particular setting.
-# They are OS dependent and may be overridden in the 
-# dhclient-enter-hooks file if needed.
-#
-# These functions are called with either "new" or "old" to indicate which
-# set of variables to use (new_ip_address or old_ip_address...)
-#
-#############################################################################
-
-update_hostname ()
-{
-       local current_hostname=`/bin/hostname`
-       if      [ "$current_hostname" = "" ] || \
-               [ "$current_hostname" = "$old_host_name" ]
-       then
-               if [ "$new_host_name" != "$old_host_name" ]
-               then
-                       $LOGGER "New Hostname: $new_host_name"
-                       hostname $new_host_name
-               fi
-       fi
-}
-
-set_ip_address () 
-{
-       local ip
-       local mask
-       local bcast
-
-       if [ $# -lt 1 ]
-       then
-               return  1
-       fi
-
-       eval ip="\$${1}_ip_address"
-       eval mask="\$${1}_subnet_mask"
-       eval bcast="\$${1}_broadcast_address"
-
-       if [ "$ip" != "" ]
-       then
-               ifconfig $interface inet $ip netmask $mask broadcast $bcast $medium
-#              route add $ip 127.0.0.1 > /dev/null 2>&1
-       fi
-}
-
-unset_ip_address () 
-{
-       local ip
-
-       if [ $# -lt 1 ]
-       then
-               return  1
-       fi
-
-       eval ip="\$${1}_ip_address"
-
-       if [ "$ip" != "" ]
-       then
-               ifconfig $interface inet -alias $ip $medium
-#              route delete $ip 127.0.0.1 > /dev/null 2>&1
-       fi
-}
-
-set_ip_alias () 
-{
-       if [ "$alias_ip_address" != "" ]
-       then
-               ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask
-#              route add $alias_ip_address 127.0.0.1
-       fi
-}
-
-unset_ip_alias () 
-{
-       if [ "$alias_ip_address" != "" ]
-       then
-               ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
-#              route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
-       fi
-}
-
-set_routers () 
-{
-       local router_list
-
-       if [ $# -lt 1 ]
-       then
-               return  1
-       fi
-
-       eval router_list="\$${1}_routers"
-
-       for router in $router_list
-       do
-               route add default $router >/dev/null 2>&1
-       done
-}
-
-unset_routers () 
-{
-       local router_list
-
-       if [ $# -lt 1 ]
-       then
-               return  1
-       fi
-
-       eval router_list="\$${1}_routers"
-
-       for router in $router_list
-       do
-               route delete default $router >/dev/null 2>&1
-       done
-}
-
-set_static_routes () 
-{
-       local static_routes
-
-       if [ $# -lt 1 ]
-       then
-               return  1
-       fi
-
-       eval static_routes="\$${1}_static_routes"
-
-       set static_routes
-
-       while [ $# -ge 2 ]
-       do
-               $LOGGER "New Static Route: $1 -> $2"
-               route add $1 $2
-               shift; shift
-       done
-}
-
-unset_static_routes () 
-{
-       local static_routes
-
-       if [ $# -lt 1 ]
-       then
-               return  1
-       fi
-
-       eval static_routes="\$${1}_static_routes"
-
-       set static_routes
-
-       while [ $# -ge 2 ]
-       do
-               route delete $1 $2
-               shift; shift
-       done
-}
-
-#############################################################################
-#
-# utility functions grouping what needs to be done in logical units.
-#
-#############################################################################
-
-set_all ()
-{
-       set_ip_address new
-       set_routers new
-       set_static_routes new
-
-       if      [ "$new_ip_address" != "$alias_ip_address" ]
-       then
-               set_ip_alias
-       fi
-}
-
-set_others ()
-{
-       update_hostname
-       make_resolv_conf
-}
-
-clear_arp_table () 
-{
-       arp -d -a
-}
-
-unset_all ()
-{
-       if [ "$alias_ip_address" != "$old_ip_address" ]
-       then
-               unset_ip_alias
-       fi
-
-       if [ "$old_ip_address" != "" ] 
-       then
-               unset_ip_address old
-               unset_routers old
-               unset_static_routes old
-               clear_arp_table
-       fi
-}
-
-test_new_lease () 
-{
-       local rc
-
-       set $new_routers
-
-       if [ $# -ge 1 ]
-       then
-               set_ip_address new
-       if ping -q -c 1 $1
-               then
-                       rc=0
-               else
-                       rc=1
-               fi
-               unset_ip_address new
-       else
-               rc=1
-       fi
-       return  $rc
-}
-
-#############################################################################
-# Main State functions.
-#
-# There is a state function for each state of the DHCP client
-# These functions are OS specific and should be be tampered with.
-#############################################################################
-
-in_state_MEDIUM () 
-{
-  ifconfig $interface $medium
-  ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
-  sleep 1
-  exit_status=0
-}
-
-in_state_PREINIT () 
-{
-       unset_ip_alias
-
-       ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
-                       broadcast 255.255.255.255 up
-       exit_status=0
-}
-
-in_state_ARPCHECK () 
-{
-  exit_status=0
-}
-
-in_state_ARPSEND () 
-{
-  exit_status=0
-}
-
-in_state_RENEW () 
-{
-       if [ "$old_ip_address" != "$new_ip_address" ]
-       then
-               unset_all
-               set_all
-       fi
-
-       set_others
-}
-
-in_state_REBIND () {
-       in_state_RENEW
-}
-
-in_state_BOUND () {
-       unset_all
-       set_all
-       set_others
-}
-
-in_state_REBOOT () {
-       in_state_BOUND
-}
-
-in_state_EXPIRE () 
-{
-       unset_all
-       set_ip_alias
-       exit_status=0
-}
-
-in_state_FAIL () {
-       in_state_EXPIRE
-}
-
-in_state_TIMEOUT () 
-{
-       unset_all
-
-       if test_new_lease
-       then
-               set_all
-               set_others
-       else
-               $LOGGER "No good lease information in TIMEOUT state"    
-               set_ip_alias
-               exit_status=1
-       fi
-}
-
-#############################################################################
-# Main functions:
-#
-# dhclient_script_init() parses the optional "enter_hooks" script which can
-#   override any of the state functions
-#
-# This function also parses the variables and notifies the detected changes.
-#############################################################################
-dhclient_script_init ()
-{
-       if [ -x /usr/bin/logger ]; then
-               LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
-       else
-               LOGGER=echo
-       fi
-
-       # Invoke the local dhcp client enter hooks, if they exist.
-       if [ -x /etc/dhclient-enter-hooks ]
-       then
-               exit_status=0
-               . /etc/dhclient-enter-hooks
-               # allow the local script to abort processing of this state
-               # local script must set exit_status variable to nonzero.
-               if [ $exit_status -ne 0 ]
-               then
-                       exit $exit_status
-               fi
-       fi
-
-       if [ "$new_network_number" != "" ]
-       then
-               $LOGGER "New Network Number: $new_network_number"
-       fi
-
-       if [ "$new_ip_address" != "" ]
-       then
-               $LOGGER "New IP Address: $new_ip_address"
-       fi
-
-       if [ "$new_broadcast_address" != "" ]
-       then
-               $LOGGER "New Broadcast Address: $new_broadcast_address"
-       fi
-
-       if [ "$new_subnet_mask" != "" ]
-       then
-               $LOGGER "New Subnet Mask for $interface: $new_subnet_mask"
-       fi
-
-       if [ "$alias_subnet_mask" != "" ]
-       then
-       fi
-}
-
-#############################################################################
-# dhclient_main() does the appropriate work depending on the state of
-# the dhcp client
-#############################################################################
-dhclient_script_main ()
-{
-#      set -x
-       exit_status=0
-
-       case $reason in
-               MEDIUM|\
-               PREINIT|\
-               ARPCHECK|\
-               ARPSEND|\
-               RENEW|\
-               REBIND|\
-               BOUND|\
-               REBOOT|\
-               EXPIRE|\
-               FAIL|\
-               TIMEOUT)
-                       pre_state_${reason}_hook
-                       in_state_${reason}
-                       post_state_${reason}_hook
-                       ;;
-               *)
-                       $LOGGER "dhclient-script called with invalid reason $reason"
-                       exit_status=1
-                       ;;
-       esac
-
-       exit_with_hooks $exit_status
-}
-
-#############################################################################
-# Let's do the work...
-#############################################################################
-
-dhclient_script_init
-dhclient_script_main
-exit $exit_status
-
-#############################################################################
-# That's all folks
-#############################################################################
index ccbd492..0221adc 100644 (file)
@@ -1,10 +1,8 @@
 # dst
 # $FreeBSD: src/sbin/dhclient/dst/Makefile,v 1.2.2.2 2002/07/19 18:46:27 ru Exp $
-# $DragonFly: src/sbin/dhclient/dst/Attic/Makefile,v 1.2 2003/06/17 04:27:32 dillon Exp $
+# $DragonFly: src/sbin/dhclient/dst/Attic/Makefile,v 1.3 2005/01/04 19:58:54 joerg Exp $
 
-DIST_DIR= ${.CURDIR}/../../../contrib/isc-dhcp
-
-.PATH: ${DIST_DIR}/dst
+.include "${.CURDIR}/../Makefile.common"
 
 LIB=    dst
 INTERNALLIB=           true
diff --git a/sbin/dhclient/includes/Makefile b/sbin/dhclient/includes/Makefile
new file mode 100644 (file)
index 0000000..ef24ba6
--- /dev/null
@@ -0,0 +1,13 @@
+# $DragonFly: src/sbin/dhclient/includes/Attic/Makefile,v 1.1 2005/01/04 19:58:54 joerg Exp $
+
+.include "${.CURDIR}/../Makefile.common"
+
+CURSUBDIR=     includes/
+
+SRCS=  dhcpd.h.patch osdep.h.patch
+
+OBJS=  ${SRCS:S/.patch//}
+
+all: ${OBJS}
+
+.include <bsd.prog.mk>
diff --git a/sbin/dhclient/includes/dhcpd.h.patch b/sbin/dhclient/includes/dhcpd.h.patch
new file mode 100644 (file)
index 0000000..3e69d9b
--- /dev/null
@@ -0,0 +1,89 @@
+$DragonFly: src/sbin/dhclient/includes/Attic/dhcpd.h.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- dhcpd.h.orig       2004-11-24 18:39:16.000000000 +0100
++++ dhcpd.h    2005-01-04 19:11:18.000000000 +0100
+@@ -90,6 +90,9 @@
+        (((x) >> OPTION_HASH_EXP) & \
+         (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
++#define NOLINK 0
++#define HAVELINK 1
++
+ enum dhcp_shutdown_state {
+       shutdown_listeners,
+       shutdown_omapi_connections,
+@@ -255,7 +258,7 @@
+ } dhcp_control_object_t;
+ /* Lease states: */
+-typedef enum {
++typedef enum  {
+       FTS_FREE = 1,
+       FTS_ACTIVE = 2,
+       FTS_EXPIRED = 3,
+@@ -263,7 +266,7 @@
+       FTS_ABANDONED = 5,
+       FTS_RESET = 6,
+       FTS_BACKUP = 7
+-} binding_state_t;
++} __packed binding_state_t;
+ /* FTS_LAST is the highest value that is valid for a lease binding state. */
+ #define FTS_LAST FTS_BACKUP
+@@ -306,9 +309,9 @@
+ #     define EPHEMERAL_FLAGS          (MS_NULL_TERMINATION | \
+                                        UNICAST_BROADCAST_HACK)
+-      binding_state_t __attribute__ ((mode (__byte__))) binding_state;
+-      binding_state_t __attribute__ ((mode (__byte__))) next_binding_state;
+-      binding_state_t __attribute__ ((mode (__byte__))) desired_binding_state;
++      binding_state_t binding_state;
++      binding_state_t next_binding_state;
++      binding_state_t desired_binding_state;
+       
+       struct lease_state *state;
+@@ -774,6 +777,11 @@
+       unsigned remote_id_len;         /* Length of Remote ID. */
+       char name [IFNAMSIZ];           /* Its name... */
++      int ieee80211;                  /* True if media is ieee802.11 */
++      int havemedia;                  /* True if we have a media table */
++      int linkstate;                  /* True if we have link */
++      int polling;                    /* True if polling is enabled */
++      int forcediscover;              /* True if a discover is needed */
+       int index;                      /* Its index. */
+       int rfdesc;                     /* Its read file descriptor. */
+       int wfdesc;                     /* Its write file descriptor, if
+@@ -1836,6 +1844,9 @@
+ extern const char *path_dhclient_pid;
+ extern char *path_dhclient_script;
+ extern int interfaces_requested;
++#ifdef ENABLE_POLLING_MODE
++extern int polling_interval;
++#endif
+ extern struct client_config top_level_config;
+@@ -1849,6 +1860,10 @@
+ void send_decline PROTO ((void *));
+ void state_reboot PROTO ((void *));
++#ifdef ENABLE_POLLING_MODE
++void state_background PROTO ((void *));
++void state_polling PROTO ((void *));
++#endif
+ void state_init PROTO ((void *));
+ void state_selecting PROTO ((void *));
+ void state_requesting PROTO ((void *));
+@@ -1856,6 +1871,11 @@
+ void state_stop PROTO ((void *));
+ void state_panic PROTO ((void *));
++#if defined(DRAGONFLY_FUTURE)
++void set_ieee80211 PROTO ((struct interface_info *));
++#endif
++int interface_active PROTO ((struct interface_info *));
++
+ void bind_lease PROTO ((struct client_state *));
+ void make_client_options PROTO ((struct client_state *,
diff --git a/sbin/dhclient/includes/osdep.h.patch b/sbin/dhclient/includes/osdep.h.patch
new file mode 100644 (file)
index 0000000..d1850f5
--- /dev/null
@@ -0,0 +1,12 @@
+$DragonFly: src/sbin/dhclient/includes/Attic/osdep.h.patch,v 1.1 2005/01/04 19:58:54 joerg Exp $
+--- osdep.h.orig       2004-06-14 23:08:44.000000000 +0200
++++ osdep.h    2004-06-24 17:17:36.000000000 +0200
+@@ -89,7 +89,7 @@
+ #  include "cf/netbsd.h"
+ #endif
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+ #  include "cf/freebsd.h"
+ #endif
index 3165b39..aeb2ead 100644 (file)
@@ -1,10 +1,8 @@
 # minires
 # $FreeBSD: src/sbin/dhclient/minires/Makefile,v 1.4.2.2 2002/07/19 18:46:27 ru Exp $
-# $DragonFly: src/sbin/dhclient/minires/Attic/Makefile,v 1.2 2003/06/17 04:27:32 dillon Exp $
+# $DragonFly: src/sbin/dhclient/minires/Attic/Makefile,v 1.3 2005/01/04 19:58:54 joerg Exp $
 
-DIST_DIR= ${.CURDIR}/../../../contrib/isc-dhcp
-
-.PATH: ${DIST_DIR}/minires
+.include "${.CURDIR}/../Makefile.common"
 
 LIB=   res
 INTERNALLIB=           true
index a76833f..f113371 100644 (file)
@@ -1,19 +1,20 @@
 # omapip
 # $FreeBSD: src/sbin/dhclient/omapip/Makefile,v 1.2.2.2 2002/07/19 18:46:27 ru Exp $
-# $DragonFly: src/sbin/dhclient/omapip/Attic/Makefile,v 1.2 2003/06/17 04:27:32 dillon Exp $
+# $DragonFly: src/sbin/dhclient/omapip/Attic/Makefile,v 1.3 2005/01/04 19:58:54 joerg Exp $
 
-DIST_DIR= ${.CURDIR}/../../../contrib/isc-dhcp
-
-.PATH: ${DIST_DIR}/omapip
+.include "${.CURDIR}/../Makefile.common"
 
 LIB=    omapi
-INTERNALLIB=           true
+
+.if !defined(BUILDING_SERVER)          # only install with server
+INTERNALLIB=   true
+NOMAN=         true
+.endif
 
 SRCS=  alloc.c array.c auth.c buffer.c connection.c convert.c dispatch.c \
        errwarn.c generic.c handle.c hash.c inet_addr.c listener.c \
        message.c mrtrace.c protocol.c result.c support.c toisc.c trace.c
 
 MAN=   omapi.3
-NOMAN= true
 
 .include <bsd.lib.mk>
index 015c5af..7fc2b7b 100644 (file)
@@ -1,6 +1,6 @@
 #      From: @(#)Makefile      5.20 (Berkeley) 6/12/93
 # $FreeBSD: src/usr.sbin/Makefile,v 1.183.2.14 2003/04/16 11:01:51 ru Exp $
-# $DragonFly: src/usr.sbin/Makefile,v 1.17 2004/12/01 15:04:43 joerg Exp $
+# $DragonFly: src/usr.sbin/Makefile,v 1.18 2005/01/04 19:58:53 joerg Exp $
 
 # XXX MISSING:         mkproto
 SUBDIR=        IPXrouted \
@@ -149,6 +149,10 @@ SUBDIR+=named \
        nsupdate
 .endif
 
+.if !defined(NO_DHCPD)
+SUBDIR+=dhcp
+.endif
+
 .if !defined(NO_LPR)
 SUBDIR+=lpr
 .endif
diff --git a/usr.sbin/dhcp/Makefile b/usr.sbin/dhcp/Makefile
new file mode 100644 (file)
index 0000000..21bc853
--- /dev/null
@@ -0,0 +1,12 @@
+# Makefile for ISC DHCP server.
+# $DragonFly: src/usr.sbin/dhcp/Attic/Makefile,v 1.1 2005/01/04 19:58:53 joerg Exp $ 
+
+.include "Makefile.common"
+
+BUILDING_SERVER=true
+.makeenv BUILDING_SERVER
+
+SUBDIR=        ${DHCLIENT_DIR}/includes ${DHCLIENT_DIR}/common ${DHCLIENT_DIR}/dst \
+       ${DHCLIENT_DIR}/minires ${DHCLIENT_DIR}/omapip dhcpctl relay server
+
+.include <bsd.subdir.mk>
diff --git a/usr.sbin/dhcp/Makefile.common b/usr.sbin/dhcp/Makefile.common
new file mode 100644 (file)
index 0000000..aa4d177
--- /dev/null
@@ -0,0 +1,8 @@
+# $DragonFly: src/usr.sbin/dhcp/Attic/Makefile.common,v 1.1 2005/01/04 19:58:53 joerg Exp $
+
+DIST_DIR= ${.CURDIR}/../../../contrib/dhcp-3.0
+CURSUBDIR?=    ${.CURDIR:C|^.*/||}
+CONTRIBDIR=    ${DIST_DIR}/${CURSUBDIR}
+DHCLIENT_DIR=  ../../sbin/dhclient
+
+.PATH: ${CONTRIBDIR}
diff --git a/usr.sbin/dhcp/Makefile.inc b/usr.sbin/dhcp/Makefile.inc
new file mode 100644 (file)
index 0000000..413f150
--- /dev/null
@@ -0,0 +1,22 @@
+# $FreeBSD: src/sbin/dhclient/Makefile.inc,v 1.2.2.1 2002/04/11 10:21:20 murray Exp $
+# $DragonFly: src/usr.sbin/dhcp/Attic/Makefile.inc,v 1.1 2005/01/04 19:58:53 joerg Exp $
+
+WARNS=         0
+CFLAGS+=       -I${.OBJDIR}/../${DHCLIENT_DIR} -I${.OBJDIR}/../${DHCLIENT_DIR}/includes -I${DIST_DIR} -I${DIST_DIR}/includes
+
+CLIENTBINDIR=  /sbin
+RUNDIR=                /var/run
+ETCDIR=                /etc
+DBDIR=         /var/db
+
+MANFILTER=     sed -e 's\#DBDIR\#${DBDIR}\#g;s\#ETCDIR\#${ETCDIR}\#g;s\#CLIENTBINDIR\#${CLIENTBINDIR}\#g;s\#RUNDIR\#${RUNDIR}\#g'
+
+LIBDHCP=       ${.OBJDIR}/../${DHCLIENT_DIR}/common/libdhcp.a
+
+LIBRES=                ${.OBJDIR}/../${DHCLIENT_DIR}/minires/libres.a
+
+LIBOMAPI=      ${.OBJDIR}/../${DHCLIENT_DIR}/omapip/libomapi.a
+
+LIBDST=        ${.OBJDIR}/../${DHCLIENT_DIR}/dst/libdst.a
+
+.include "../Makefile.inc"
diff --git a/usr.sbin/dhcp/dhcpctl/Makefile b/usr.sbin/dhcp/dhcpctl/Makefile
new file mode 100644 (file)
index 0000000..317c392
--- /dev/null
@@ -0,0 +1,5 @@
+# $DragonFly: src/usr.sbin/dhcp/dhcpctl/Attic/Makefile,v 1.1 2005/01/04 19:58:54 joerg Exp $
+
+.DEFAULT:
+       cd ${.CURDIR} && ${MAKE} -f Makefile.lib ${.IMPSRC}
+       cd ${.CURDIR} && ${MAKE} -f Makefile.bin ${.IMPSRC}
diff --git a/usr.sbin/dhcp/dhcpctl/Makefile.bin b/usr.sbin/dhcp/dhcpctl/Makefile.bin
new file mode 100644 (file)
index 0000000..8d59e91
--- /dev/null
@@ -0,0 +1,9 @@
+# $DragonFly: src/usr.sbin/dhcp/dhcpctl/Attic/Makefile.bin,v 1.1 2005/01/04 19:58:54 joerg Exp $
+
+.include "${.CURDIR}/../Makefile.common"
+
+PROG=  omshell
+
+LDADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST} libdhcpctl.a
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/dhcp/dhcpctl/Makefile.lib b/usr.sbin/dhcp/dhcpctl/Makefile.lib
new file mode 100644 (file)
index 0000000..f76a8f2
--- /dev/null
@@ -0,0 +1,13 @@
+# $DragonFly: src/usr.sbin/dhcp/dhcpctl/Attic/Makefile.lib,v 1.1 2005/01/04 19:58:54 joerg Exp $
+
+.include "${.CURDIR}/../Makefile.common"
+
+LIB=   dhcpctl
+
+SRCS=  callback.c dhcpctl.c remote.c
+
+INCS=  dhcpctl.h
+
+MAN=   dhcpctl.3
+
+.include <bsd.lib.mk>
diff --git a/usr.sbin/dhcp/relay/Makefile b/usr.sbin/dhcp/relay/Makefile
new file mode 100644 (file)
index 0000000..af91945
--- /dev/null
@@ -0,0 +1,11 @@
+# $DragonFly: src/usr.sbin/dhcp/relay/Attic/Makefile,v 1.1 2005/01/04 19:58:54 joerg Exp $
+
+.include "../Makefile.common"
+
+PROG=  dhcrelay
+MAN=   dhcrelay.8
+
+LDADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST}
+SRCS=  dhcrelay.c
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/dhcp/server/Makefile b/usr.sbin/dhcp/server/Makefile
new file mode 100644 (file)
index 0000000..6ad4e05
--- /dev/null
@@ -0,0 +1,12 @@
+# $DragonFly: src/usr.sbin/dhcp/server/Attic/Makefile,v 1.1 2005/01/04 19:58:54 joerg Exp $
+
+.include "../Makefile.common"
+
+PROG=  dhcpd
+MAN=   dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
+SRCS=  bootp.c class.c confpars.c db.c ddns.c dhcp.c dhcpd.c failover.c \
+       mdb.c omapi.c salloc.c stables.c
+
+LDADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST}
+
+.include <bsd.prog.mk>