MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ipsec_checkpolicy

Function ipsec_checkpolicy

freebsd/netipsec/ipsec.c:412–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412static struct secpolicy *
413ipsec_checkpolicy(struct secpolicy *sp, struct inpcb *inp, int *error)
414{
415
416 /* Save found OUTBOUND policy into PCB SP cache. */
417 if (inp != NULL && inp->inp_sp != NULL && inp->inp_sp->sp_out == NULL)
418 ipsec_cachepolicy(inp, sp, IPSEC_DIR_OUTBOUND);
419
420 switch (sp->policy) {
421 default:
422 printf("%s: invalid policy %u\n", __func__, sp->policy);
423 /* FALLTHROUGH */
424 case IPSEC_POLICY_DISCARD:
425 *error = -EINVAL; /* Packet is discarded by caller. */
426 /* FALLTHROUGH */
427 case IPSEC_POLICY_BYPASS:
428 case IPSEC_POLICY_NONE:
429 key_freesp(&sp);
430 sp = NULL; /* NB: force NULL result. */
431 break;
432 case IPSEC_POLICY_IPSEC:
433 /* XXXAE: handle LARVAL SP */
434 break;
435 }
436 KEYDBG(IPSEC_DUMP,
437 printf("%s: get SP(%p), error %d\n", __func__, sp, *error));
438 return (sp);
439}
440
441static struct secpolicy *
442ipsec_getpcbpolicy(struct inpcb *inp, u_int dir)

Callers 2

ipsec4_checkpolicyFunction · 0.85
ipsec6_checkpolicyFunction · 0.85

Calls 3

ipsec_cachepolicyFunction · 0.85
key_freespFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected