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

Function ipsec4_checkpolicy

freebsd/netipsec/ipsec.c:599–625  ·  view source on GitHub ↗

* Check security policy for *OUTBOUND* IPv4 packet. */

Source from the content-addressed store, hash-verified

597 * Check security policy for *OUTBOUND* IPv4 packet.
598 */
599struct secpolicy *
600ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error,
601 int needport)
602{
603 struct secpolicy *sp;
604
605 *error = 0;
606 sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport);
607 if (sp != NULL)
608 sp = ipsec_checkpolicy(sp, inp, error);
609 if (sp == NULL) {
610 switch (*error) {
611 case 0: /* No IPsec required: BYPASS or NONE */
612 break;
613 case -EINVAL:
614 IPSECSTAT_INC(ips_out_polvio);
615 break;
616 default:
617 IPSECSTAT_INC(ips_out_inval);
618 }
619 }
620 KEYDBG(IPSEC_STAMP,
621 printf("%s: using SP(%p), error %d\n", __func__, sp, *error));
622 if (sp != NULL)
623 KEYDBG(IPSEC_DATA, kdebug_secpolicy(sp));
624 return (sp);
625}
626
627/*
628 * Check IPv4 packet against *INBOUND* security policy.

Callers 1

ipsec4_common_outputFunction · 0.85

Calls 4

ipsec4_getpolicyFunction · 0.85
ipsec_checkpolicyFunction · 0.85
kdebug_secpolicyFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected