From 1d8b3be15ea37678b523802ae1e5df5252978468 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 12 Mar 2006 00:18:08 +0000 Subject: remove BPF filter support if the bpfilter device is removed. --- sys/conf/files | 4 ++-- sys/net/if_ppp.c | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/conf/files b/sys/conf/files index 00c4f96fcf7..6b91296b45d 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.366 2006/03/04 16:27:02 grange Exp $ +# $OpenBSD: files,v 1.367 2006/03/12 00:18:07 brad Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -694,7 +694,7 @@ file ntfs/ntfs_subr.c ntfs file ntfs/ntfs_vfsops.c ntfs file ntfs/ntfs_vnops.c ntfs file net/bpf.c bpfilter needs-count -file net/bpf_filter.c bpfilter | ppp +file net/bpf_filter.c bpfilter file net/if.c file net/if_arcsubr.c arc needs-flag file net/if_atmsubr.c atm needs-flag diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 38b9d10df16..3330cff27fc 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.44 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.45 2006/03/12 00:18:07 brad Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -379,6 +379,7 @@ pppdealloc(sc) sc->sc_xc_state = NULL; sc->sc_rc_state = NULL; #endif /* PPP_COMPRESS */ +#if NBPFILTER > 0 if (sc->sc_pass_filt.bf_insns != 0) { FREE(sc->sc_pass_filt.bf_insns, M_DEVBUF); sc->sc_pass_filt.bf_insns = 0; @@ -389,6 +390,7 @@ pppdealloc(sc) sc->sc_active_filt.bf_insns = 0; sc->sc_active_filt.bf_len = 0; } +#endif #ifdef VJC if (sc->sc_comp != 0) { FREE(sc->sc_comp, M_DEVBUF); @@ -414,9 +416,11 @@ pppioctl(sc, cmd, data, flag, p) struct compressor **cp; struct npioctl *npi; time_t t; +#if NBPFILTER > 0 struct bpf_program *bp, *nbp; struct bpf_insn *newcode, *oldcode; int newcodelen; +#endif #ifdef PPP_COMPRESS u_char ccp_option[CCP_MAX_OPTION_LENGTH]; #endif @@ -572,6 +576,7 @@ pppioctl(sc, cmd, data, flag, p) splx(s); break; +#if NBPFILTER > 0 case PPPIOCSPASS: case PPPIOCSACTIVE: nbp = (struct bpf_program *) data; @@ -600,6 +605,7 @@ pppioctl(sc, cmd, data, flag, p) if (oldcode != 0) FREE(oldcode, M_DEVBUF); break; +#endif default: return (-1); @@ -801,6 +807,7 @@ pppoutput(ifp, m0, dst, rtp) } if ((protocol & 0x8000) == 0) { +#if NBPFILTER > 0 /* * Apply the pass and active filters to the packet, * but only if it is a data packet. @@ -821,6 +828,12 @@ pppoutput(ifp, m0, dst, rtp) sc->sc_last_sent = time_second; *mtod(m0, u_char *) = address; +#else + /* + * Update the time we sent the most recent packet. + */ + sc->sc_last_sent = time_second; +#endif } #if NBPFILTER > 0 @@ -1463,6 +1476,7 @@ ppp_inproc(sc, m) m->m_pkthdr.rcvif = ifp; if ((proto & 0x8000) == 0) { +#if NBPFILTER > 0 /* * See whether we want to pass this packet, and * if it counts as link activity. @@ -1481,6 +1495,12 @@ ppp_inproc(sc, m) sc->sc_last_recv = time_second; *mtod(m, u_char *) = adrs; +#else + /* + * Record the time that we received this packet. + */ + sc->sc_last_recv = time_second; +#endif } #if NBPFILTER > 0 -- cgit v1.2.3