diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2012-11-01 07:55:57 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2012-11-01 07:55:57 +0000 |
commit | 3e894385f9270ed9b5e48e20e90bb2039e96480b (patch) | |
tree | 95d1f777b809073048e099140897afb666a2fe8f /sys/net/if_bridge.c | |
parent | 8b9044e72499aee42f7fe82a72015b3e02b99652 (diff) |
redo most of the protocol (tcp/udp/...) checksum handling
-assume we have hardware checksum offloading. stop mucking with the
checksum in most of the stack
-stop checksum mucking in pf, just set a "needs checksumming" flag if needed
-in all output pathes, very late, if we figure out the outbound interface
doesn't have hw cksum offloading, do the cksum in software. this especially
makes the bridge path behave like a regular output path
-little special casing for bridge still required until the broadcast path
loses its disgusting shortcut hacks, but at least it's in one place now
and not all over the stack
in6_proto_cksum_out mostly written by krw@
started at k2k11 in iceland more than 1.5 years ago - yes it took that
long, this stuff is everything but easy.
this happens to fix the infamous pf rdr bug that made us turn off proto
cksum offloading on almost all interface drivers.
ok camield sthen claudio, testing by many, thanks!
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r-- | sys/net/if_bridge.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index f591895d675..6d055980fd6 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,7 +1,8 @@ -/* $OpenBSD: if_bridge.c,v 1.200 2012/10/10 11:14:08 henning Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.201 2012/11/01 07:55:55 henning Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) + * Copyright (c) 2003 - 2012 Henning Brauer <henning@openbsd.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1011,15 +1012,6 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa, return (0); } #endif /* IPSEC */ - - /* Catch packets that need TCP/UDP hardware checksumming */ - if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT || - m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT) { - m_freem(m); - splx(s); - return (0); - } - bridge_span(sc, NULL, m); LIST_FOREACH(p, &sc->sc_iflist, next) { @@ -2351,6 +2343,12 @@ bridge_ipsec(struct bridge_softc *sc, struct ifnet *ifp, } if (m == NULL) return (1); + else if (af == AF_INET) + in_proto_cksum_out(m, encif); +#ifdef INET6 + else if (af == AF_INET6) + in6_proto_cksum_out(m, encif); +#endif /* INET6 */ #endif /* NPF */ ip = mtod(m, struct ip *); @@ -2503,6 +2501,7 @@ bridge_ip(struct bridge_softc *sc, int dir, struct ifnet *ifp, return (NULL); if (m->m_len < sizeof(struct ip)) goto dropit; + in_proto_cksum_out(m, ifp); ip = mtod(m, struct ip *); ip->ip_sum = 0; if (0 && (ifp->if_capabilities & IFCAP_CSUM_IPv4)) { @@ -2548,6 +2547,7 @@ bridge_ip(struct bridge_softc *sc, int dir, struct ifnet *ifp, if (m == NULL) return (NULL); #endif /* NPF > 0 */ + in6_proto_cksum_out(m, ifp); break; } |