Source-Changes-HG archive

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

[src/netbsd-1-4]: src/usr.sbin/dhcp Apply patch (new files, requested by mell...



details:   https://anonhg.NetBSD.org/src/rev/60cf6f7a25b9
branches:  netbsd-1-4
changeset: 470802:60cf6f7a25b9
user:      he <he%NetBSD.org@localhost>
date:      Thu Jul 27 17:18:33 2000 +0000

description:
Apply patch (new files, requested by mellon):
  Merge/update DHCP client and server software to ISC 2.0pl3.

diffstat:

 usr.sbin/dhcp/CHANGES            |  104 +++++++++++++
 usr.sbin/dhcp/common/ethernet.c  |  110 +++++++++++++
 usr.sbin/dhcp/common/tr.c        |  307 +++++++++++++++++++++++++++++++++++++++
 usr.sbin/dhcp/includes/cf/irix.h |   93 +++++++++++
 usr.sbin/dhcp/includes/version.h |    3 +
 5 files changed, 617 insertions(+), 0 deletions(-)

diffs (truncated from 637 to 300 lines):

diff -r a5816dc3ea2d -r 60cf6f7a25b9 usr.sbin/dhcp/CHANGES
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/dhcp/CHANGES     Thu Jul 27 17:18:33 2000 +0000
@@ -0,0 +1,104 @@
+970609
+
+- Don't trust hostnames provided by client - Win95 allows *spaces* in
+  client-supplied hostnames!
+
+- Be lenient in parsing client-hostname statement in case a bad hostname
+  got recorded.
+
+970607
+
+- Change size_t to ssize_t in return values where a negative number
+  is used to indicate an error.
+
+- Always write out two digits for single-byte quantities in arrays.
+
+- When parsing a lease database, correctly transfer the client
+  hostname and hostname to the memory-resident lease structure.
+
+- If the lease we want to give the client is different than the
+  one it's asking for, and we recognize the one it's asking for as
+  ours, NAK it.
+
+- Only accept a DHCPRELEASE or DHCPNAK if the client supplies an IP
+  address and the lease corresponding to that address is available to
+  that client.
+
+- Make it a warning rather than an error if resolv.conf is missing.
+
+970605
+
+- Add client-hostname token to lexer so that the parser can use it.
+  Fixes a serious lease database bug.
+
+- Disable log message on receipt of short ICMP Echo replies.
+
+970602
+
+- Added DHCP Client scripts for FreeBSD, Solaris, and Linux, but
+  they're not guaranteed to work.
+
+- Added some Cygwin32 (Windows NT/Windows 95) support, but this is not
+  sufficiently complete to be useful yet.
+
+- Updated README
+
+- Put something useful in TODO - formerly it mostly listed projects
+  that were way out on the back burner.
+
+In DHCP Client:
+
+- Add default, supersede, prepend and append option support, so that a
+  client can override or modify server-supplied options, and provide
+  default values if the server provides no values.
+
+- Add reject keyword, so that packets from rogue DHCP or BOOTP servers
+  can be rejected out of hand.
+
+- Added support for booting from BOOTP servers.
+
+- Added BOOTP flag to client lease declaration, to indicated that a
+  particular lease was acquired through a BOOTP server.
+
+- Don't try to do INIT-REBOOT on leases acquired from BOOTP servers.
+
+- Print server's IP address instead of its IP address when logging
+  DHCP/BOOTP messages received by client.
+
+- Fix some bugs in saved lease activation.
+
+- Fix some scripting bugs.
+
+- New sample dhclient.conf script demonstrates new features.
+
+In common code:
+
+- Partially implemented asynchronous DNS lookups.
+
+- Fixed some bugs in dispatch routine.
+
+- Fix date parsing bug that was setting dates forward one day every
+  time dhcpd was restarted (this has been fixed for a while in the 1.0
+  branch).
+
+- Change name-server option name to ien116-name-server so as to reduce
+  the potential for confusion.
+
+DHCP Relay daemon:
+
+- Fixed an operator precedence bug having to do with the broadcast
+  flag.
+
+DHCP Server:
+
+- Add support to record the client-supplied hostname in the lease file,
+  for better readability.
+
+- Fixed a bug in the renewal code that resulted in the server ignoring
+  unicast renewals from non-local subnets.   This bug caused some
+  heartburn for Win95 machines.
+
+- Copy ciaddr from saved ciaddr, not from giaddr.
+
+- New -t flag tests /etc/dhcpd.conf for syntax errors.
+
diff -r a5816dc3ea2d -r 60cf6f7a25b9 usr.sbin/dhcp/common/ethernet.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/dhcp/common/ethernet.c   Thu Jul 27 17:18:33 2000 +0000
@@ -0,0 +1,110 @@
+/* packet.c
+
+   Packet assembly code, originally contributed by Archie Cobbs. */
+
+/*
+ * Copyright (c) 1995, 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 THE 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.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon <mellon%fugue.com@localhost> in cooperation with Vixie
+ * Enterprises.  To learn more about the Internet Software Consortium,
+ * see ``http://www.vix.com/isc''.  To learn more about Vixie
+ * Enterprises, see ``http://www.vix.com''.
+ */
+
+#ifndef lint
+static char copyright[] =
+"$Id: ethernet.c,v 1.1.1.1.6.2 2000/07/27 17:18:34 he Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
+#endif /* not lint */
+
+#include "dhcpd.h"
+
+#if defined (PACKET_ASSEMBLY) || defined (PACKET_DECODING)
+#include "includes/netinet/if_ether.h"
+#endif /* PACKET_ASSEMBLY || PACKET_DECODING */
+
+#if defined (PACKET_ASSEMBLY)
+/* Assemble an hardware header... */
+/* XXX currently only supports ethernet; doesn't check for other types. */
+
+void assemble_ethernet_header (interface, buf, bufix, to)
+       struct interface_info *interface;
+       unsigned char *buf;
+       int *bufix;
+       struct hardware *to;
+{
+       struct ether_header eh;
+
+       if (to && to -> hlen == 6) /* XXX */
+               memcpy (eh.ether_dhost, to -> haddr, sizeof eh.ether_dhost);
+       else
+               memset (eh.ether_dhost, 0xff, sizeof (eh.ether_dhost));
+       if (interface -> hw_address.hlen == sizeof (eh.ether_shost))
+               memcpy (eh.ether_shost, interface -> hw_address.haddr,
+                       sizeof (eh.ether_shost));
+       else
+               memset (eh.ether_shost, 0x00, sizeof (eh.ether_shost));
+
+#ifdef BROKEN_FREEBSD_BPF /* Fixed in FreeBSD 2.2 */
+       eh.ether_type = ETHERTYPE_IP;
+#else
+       eh.ether_type = htons (ETHERTYPE_IP);
+#endif
+
+       memcpy (&buf [*bufix], &eh, ETHER_HEADER_SIZE);
+       *bufix += ETHER_HEADER_SIZE;
+}
+#endif /* PACKET_ASSEMBLY */
+
+#ifdef PACKET_DECODING
+/* Decode a hardware header... */
+
+ssize_t decode_ethernet_header (interface, buf, bufix, from)
+     struct interface_info *interface;
+     unsigned char *buf;
+     int bufix;
+     struct hardware *from;
+{
+  struct ether_header eh;
+
+  memcpy (&eh, buf + bufix, ETHER_HEADER_SIZE);
+
+#ifdef USERLAND_FILTER
+  if (ntohs (eh.ether_type) != ETHERTYPE_IP)
+         return -1;
+#endif
+  memcpy (from -> haddr, eh.ether_shost, sizeof (eh.ether_shost));
+  from -> htype = ARPHRD_ETHER;
+  from -> hlen = sizeof eh.ether_shost;
+
+  return sizeof eh;
+}
+#endif /* PACKET_DECODING */
diff -r a5816dc3ea2d -r 60cf6f7a25b9 usr.sbin/dhcp/common/tr.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/dhcp/common/tr.c Thu Jul 27 17:18:33 2000 +0000
@@ -0,0 +1,307 @@
+/*
+ * packet_tr.c - token ring interface code, contributed in May of 1999
+ * by Andrew Chittenden
+ */
+
+#include "dhcpd.h"
+
+#if defined (HAVE_TR_SUPPORT) && \
+       (defined (PACKET_ASSEMBLY) || defined (PACKET_DECODING))
+#include "includes/netinet/ip.h"
+#include "includes/netinet/udp.h"
+#include "includes/netinet/if_ether.h"
+#include "netinet/if_tr.h"
+#include <sys/time.h>
+
+/*
+ * token ring device handling subroutines.  These are required as token-ring
+ * does not have a simple on-the-wire header but requires the use of
+ * source routing
+ */
+
+static int insert_source_routing PROTO ((struct trh_hdr *trh, struct interface_info* interface));
+static void save_source_routing PROTO ((struct trh_hdr *trh, struct interface_info* interface));
+static void expire_routes PROTO ((void));
+
+/*
+ * As we keep a list of interesting routing information only, a singly
+ * linked list is all we need
+ */
+struct routing_entry {
+        struct routing_entry *next;
+        unsigned char addr[TR_ALEN];
+        unsigned char iface[5];
+        __u16 rcf;                      /* route control field */
+        __u16 rseg[8];                  /* routing registers */
+        unsigned long access_time;      /* time we last used this entry */
+};
+
+static struct routing_entry *routing_info = NULL;
+
+static int routing_timeout = 10;
+static struct timeval routing_timer;
+
+void assemble_tr_header (interface, buf, bufix, to)
+       struct interface_info *interface;
+       unsigned char *buf;
+       int *bufix;
+       struct hardware *to;
+{
+        struct trh_hdr *trh;
+        int hdr_len;
+        struct trllc *llc;
+
+
+        /* set up the token header */
+        trh = (struct trh_hdr *) &buf[*bufix];
+        if (interface -> hw_address.hlen == sizeof (trh->saddr))
+                memcpy (trh->saddr, interface -> hw_address.haddr,
+                                    sizeof (trh->saddr));
+        else
+                memset (trh->saddr, 0x00, sizeof (trh->saddr));
+
+        if (to && to -> hlen == 6) /* XXX */
+                memcpy (trh->daddr, to -> haddr, sizeof trh->daddr);
+        else
+                memset (trh->daddr, 0xff, sizeof (trh->daddr));
+
+       hdr_len = insert_source_routing (trh, interface);
+
+        trh->ac = AC;
+        trh->fc = LLC_FRAME;
+
+        /* set up the llc header for snap encoding after the tr header */
+        llc = (struct trllc *)(buf + *bufix + hdr_len);



Home | Main Index | Thread Index | Old Index