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

Function cmp_sa_key

dpdk/examples/ipsec-secgw/sad.h:28–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26int ipsec_sad_lcore_cache_init(uint32_t nb_cache_ent);
27
28static inline int
29cmp_sa_key(struct ipsec_sa *sa, int is_v4, struct rte_ipv4_hdr *ipv4,
30 struct rte_ipv6_hdr *ipv6)
31{
32 int sa_type = WITHOUT_TRANSPORT_VERSION(sa->flags);
33 if ((sa_type == TRANSPORT) ||
34 /* IPv4 check */
35 (is_v4 && (sa_type == IP4_TUNNEL) &&
36 (sa->src.ip.ip4 == ipv4->src_addr) &&
37 (sa->dst.ip.ip4 == ipv4->dst_addr)) ||
38 /* IPv6 check */
39 (!is_v4 && (sa_type == IP6_TUNNEL) &&
40 (!memcmp(sa->src.ip.ip6.ip6, ipv6->src_addr, 16)) &&
41 (!memcmp(sa->dst.ip.ip6.ip6, ipv6->dst_addr, 16))))
42 return 1;
43
44 return 0;
45}
46
47static inline void
48sa_cache_update(struct ipsec_sa **sa_cache, struct ipsec_sa *sa, uint32_t mask)

Callers 1

sad_lookupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected