diff options
author | ae <ae@FreeBSD.org> | 2014-11-13 13:08:46 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2014-11-13 13:08:46 +0000 |
commit | 8b16f1c857591e35897289e16425308ecb42e325 (patch) | |
tree | 1f9233cfeb7c714a8e07e295c77d56cd28e7b2b3 /sys/netipsec | |
parent | 189aa5130fa47074600a59f6406e31af5aac4b3a (diff) | |
download | FreeBSD-src-8b16f1c857591e35897289e16425308ecb42e325.zip FreeBSD-src-8b16f1c857591e35897289e16425308ecb42e325.tar.gz |
MFC r274193:
When mode isn't explicitly specified (wildcard) and inner protocol isn't
IPv4 or IPv6, assume it is the transport mode.
Sponsored by: Yandex LLC
Diffstat (limited to 'sys/netipsec')
-rw-r--r-- | sys/netipsec/ipsec_input.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index 334b22f..c098a16 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -406,7 +406,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, } #ifdef INET6 /* IPv6-in-IP encapsulation. */ - if (prot == IPPROTO_IPV6 && + else if (prot == IPPROTO_IPV6 && saidx->mode != IPSEC_MODE_TRANSPORT) { if (m->m_pkthdr.len - skip < sizeof(struct ip6_hdr)) { @@ -443,6 +443,15 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, #endif /* notyet */ } #endif /* INET6 */ + else if (prot != IPPROTO_IPV6 && saidx->mode == IPSEC_MODE_ANY) { + /* + * When mode is wildcard, inner protocol is IPv6 and + * we have no INET6 support - drop this packet a bit later. + * In other cases we assume transport mode and outer + * header was already stripped in xform_xxx_cb. + */ + prot = IPPROTO_IPIP; + } /* * Record what we've done to the packet (under what SA it was |