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 25



details:   https://anonhg.NetBSD.org/src/rev/7d815e65b3b3
branches:  trunk
changeset: 471736:7d815e65b3b3
user:      mellon <mellon%NetBSD.org@localhost>
date:      Fri Apr 09 17:52:05 1999 +0000

description:
Patchlevel 25

diffstat:

 usr.sbin/dhcp/common/conflex.c    |   4 +-
 usr.sbin/dhcp/common/hash.c       |  47 +++++++------------
 usr.sbin/dhcp/common/raw.c        |  40 +++++++++++-----
 usr.sbin/dhcp/includes/cf/irix.h  |  93 +++++++++++++++++++++++++++++++++++++++
 usr.sbin/dhcp/includes/dhctoken.h |   1 +
 usr.sbin/dhcp/includes/osdep.h    |   5 +-
 usr.sbin/dhcp/relay/dhcrelay.c    |   4 +-
 usr.sbin/dhcp/server/confpars.c   |   6 ++-
 8 files changed, 154 insertions(+), 46 deletions(-)

diffs (truncated from 358 to 300 lines):

diff -r 7df0f7c523b5 -r 7d815e65b3b3 usr.sbin/dhcp/common/conflex.c
--- a/usr.sbin/dhcp/common/conflex.c    Fri Apr 09 17:50:15 1999 +0000
+++ b/usr.sbin/dhcp/common/conflex.c    Fri Apr 09 17:52:05 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: conflex.c,v 1.1.1.5 1999/02/18 21:48:49 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: conflex.c,v 1.1.1.6 1999/04/09 17:52:05 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -354,6 +354,8 @@
 
        switch (tolower (atom [0])) {
              case 'a':
+               if (!strcasecmp (atom + 1, "lways-reply-rfc1048"))
+                       return ALWAYS_REPLY_RFC1048;
                if (!strcasecmp (atom + 1, "ppend"))
                        return APPEND;
                if (!strcasecmp (atom + 1, "llow"))
diff -r 7df0f7c523b5 -r 7d815e65b3b3 usr.sbin/dhcp/common/hash.c
--- a/usr.sbin/dhcp/common/hash.c       Fri Apr 09 17:50:15 1999 +0000
+++ b/usr.sbin/dhcp/common/hash.c       Fri Apr 09 17:52:05 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: hash.c,v 1.1.1.2 1999/02/18 21:48:50 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: hash.c,v 1.1.1.3 1999/04/09 17:52:05 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -67,23 +67,12 @@
        register int accum = 0;
        register unsigned char *s = name;
        int i = len;
-       if (i) {
-               while (i--) {
-                       /* Add the character in... */
-                       accum += *s++;
-                       /* Add carry back in... */
-                       while (accum > 255) {
-                               accum = (accum & 255) + (accum >> 8);
-                       }
-               }
-       } else {
-               while (*s) {
-                       /* Add the character in... */
-                       accum += *s++;
-                       /* Add carry back in... */
-                       while (accum > 255) {
-                               accum = (accum & 255) + (accum >> 8);
-                       }
+       while (i--) {
+               /* Add the character in... */
+               accum += *s++;
+               /* Add carry back in... */
+               while (accum > 255) {
+                       accum = (accum & 255) + (accum >> 8);
                }
        }
        return accum % size;
@@ -100,6 +89,8 @@
 
        if (!table)
                return;
+       if (!len)
+               len = strlen ((char *)name);
 
        hashno = do_hash (name, len, table -> hash_count);
        bp = new_hash_bucket ("add_hash");
@@ -125,6 +116,8 @@
 
        if (!table)
                return;
+       if (!len)
+               len = strlen ((char *)name);
 
        hashno = do_hash (name, len, table -> hash_count);
 
@@ -157,19 +150,15 @@
 
        if (!table)
                return (unsigned char *)0;
+
+       if (!len)
+               len = strlen ((char *)name);
+
        hashno = do_hash (name, len, table -> hash_count);
 
-       if (len) {
-               for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
-                       if (len == bp -> len
-                           && !memcmp (bp -> name, name, len))
-                               return bp -> value;
-               }
-       } else {
-               for (bp = table -> buckets [hashno]; bp; bp = bp -> next)
-                       if (!strcmp ((char *)bp -> name, (char *)name))
-                               return bp -> value;
+       for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
+               if (len == bp -> len && !memcmp (bp -> name, name, len))
+                       return bp -> value;
        }
        return (unsigned char *)0;
 }
-
diff -r 7df0f7c523b5 -r 7d815e65b3b3 usr.sbin/dhcp/common/raw.c
--- a/usr.sbin/dhcp/common/raw.c        Fri Apr 09 17:50:15 1999 +0000
+++ b/usr.sbin/dhcp/common/raw.c        Fri Apr 09 17:52:05 1999 +0000
@@ -54,7 +54,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: raw.c,v 1.1.1.3 1999/02/24 04:11:03 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: raw.c,v 1.1.1.4 1999/04/09 17:52:06 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -81,6 +81,7 @@
         if (!quiet_interface_discovery)
                note ("Sending on %s, port %d",
                      piaddr (info -> address), htons (local_port));
+
        if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
                error ("Can't create dhcp socket: %m");
 
@@ -104,7 +105,7 @@
                       info -> shared_network -> name : ""));
 }
 
-size_t send_packet (interface, packet, raw, len, from, to, hto)
+ssize_t send_packet (interface, packet, raw, len, from, to, hto)
        struct interface_info *interface;
        struct packet *packet;
        struct dhcp_packet *raw;
@@ -113,7 +114,7 @@
        struct sockaddr_in *to;
        struct hardware *hto;
 {
-       unsigned char buf [256];
+       unsigned char buf [1500];
        int bufp = 0;
        struct iovec iov [2];
        int result;
@@ -122,16 +123,31 @@
        assemble_udp_ip_header (interface, buf, &bufp, from.s_addr,
                                to -> sin_addr.s_addr, to -> sin_port,
                                (unsigned char *)raw, len);
-
-       /* Fire it off */
-       iov [0].iov_base = (char *)buf;
-       iov [0].iov_len = bufp;
-       iov [1].iov_base = (char *)raw;
-       iov [1].iov_len = len;
-
-       result = writev(interface -> wfdesc, iov, 2);
+       if (len + bufp > sizeof buf) {
+               warn ("send_packet: packet too large (%s)", len + bufp);
+               return;
+       }
+       memcpy (buf + bufp, raw, len);
+       bufp += len;
+       result = sendto (interface -> wfdesc, (char *)buf, bufp, 0,
+                        (struct sockaddr *)to, sizeof *to);
        if (result < 0)
                warn ("send_packet: %m");
        return result;
 }
-#endif /* USE_SOCKET_SEND */
+
+int can_unicast_without_arp ()
+{
+       return 1;
+}
+
+void maybe_setup_fallback ()
+{
+}
+
+void if_reinitialize_send (info)
+       struct interface_info *info;
+{
+}
+
+#endif /* USE_RAW_SEND */
diff -r 7df0f7c523b5 -r 7d815e65b3b3 usr.sbin/dhcp/includes/cf/irix.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/dhcp/includes/cf/irix.h  Fri Apr 09 17:52:05 1999 +0000
@@ -0,0 +1,93 @@
+/* irix.h */
+/*
+ * Copyright (c) 1996 The Internet Software Consortium.  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.
+ * 3. Neither the name of The Internet Software Consortium nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM 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
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ *
+ */
+
+#define int8_t         char
+#define int16_t                short
+#define int32_t                long
+
+#define u_int8_t       unsigned char
+#define u_int16_t      unsigned short 
+#define u_int32_t      unsigned long 
+
+#include <sys/types.h>
+
+#include <syslog.h>
+
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <limits.h>
+#include <net/if_dl.h>
+
+extern int h_errno;
+
+#include <net/if.h>
+#include <net/if_arp.h>
+
+#define _PATH_DHCPD_CONF "/usr/local/etc/dhcpd.conf"
+#define _PATH_DHCPD_DB   "/usr/local/etc/dhcp/dhcpd.leases"
+
+#ifndef _PATH_DHCPD_PID
+#define _PATH_DHCPD_PID        "/etc/dhcpd.pid"
+#endif
+#ifndef _PATH_DHCLIENT_PID
+#define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
+#endif
+#ifndef _PATH_DHCRELAY_PID
+#define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
+#endif
+
+#include <stdarg.h>
+#define VA_DOTDOTDOT ...
+#define VA_start(list, last) va_start (list, last)
+#define va_dcl
+
+#define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list)
+#define NO_SNPRINTF
+
+#if defined (USE_DEFAULT_NETWORK)
+# define USE_RAW_SEND
+# define USE_SOCKET_RECEIVE
+#endif
+
+#define EOL '\n'
+#define VOIDPTR void *
+
+#include <time.h>
+
+#define TIME time_t
+#define GET_TIME(x)    time ((x))
+
+#define random rand
diff -r 7df0f7c523b5 -r 7d815e65b3b3 usr.sbin/dhcp/includes/dhctoken.h
--- a/usr.sbin/dhcp/includes/dhctoken.h Fri Apr 09 17:50:15 1999 +0000
+++ b/usr.sbin/dhcp/includes/dhctoken.h Fri Apr 09 17:52:05 1999 +0000
@@ -128,6 +128,7 @@
 #define USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 332
 #define AUTHORITATIVE  333
 #define TOKEN_NOT      334
+#define ALWAYS_REPLY_RFC1048 335
 
 #define is_identifier(x)       ((x) >= FIRST_TOKEN &&  \
                                 (x) != STRING &&       \
diff -r 7df0f7c523b5 -r 7d815e65b3b3 usr.sbin/dhcp/includes/osdep.h
--- a/usr.sbin/dhcp/includes/osdep.h    Fri Apr 09 17:50:15 1999 +0000
+++ b/usr.sbin/dhcp/includes/osdep.h    Fri Apr 09 17:52:05 1999 +0000
@@ -127,6 +127,10 @@
 # endif



Home | Main Index | Thread Index | Old Index