diff options
-rw-r--r-- | sys/net/if_bridge.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 4e27e3f249f..377f6f5d074 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.294 2017/02/05 16:04:14 jca Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.295 2017/05/12 22:43:21 bluhm Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -1425,17 +1425,6 @@ bridge_ipsec(struct bridge_softc *sc, struct ifnet *ifp, sizeof(struct in_addr), (caddr_t)&dst.sin.sin_addr); - if (ip->ip_p == IPPROTO_ESP) - m_copydata(m, hlen, sizeof(u_int32_t), - (caddr_t)&spi); - else if (ip->ip_p == IPPROTO_AH) - m_copydata(m, hlen + sizeof(u_int32_t), - sizeof(u_int32_t), (caddr_t)&spi); - else if (ip->ip_p == IPPROTO_IPCOMP) { - m_copydata(m, hlen + sizeof(u_int16_t), - sizeof(u_int16_t), (caddr_t)&cpi); - spi = ntohl(htons(cpi)); - } break; #ifdef INET6 case AF_INET6: @@ -1459,25 +1448,26 @@ bridge_ipsec(struct bridge_softc *sc, struct ifnet *ifp, sizeof(struct in6_addr), (caddr_t)&dst.sin6.sin6_addr); - if (proto == IPPROTO_ESP) - m_copydata(m, hlen, sizeof(u_int32_t), - (caddr_t)&spi); - else if (proto == IPPROTO_AH) - m_copydata(m, hlen + sizeof(u_int32_t), - sizeof(u_int32_t), (caddr_t)&spi); - else if (proto == IPPROTO_IPCOMP) { - m_copydata(m, hlen + sizeof(u_int16_t), - sizeof(u_int16_t), (caddr_t)&cpi); - spi = ntohl(htons(cpi)); - } break; #endif /* INET6 */ default: return (0); } - if (proto == 0) - goto skiplookup; + switch (proto) { + case IPPROTO_ESP: + m_copydata(m, hlen, sizeof(u_int32_t), (caddr_t)&spi); + break; + case IPPROTO_AH: + m_copydata(m, hlen + sizeof(u_int32_t), + sizeof(u_int32_t), (caddr_t)&spi); + break; + case IPPROTO_IPCOMP: + m_copydata(m, hlen + sizeof(u_int16_t), + sizeof(u_int16_t), (caddr_t)&cpi); + spi = ntohl(htons(cpi)); + break; + } splsoftassert(IPL_SOFTNET); |