diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-23 09:42:24 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-23 09:42:24 +0000 |
commit | 105ae6f314a0a8905afb0be0bc1d530fa1dd0657 (patch) | |
tree | 58453f7eecb1926c4a736752d876921b9a6c26c3 /sys/netinet | |
parent | fa005873106ace803df5360e5fe94da5eb21183e (diff) |
Adapt bridge(4) to the new if_input() framework.
Move bridge_input() outside of ether_input() in order to duplicate packets
flowing through a bridge port before applying any transformation on mbufs.
This saves a various m_adj(9)/M_PREPEND(9) dances and remove the bridge(4)
hack from vlan(4).
Tested by mxb <mxb AT alumni DOT chalmers DOT se> and kettenis@
ok bluhm@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_ether.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index f581082c6a1..78bf0cbc083 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.72 2015/06/16 11:09:40 mpi Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.73 2015/06/23 09:42:23 mpi Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -162,7 +162,6 @@ etherip_input6(struct mbuf **m, int *offp, int proto) void etherip_decap(struct mbuf *m, int iphlen) { - struct ether_header eh; struct etherip_header eip; struct gif_softc *sc; int s; @@ -229,27 +228,14 @@ etherip_decap(struct mbuf *m, int iphlen) /* Statistics */ etheripstat.etherip_ibytes += m->m_pkthdr.len; - /* Copy ethernet header */ - m_copydata(m, 0, sizeof(eh), (void *) &eh); - /* Reset the flags based on the inner packet */ - m->m_flags &= ~(M_BCAST|M_MCAST|M_AUTH|M_CONF); - if (eh.ether_dhost[0] & 1) { - if (memcmp(etherbroadcastaddr, eh.ether_dhost, - sizeof(etherbroadcastaddr)) == 0) - m->m_flags |= M_BCAST; - else - m->m_flags |= M_MCAST; - } + m->m_flags &= ~(M_BCAST|M_MCAST|M_AUTH|M_CONF|M_PROTO1); #if NBPFILTER > 0 if (sc->gif_if.if_bpf) bpf_mtap_af(sc->gif_if.if_bpf, AF_LINK, m, BPF_DIRECTION_IN); #endif - /* Trim the beginning of the mbuf, to remove the ethernet header. */ - m_adj(m, sizeof(struct ether_header)); - /* * Tap the packet off here for a bridge. bridge_input() returns * NULL if it has consumed the packet. In the case of gif's, @@ -264,7 +250,7 @@ etherip_decap(struct mbuf *m, int iphlen) sc->gif_if.if_imcasts++; s = splnet(); - m = bridge_input(&sc->gif_if, &eh, m); + m = bridge_input(m); splx(s); if (m == NULL) return; |