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

Function ipsec6_checkpolicy

freebsd/netipsec/ipsec.c:768–794  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

766 * Check security policy for *OUTBOUND* IPv6 packet.
767 */
768struct secpolicy *
769ipsec6_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error,
770 int needport)
771{
772 struct secpolicy *sp;
773
774 *error = 0;
775 sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport);
776 if (sp != NULL)
777 sp = ipsec_checkpolicy(sp, inp, error);
778 if (sp == NULL) {
779 switch (*error) {
780 case 0: /* No IPsec required: BYPASS or NONE */
781 break;
782 case -EINVAL:
783 IPSEC6STAT_INC(ips_out_polvio);
784 break;
785 default:
786 IPSEC6STAT_INC(ips_out_inval);
787 }
788 }
789 KEYDBG(IPSEC_STAMP,
790 printf("%s: using SP(%p), error %d\n", __func__, sp, *error));
791 if (sp != NULL)
792 KEYDBG(IPSEC_DATA, kdebug_secpolicy(sp));
793 return (sp);
794}
795
796/*
797 * Check IPv6 packet against inbound security policy.

Callers 1

ipsec6_common_outputFunction · 0.85

Calls 4

ipsec6_getpolicyFunction · 0.85
ipsec_checkpolicyFunction · 0.85
kdebug_secpolicyFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected