summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErmal Luçi <eri@FreeBSD.org>2015-07-03 15:31:56 +0000
committerErmal Luçi <eri@FreeBSD.org>2015-07-03 15:31:56 +0000
commitc1fc5e96016e21b74432999ab6ec4a72d4a0b60c (patch)
tree55ea0e8400e859e69f67448ec59b04c9e7310404
parent4ebd95ae06e42186e2ecf744c869b06f74f3be0b (diff)
Notes
-rw-r--r--sys/netipsec/ipsec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netipsec/ipsec.c b/sys/netipsec/ipsec.c
index 266f6d00d5a0..2ac87ab5523a 100644
--- a/sys/netipsec/ipsec.c
+++ b/sys/netipsec/ipsec.c
@@ -334,6 +334,12 @@ ipsec_getpolicybysock(struct mbuf *m, u_int dir, struct inpcb *inp, int *error)
IPSEC_ASSERT(dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND,
("invalid direction %u", dir));
+ if (!key_havesp(dir)) {
+ /* No SP found, use system default. */
+ sp = KEY_ALLOCSP_DEFAULT();
+ return (sp);
+ }
+
/* Set spidx in pcb. */
*error = ipsec_setspidx_inpcb(m, inp);
if (*error)