summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2001-07-26 19:19:49 +0000
committerume <ume@FreeBSD.org>2001-07-26 19:19:49 +0000
commite8ae8d1bf4f1b0d1984c5a45d58d8994cbee6d48 (patch)
tree8e3bd5ef7aeeff3d2485710cc7d3d4eeb27b0586 /sys/netinet/in_pcb.c
parent0a0f3b54c3fa214be9208289900f9ef8ff4e3284 (diff)
downloadFreeBSD-src-e8ae8d1bf4f1b0d1984c5a45d58d8994cbee6d48.zip
FreeBSD-src-e8ae8d1bf4f1b0d1984c5a45d58d8994cbee6d48.tar.gz
move ipsec security policy allocation into in_pcballoc, before
making pcbs available to the outside world. otherwise, we will see inpcb without ipsec security policy attached (-> panic() in ipsec.c). Obtained from: KAME MFC after: 3 days
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 9965c6a..2d31c30 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -142,6 +142,9 @@ in_pcballoc(so, pcbinfo, p)
struct proc *p;
{
register struct inpcb *inp;
+#ifdef IPSEC
+ int error;
+#endif
inp = zalloc(pcbinfo->ipi_zone);
if (inp == NULL)
@@ -150,6 +153,13 @@ in_pcballoc(so, pcbinfo, p)
inp->inp_gencnt = ++pcbinfo->ipi_gencnt;
inp->inp_pcbinfo = pcbinfo;
inp->inp_socket = so;
+#ifdef IPSEC
+ error = ipsec_init_policy(so, &inp->inp_sp);
+ if (error != 0) {
+ zfree(pcbinfo->ipi_zone, inp);
+ return error;
+ }
+#endif /*IPSEC*/
#if defined(INET6)
if (INP_SOCKAF(so) == AF_INET6 && !ip6_mapped_addr_on)
inp->inp_flags |= IN6P_IPV6_V6ONLY;
OpenPOWER on IntegriCloud