* 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.
This commit is contained in:
thorpej 1999-05-11 02:18:52 +00:00
parent c806cc5a47
commit 4c89a367d5
2 changed files with 21 additions and 12 deletions

View File

@ -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 @@ pppattach()
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 @@ pppoutput(ifp, m0, dst, rtp)
#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 @@ pppoutput(ifp, m0, dst, rtp)
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 @@ ppp_inproc(sc, m)
#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

View File

@ -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 @@ pppopen(dev, tp)
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 @@ pppasyncrelinq(sc)
{
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);