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

Function ipsec_srcaddr

freebsd/net/if_ipsec.c:810–831  ·  view source on GitHub ↗

* ifaddr_event handler. * Clear IFF_DRV_RUNNING flag when ingress address disappears to prevent * source address spoofing. */

Source from the content-addressed store, hash-verified

808 * source address spoofing.
809 */
810static void
811ipsec_srcaddr(void *arg __unused, const struct sockaddr *sa,
812 int event __unused)
813{
814 struct ipsec_softc *sc;
815 struct secasindex *saidx;
816
817 /* Check that VNET is ready */
818 if (V_ipsec_idhtbl == NULL)
819 return;
820
821 NET_EPOCH_ASSERT();
822 CK_LIST_FOREACH(sc, ipsec_srchash(sa), srchash) {
823 if (sc->family == 0)
824 continue;
825 saidx = ipsec_getsaidx(sc, IPSEC_DIR_OUTBOUND, sa->sa_family);
826 if (saidx == NULL ||
827 key_sockaddrcmp(&saidx->src.sa, sa, 0) != 0)
828 continue;
829 ipsec_set_running(sc);
830 }
831}
832
833/*
834 * Allocate new private security policies for tunneling interface.

Callers

nothing calls this directly

Calls 4

ipsec_srchashFunction · 0.85
ipsec_getsaidxFunction · 0.85
key_sockaddrcmpFunction · 0.85
ipsec_set_runningFunction · 0.85

Tested by

no test coverage detected