diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-11-22 12:33:26 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-11-22 12:33:26 +0000 |
commit | 5011997e5a43856056cd6068fb04022d87292a87 (patch) | |
tree | 31b99a962b0e21346c20947fa5b708e87d80cff1 /sys/net/if_vether.c | |
parent | 01013770176b4439824fd24d21e8b9cda34de241 (diff) |
Add a lot of bpf and counter manipulation to the bridge. The bridge
sneaks packets on and off network interfaces in some cases without
calling the interrupt, start, or output functions, and thus must do
these tasks which the drivers cannot do. The gif and vether are
rather special. Someone should re-check gre.
ok claudio
Diffstat (limited to 'sys/net/if_vether.c')
-rw-r--r-- | sys/net/if_vether.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c index 366db72bdfa..994fe743299 100644 --- a/sys/net/if_vether.c +++ b/sys/net/if_vether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vether.c,v 1.5 2009/11/18 02:11:53 deraadt Exp $ */ +/* $OpenBSD: if_vether.c,v 1.6 2009/11/22 12:33:25 deraadt Exp $ */ /* * Copyright (c) 2009 Theo de Raadt @@ -159,13 +159,14 @@ vether_clone_destroy(struct ifnet *ifp) } /* - * Start output on the vether interface. + * The bridge has magically already done all the work for us, + * and we only need to discard the packets. */ void vetherstart(struct ifnet *ifp) { struct mbuf *m; - int s, inout; + int s; for (;;) { s = splnet(); @@ -174,27 +175,8 @@ vetherstart(struct ifnet *ifp) if (m == NULL) return; - - inout = (m->m_flags & M_PROTO1) ? - BPF_DIRECTION_IN : BPF_DIRECTION_OUT; - m->m_flags &= ~M_PROTO1; - - if (inout == BPF_DIRECTION_IN) { -#if NBPFILTER > 0 - if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m, inout); -#endif - ether_input_mbuf(ifp, m); - ifp->if_ipackets++; - } else { -#if NBPFILTER > 0 - if (ifp->if_bpf) - bpf_mtap_ether(ifp->if_bpf, m, inout); -#endif - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; - m_freem(m); - } + ifp->if_opackets++; + m_freem(m); } } |