Page MenuHomeFreeBSD

D62100.1795755742.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D62100.1795755742.diff

diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c
--- a/sys/netipsec/ipsec_input.c
+++ b/sys/netipsec/ipsec_input.c
@@ -76,6 +76,7 @@
#include <netinet/ip6.h>
#ifdef INET6
#include <netinet6/ip6_var.h>
+#include <netinet6/scope6_var.h>
#endif
#include <netinet/in_pcb.h>
#ifdef INET6
@@ -788,14 +789,30 @@
goto bad_unlocked;
}
/*
- * AH, ESP and IPComp are not in ip6_protox[]; as in
- * ip6_input(), a further IPsec header of a bundle has to be
- * handed back to IPsec here.
+ * AH, ESP and IPComp are not in ip6_protox[]; a further
+ * IPsec header of a bundle has to go back to IPsec. Its
+ * transform may call back on the stack it is called on, so
+ * calling it from here would nest one callback in another
+ * for every such header. Requeue the packet instead, as
+ * the IPv4 callback does, and let ip6_input() hand over the
+ * header. ip6_input() expects the addresses as they were
+ * on the wire.
*/
if (nxt == IPPROTO_AH || nxt == IPPROTO_ESP ||
nxt == IPPROTO_IPCOMP) {
- error = ipsec_common_input(m, skip,
- ip6_get_prevhdr(m, skip), AF_INET6, nxt);
+ if (m->m_len < sizeof(struct ip6_hdr) &&
+ (m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
+ IPSEC_ISTAT(sproto, hdrops);
+ error = ENOBUFS;
+ break;
+ }
+ ip6 = mtod(m, struct ip6_hdr *);
+ in6_clearscope(&ip6->ip6_src);
+ in6_clearscope(&ip6->ip6_dst);
+ error = netisr_queue_src(NETISR_IPV6,
+ (uintptr_t)sav->spi, m);
+ if (error != 0)
+ IPSEC_ISTAT(sproto, qfull);
break;
}
nxt = ip6_protox[nxt](&m, &skip, nxt);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 27, 5:02 AM (18 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42035418
Default Alt Text
D62100.1795755742.diff (1 KB)

Event Timeline