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

Function ipsec_srchash

freebsd/net/if_ipsec.c:133–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static struct ipsec_iflist *
134ipsec_srchash(const struct sockaddr *sa)
135{
136 uint32_t hval;
137
138 switch (sa->sa_family) {
139#ifdef INET
140 case AF_INET:
141 hval = fnv_32_buf(
142 &((const struct sockaddr_in *)sa)->sin_addr.s_addr,
143 sizeof(in_addr_t), FNV1_32_INIT);
144 return (&V_ipsec4_srchtbl[hval & (IPSEC_HASH_SIZE - 1)]);
145#endif
146#ifdef INET6
147 case AF_INET6:
148 hval = fnv_32_buf(
149 &((const struct sockaddr_in6 *)sa)->sin6_addr,
150 sizeof(struct in6_addr), FNV1_32_INIT);
151 return (&V_ipsec6_srchtbl[hval & (IPSEC_HASH_SIZE - 1)]);
152#endif
153 }
154 return (NULL);
155}
156
157/*
158 * ipsec_ioctl_sx protects from concurrent ioctls.

Callers 2

ipsec_srcaddrFunction · 0.85
ipsec_set_tunnelFunction · 0.85

Calls 1

fnv_32_bufFunction · 0.85

Tested by

no test coverage detected