diff options
author | Andrey V. Elsukov <ae@FreeBSD.org> | 2014-11-06 20:23:57 +0000 |
---|---|---|
committer | Andrey V. Elsukov <ae@FreeBSD.org> | 2014-11-06 20:23:57 +0000 |
commit | 1f194d8ae116f17936715509762f5babeaf37ee6 (patch) | |
tree | 07eaa360ede63b9ce75d610d451039a86d3c5fdc /sys/netipsec | |
parent | 7fc89952f1b34a797e3cd839d0152fa1c826e347 (diff) | |
download | src-1f194d8ae116f17936715509762f5babeaf37ee6.tar.gz src-1f194d8ae116f17936715509762f5babeaf37ee6.zip |
When mode isn't explicitly specified (wildcard) and inner protocol isn't
IPv4 or IPv6, assume it is the transport mode.
Reported by: jmg
MFC after: 1 week
Sponsored by: Yandex LLC
Notes
Notes:
svn path=/head/; revision=274193
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 b778fe5def23..e9fe6e362f2c 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -432,7 +432,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)) { @@ -469,6 +469,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 |