Source-Changes-HG archive

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

[src/trunk]: src/sys/net * Start out with a data link type of DLT_NULL. When...



details:   https://anonhg.NetBSD.org/src/rev/9fc98828a23f
branches:  trunk
changeset: 472874:9fc98828a23f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 11 02:18:52 1999 +0000

description:
* Start out with a data link type of DLT_NULL.  When we change an interface
to serial encap, change its data link type to DLT_PPP_SERIAL.
* Work around some serious bogosity in the filtering code which utterly
breaks proper functioning of BPF.  The PPP code and pppd(8) WILL be changed
to fix this.

diffstat:

 sys/net/if_ppp.c  |  20 ++++++++++----------
 sys/net/ppp_tty.c |  13 +++++++++++--
 2 files changed, 21 insertions(+), 12 deletions(-)

diffs (102 lines):

diff -r cef4a279a2e9 -r 9fc98828a23f sys/net/if_ppp.c
--- a/sys/net/if_ppp.c  Tue May 11 02:11:08 1999 +0000
+++ b/sys/net/if_ppp.c  Tue May 11 02:18:52 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ppp.c,v 1.50 1999/01/09 21:47:09 thorpej Exp $      */
+/*     $NetBSD: if_ppp.c,v 1.51 1999/05/11 02:18:52 thorpej Exp $      */
 /*     Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp       */
 
 /*
@@ -209,7 +209,7 @@
        sc->sc_rawq.ifq_maxlen = IFQ_MAXLEN;
        if_attach(&sc->sc_if);
 #if NBPFILTER > 0
-       bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
+       bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_NULL, 0);
 #endif
     }
 }
@@ -770,6 +770,10 @@
 #endif /* PPP_FILTER */
     }
 
+#if defined(PPP_FILTER) || NBPFILTER > 0
+    *mtod(m0, u_char *) = address;
+#endif
+
 #if NBPFILTER > 0
     /*
      * See if bpf wants to look at the packet.
@@ -778,10 +782,6 @@
        bpf_mtap(sc->sc_bpf, m0);
 #endif
 
-#if defined(PPP_FILTER) || NBPFILTER > 0
-    *mtod(m0, u_char *) = address;
-#endif
-
     /*
      * Put the packet on the appropriate queue.
      */
@@ -1415,16 +1415,16 @@
 #endif /* PPP_FILTER */
     }
 
+#if defined(PPP_FILTER) || NBPFILTER > 0
+    *mtod(m, u_char *) = adrs;
+#endif
+
 #if NBPFILTER > 0
     /* See if bpf wants to look at the packet. */
     if (sc->sc_bpf)
        bpf_mtap(sc->sc_bpf, m);
 #endif
 
-#if defined(PPP_FILTER) || NBPFILTER > 0
-    *mtod(m, u_char *) = adrs;
-#endif
-
     rv = 0;
     switch (proto) {
 #ifdef INET
diff -r cef4a279a2e9 -r 9fc98828a23f sys/net/ppp_tty.c
--- a/sys/net/ppp_tty.c Tue May 11 02:11:08 1999 +0000
+++ b/sys/net/ppp_tty.c Tue May 11 02:18:52 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ppp_tty.c,v 1.15 1998/12/12 18:21:32 christos Exp $    */
+/*     $NetBSD: ppp_tty.c,v 1.16 1999/05/11 02:18:52 thorpej Exp $     */
 /*     Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp      */
 
 /*
@@ -106,7 +106,8 @@
 #include <net/slcompress.h>
 #endif
 
-#ifdef PPP_FILTER
+#include "bpfilter.h"
+#if NBPFILTER > 0 || defined(PPP_FILTER)
 #include <net/bpf.h>
 #endif
 #include <net/ppp_defs.h>
@@ -195,6 +196,11 @@
     if (sc->sc_relinq)
        (*sc->sc_relinq)(sc);   /* get previous owner to relinquish the unit */
 
+#if NBPFILTER > 0
+    /* Switch DLT to PPP-over-serial. */
+    bpf_change_type(&sc->sc_bpf, DLT_PPP_SERIAL, PPP_HDRLEN);
+#endif
+
     sc->sc_ilen = 0;
     sc->sc_m = NULL;
     bzero(sc->sc_asyncmap, sizeof(sc->sc_asyncmap));
@@ -255,6 +261,9 @@
 {
     int s;
 
+    /* Change DLT to back none. */
+    bpf_change_type(&sc->sc_bpf, DLT_NULL, 0);
+
     s = spltty();
     if (sc->sc_outm) {
        m_freem(sc->sc_outm);



Home | Main Index | Thread Index | Old Index