Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/dhcp Add/fix FDDI support for NetBSD (& Tru64). [T...



details:   https://anonhg.NetBSD.org/src/rev/b2a77bd3ecd6
branches:  trunk
changeset: 486738:b2a77bd3ecd6
user:      matt <matt%NetBSD.org@localhost>
date:      Sun May 28 01:27:52 2000 +0000

description:
Add/fix FDDI support for NetBSD (& Tru64).  [Tru64 has at least one bug left]

diffstat:

 usr.sbin/dhcp/common/bpf.c         |  10 +++++-----
 usr.sbin/dhcp/common/discover.c    |  12 ++++++++++--
 usr.sbin/dhcp/common/fddi.c        |  16 ++++++++++++++--
 usr.sbin/dhcp/common/packet.c      |   6 +++---
 usr.sbin/dhcp/includes/cf/netbsd.h |   3 +++
 5 files changed, 35 insertions(+), 12 deletions(-)

diffs (164 lines):

diff -r e5f2663eb2d5 -r b2a77bd3ecd6 usr.sbin/dhcp/common/bpf.c
--- a/usr.sbin/dhcp/common/bpf.c        Sun May 28 01:25:20 2000 +0000
+++ b/usr.sbin/dhcp/common/bpf.c        Sun May 28 01:27:52 2000 +0000
@@ -47,7 +47,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.1.1.7 2000/04/22 07:11:32 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.2 2000/05/28 01:27:52 matt Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -237,9 +237,9 @@
        u_int32_t addr;
        struct bpf_program p;
        u_int32_t bits;
-#ifdef DEC_FDDI
+#if defined(DEC_FDDI) || defined(NETBSD_FDDI)
        int link_layer;
-#endif /* DEC_FDDI */
+#endif /* DEC_FDDI || NETBSD_FDDI */
 
        /* Open a BPF device and hang it on this interface... */
        info -> rfdesc = if_register_bpf (info);
@@ -286,7 +286,7 @@
        /* Set up the bpf filter program structure. */
        p.bf_len = dhcp_bpf_filter_len;
 
-#ifdef DEC_FDDI
+#if defined(DEC_FDDI) || defined(NETBSD_FDDI)
        /* See if this is an FDDI interface, flag it for later. */
        if (ioctl(info -> rfdesc, BIOCGDLT, &link_layer) >= 0 &&
            link_layer == DLT_FDDI) {
@@ -310,7 +310,7 @@
                }
                p.bf_insns = bpf_fddi_filter;
        } else
-#endif /* DEC_FDDI */
+#endif /* DEC_FDDI || NETBSD_FDDI */
        p.bf_insns = dhcp_bpf_filter;
 
         /* Patch the server port into the BPF  program...
diff -r e5f2663eb2d5 -r b2a77bd3ecd6 usr.sbin/dhcp/common/discover.c
--- a/usr.sbin/dhcp/common/discover.c   Sun May 28 01:25:20 2000 +0000
+++ b/usr.sbin/dhcp/common/discover.c   Sun May 28 01:27:52 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: discover.c,v 1.2 2000/04/24 05:38:51 thorpej Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: discover.c,v 1.3 2000/05/28 01:27:52 matt Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -217,7 +217,15 @@
 #else
                        tmp -> hw_address.hlen = 6; /* XXX!!! */
 #endif
-                       tmp -> hw_address.hbuf [0] = HTYPE_ETHER; /* XXX */
+                       if (foo -> sdl_type == IFT_ETHER) {
+                               tmp -> hw_address.hbuf [0] = HTYPE_ETHER;
+#if defined (DEC_FDDI) || defined(NETBSD_FDDI)
+                       } else if (foo -> sdl_type == IFT_FDDI) {
+                               tmp -> hw_address.hbuf [0] = HTYPE_FDDI;
+#endif
+                       } else {
+                               continue;
+                       }
                        memcpy (&tmp -> hw_address.hbuf [1],
                                LLADDR (foo), tmp -> hw_address.hlen);
                        tmp -> hw_address.hlen++;       /* for type. */
diff -r e5f2663eb2d5 -r b2a77bd3ecd6 usr.sbin/dhcp/common/fddi.c
--- a/usr.sbin/dhcp/common/fddi.c       Sun May 28 01:25:20 2000 +0000
+++ b/usr.sbin/dhcp/common/fddi.c       Sun May 28 01:27:52 2000 +0000
@@ -43,14 +43,22 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: fddi.c,v 1.1.1.1 2000/04/22 07:11:34 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: fddi.c,v 1.2 2000/05/28 01:27:52 matt Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
 
+#if defined (DEC_FDDI) || defined (NETBSD_FDDI)
 #if defined (DEC_FDDI)
 #include <netinet/if_fddi.h>
 #include <net/if_llc.h>
+#endif /* DEC_FDDI */
+
+#if defined (NETBSD_FDDI)
+#include <net/if_fddi.h>
+#include <net/if_llc.h>
+#define        LLC_SNAP_LEN    LLC_SNAPFRAMELEN
+#endif /* NETBSD_FDDI */
 
 #if defined (PACKET_ASSEMBLY) || defined (PACKET_DECODING)
 #include "includes/netinet/if_ether.h"
@@ -77,6 +85,7 @@
        memcpy (&buf [*bufix], &fh, sizeof fh);
        *bufix += sizeof fh;
 
+       memset (&lh, 0, sizeof lh);
        lh.llc_dsap = LLC_SNAP_LSAP;
        lh.llc_ssap = LLC_SNAP_LSAP;
        lh.llc_un.type_snap.control = LLC_UI;
@@ -97,10 +106,13 @@
 {
        struct fddi_header   fh;
        struct llc     lh;
+
+       memcpy(&fh, buf + bufix, FDDI_HEADER_SIZE);
        
        from -> hbuf [0] = HTYPE_FDDI;
+       from -> hlen = (sizeof fh.fddi_shost) + 1;
        memcpy (&from -> hbuf [1], fh.fddi_shost, sizeof fh.fddi_shost);
        return FDDI_HEADER_SIZE + LLC_SNAP_LEN;
 }
 #endif /* PACKET_DECODING */
-#endif /* DEC_FDDI */
+#endif /* DEC_FDDI || NETBSD_FDDI */
diff -r e5f2663eb2d5 -r b2a77bd3ecd6 usr.sbin/dhcp/common/packet.c
--- a/usr.sbin/dhcp/common/packet.c     Sun May 28 01:25:20 2000 +0000
+++ b/usr.sbin/dhcp/common/packet.c     Sun May 28 01:27:52 2000 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: packet.c,v 1.1.1.7 2000/04/22 07:11:36 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: packet.c,v 1.2 2000/05/28 01:27:52 matt Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -124,7 +124,7 @@
                assemble_tr_header (interface, buf, bufix, to);
        else
 #endif
-#if defined (DEC_FDDI)
+#if defined (DEC_FDDI) || defined (NETBSD_FDDI)
             if (interface -> hw_address.hbuf [0] == HTYPE_FDDI)
                     assemble_fddi_header (interface, buf, bufix, to);
        else
@@ -209,7 +209,7 @@
                return decode_tr_header (interface, buf, bufix, from);
        else
 #endif
-#if defined (DEC_FDDI)
+#if defined (DEC_FDDI) || defined (NETBSD_FDDI)
             if (interface -> hw_address.hbuf [0] == HTYPE_FDDI)
                     return decode_fddi_header (interface, buf, bufix, from);
        else
diff -r e5f2663eb2d5 -r b2a77bd3ecd6 usr.sbin/dhcp/includes/cf/netbsd.h
--- a/usr.sbin/dhcp/includes/cf/netbsd.h        Sun May 28 01:25:20 2000 +0000
+++ b/usr.sbin/dhcp/includes/cf/netbsd.h        Sun May 28 01:27:52 2000 +0000
@@ -95,6 +95,9 @@
 
 #if defined (USE_DEFAULT_NETWORK)
 #  define USE_BPF
+#  define NETBSD_FDDI
+#  define FDDI_HEADER_SIZE 16
+#  include <net/if_types.h>
 #endif
 
 #ifdef __alpha__



Home | Main Index | Thread Index | Old Index