Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/dhcp Patchlevel 20



details:   https://anonhg.NetBSD.org/src/rev/1e56e472c982
branches:  trunk
changeset: 467823:1e56e472c982
user:      mellon <mellon%NetBSD.org@localhost>
date:      Mon Mar 29 23:00:49 1999 +0000

description:
Patchlevel 20

diffstat:

 usr.sbin/dhcp/client/clparse.c       |  17 +----------
 usr.sbin/dhcp/client/scripts/solaris |  49 ++++++++++++++++++++++++--------
 usr.sbin/dhcp/common/bpf.c           |   8 ++++-
 usr.sbin/dhcp/common/dispatch.c      |   8 +++--
 usr.sbin/dhcp/common/dlpi.c          |   6 ++++
 usr.sbin/dhcp/common/lpf.c           |  24 +++++++++++----
 usr.sbin/dhcp/common/nit.c           |   8 ++++-
 usr.sbin/dhcp/common/options.c       |  22 ++++++++++----
 usr.sbin/dhcp/common/parse.c         |   5 +--
 usr.sbin/dhcp/common/socket.c        |  12 +++++++-
 usr.sbin/dhcp/common/upf.c           |   8 ++++-
 usr.sbin/dhcp/includes/cf/qnx.h      |   8 +++++
 usr.sbin/dhcp/relay/dhcrelay.c       |  53 +++++++++++++++++++++++++----------
 usr.sbin/dhcp/server/confpars.c      |  17 ++++++-----
 14 files changed, 169 insertions(+), 76 deletions(-)

diffs (truncated from 668 to 300 lines):

diff -r eecdcb068efd -r 1e56e472c982 usr.sbin/dhcp/client/clparse.c
--- a/usr.sbin/dhcp/client/clparse.c    Mon Mar 29 22:13:07 1999 +0000
+++ b/usr.sbin/dhcp/client/clparse.c    Mon Mar 29 23:00:49 1999 +0000
@@ -42,14 +42,12 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: clparse.c,v 1.1.1.6 1999/03/26 17:49:19 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: clparse.c,v 1.1.1.7 1999/03/29 23:00:49 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
 #include "dhctoken.h"
 
-static TIME parsed_time;
-
 struct client_config top_level_config;
 
 /* client-conf-file :== client-declarations EOF
@@ -62,9 +60,7 @@
        FILE *cfile;
        char *val;
        int token;
-       int declaration = 0;
        struct client_config *config;
-       struct client_state *state;
        struct interface_info *ip;
 
        new_parse (path_dhclient_conf);
@@ -327,7 +323,6 @@
        int token;
        char *val;
        int len;
-       u_int8_t *s;
 
        token = peek_token (&val, cfile);
        if (token == NUMBER_OR_NAME || token == NUMBER) {
@@ -421,9 +416,7 @@
        int token;
        char *val;
 
-       struct interface_info dummy_interface, *ip;
-       struct client_state dummy_state;
-       struct client_config dummy_config;
+       struct interface_info *ip;
 
        token = next_token (&val, cfile);
        if (token != STRING) {
@@ -658,7 +651,6 @@
 {
        int token;
        char *val;
-       char *t, *n;
        struct interface_info *ip;
 
        switch (next_token (&val, cfile)) {
@@ -804,11 +796,6 @@
 
        /* Parse the option data... */
        do {
-               /* Set a flag if this is an array of a simple type (i.e.,
-                  not an array of pairs of IP addresses, or something
-                  like that. */
-               int uniform = option -> format [1] == 'A';
-
                for (fmt = option -> format; *fmt; fmt++) {
                        if (*fmt == 'A')
                                break;
diff -r eecdcb068efd -r 1e56e472c982 usr.sbin/dhcp/client/scripts/solaris
--- a/usr.sbin/dhcp/client/scripts/solaris      Mon Mar 29 22:13:07 1999 +0000
+++ b/usr.sbin/dhcp/client/scripts/solaris      Mon Mar 29 23:00:49 1999 +0000
@@ -1,5 +1,33 @@
 #!/bin/sh  
 
+make_resolv_conf() {
+  echo search $new_domain_name >/etc/resolv.conf
+  for nameserver in $new_domain_name_servers; do
+    echo nameserver $nameserver >>/etc/resolv.conf
+  done
+}
+
+# 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
+  exit $exit_status
+}
+
+# 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 [ x$new_broadcast_address != x ]; then
   new_broadcast_arg="broadcast $new_broadcast_address"
 fi
@@ -27,7 +55,7 @@
   $ifconfig $interface $medium
   $ifconfig $interface
   sleep 1
-  exit 0
+  exit_with_hooks 0
 fi
 
 if [ x$reason = xPREINIT ]; then
@@ -44,11 +72,11 @@
       $ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
               broadcast 255.255.255.255 up
   fi 
-  exit 0
+  exit_with_hooks 0
 fi
 
 if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
-  exit 0;
+  exit_with_hooks 0;
 fi
   
 if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
@@ -64,7 +92,6 @@
     for router in $old_routers; do
       route delete default $router >/dev/null 2>&1
     done
-    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh
   fi
   if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
      [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
@@ -84,7 +111,7 @@
   for nameserver in $new_domain_name_servers; do
     echo nameserver $nameserver >>/etc/resolv.conf
   done
-  exit 0
+  exit_with_hooks 0
 fi
 
 if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
@@ -98,14 +125,12 @@
     for router in $old_routers; do
       route delete default $router >/dev/null 2>&1
     done
-    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
-                                               |sh >/dev/null 2>&1
   fi
   if [ x$alias_ip_address != x ]; then
     $ifconfig ${interface}:1 inet $alias_ip_address $alias_subnet_arg
     route add $alias_ip_address 127.0.0.1 1
   fi
-  exit 0
+  exit_with_hooks 0
 fi
 
 if [ x$reason = xTIMEOUT ]; then
@@ -135,15 +160,13 @@
       rm -f /etc/resolv.conf
       ln /etc/resolv.conf.std /etc/resolv.conf
     fi
-    exit 0
+    exit_with_hooks 0
   fi
   $ifconfig $interface inet 0 down
   for router in $old_routers; do
     route delete default $router >/dev/null 2>&1
   done
-  arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
-                                                       |sh >/dev/null 2>&1
-  exit 1
+  exit_with_hooks 1
 fi
 
-exit 0
+exit_with_hooks 0
diff -r eecdcb068efd -r 1e56e472c982 usr.sbin/dhcp/common/bpf.c
--- a/usr.sbin/dhcp/common/bpf.c        Mon Mar 29 22:13:07 1999 +0000
+++ b/usr.sbin/dhcp/common/bpf.c        Mon Mar 29 23:00:49 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.1.1.5 1999/02/24 04:11:01 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.1.1.6 1999/03/29 23:00:51 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -418,6 +418,12 @@
        return 1;
 }
 
+int can_receive_unicast_unconfigured (ip)
+       struct interface_info *ip;
+{
+       return 1;
+}
+
 void maybe_setup_fallback ()
 {
        struct interface_info *fbi;
diff -r eecdcb068efd -r 1e56e472c982 usr.sbin/dhcp/common/dispatch.c
--- a/usr.sbin/dhcp/common/dispatch.c   Mon Mar 29 22:13:07 1999 +0000
+++ b/usr.sbin/dhcp/common/dispatch.c   Mon Mar 29 23:00:49 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dispatch.c,v 1.1.1.10 1999/03/26 17:49:21 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dispatch.c,v 1.1.1.11 1999/03/29 23:00:51 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -74,7 +74,6 @@
        struct ifreq ifr;
        int i;
        int sock;
-       int address_count = 0;
        struct subnet *subnet;
        struct shared_network *share;
        struct sockaddr_in foo;
@@ -139,7 +138,10 @@
                /* 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) ||
+               if ((ifr.ifr_flags & IFF_LOOPBACK) ||
+#ifdef HAVE_IFF_POINTOPOINT
+                   (ifr.ifr_flags & IFF_POINTOPOINT) ||
+#endif
                    (!(ifr.ifr_flags & IFF_UP) &&
                     state != DISCOVER_UNCONFIGURED))
                        continue;
diff -r eecdcb068efd -r 1e56e472c982 usr.sbin/dhcp/common/dlpi.c
--- a/usr.sbin/dhcp/common/dlpi.c       Mon Mar 29 22:13:07 1999 +0000
+++ b/usr.sbin/dhcp/common/dlpi.c       Mon Mar 29 23:00:49 1999 +0000
@@ -1247,6 +1247,12 @@
        return 1;
 }
 
+int can_receive_unicast_unconfigured (ip)
+       struct interface_info *ip;
+{
+       return 1;
+}
+
 void maybe_setup_fallback ()
 {
        struct interface_info *fbi;
diff -r eecdcb068efd -r 1e56e472c982 usr.sbin/dhcp/common/lpf.c
--- a/usr.sbin/dhcp/common/lpf.c        Mon Mar 29 22:13:07 1999 +0000
+++ b/usr.sbin/dhcp/common/lpf.c        Mon Mar 29 23:00:49 1999 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: lpf.c,v 1.1.1.3 1999/03/26 17:49:21 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: lpf.c,v 1.1.1.4 1999/03/29 23:00:52 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -92,10 +92,12 @@
        if ((sock = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ALL))) < 0) {
                if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
                    errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
-                   errno == EAFNOSUPPORT || errno == EINVAL)
-                       error ("socket: %m - make sure %s %s!",
-                              "CONFIG_PACKET and CONFIG_FILTER are defined",
+                   errno == EAFNOSUPPORT || errno == EINVAL) {
+                       warn ("socket: %m");
+                       error ("Make sure to set %s %s!",
+                              "CONFIG_PACKET=y and CONFIG_FILTER=y",
                               "in your kernel configuration");
+               }
                error("Open a socket for LPF: %m");
        }
 
@@ -106,10 +108,12 @@
        if (bind (sock, &sa, sizeof sa)) {
                if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
                    errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
-                   errno == EAFNOSUPPORT || errno == EINVAL)
-                       error ("socket: %m - make sure %s %s!",
-                              "CONFIG_PACKET and CONFIG_FILTER are defined",
+                   errno == EAFNOSUPPORT || errno == EINVAL) {
+                       warn ("bind: %m");
+                       error ("Set %s %s!",
+                              "CONFIG_PACKET=y and CONFIG_FILTER=y",
                               "in your kernel configuration");
+               }
                error("Bind socket to interface: %m");
        }
 
@@ -280,6 +284,12 @@
        return 1;
 }



Home | Main Index | Thread Index | Old Index