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

Function key_cmpspidx_exactly

freebsd/netipsec/key.c:4169–4188  ·  view source on GitHub ↗

* compare two secindex structure exactly. * IN: * spidx0: source, it is often in SPD. * spidx1: object, it is often from PFKEY message. * OUT: * 1 : equal * 0 : not equal */

Source from the content-addressed store, hash-verified

4167 * 0 : not equal
4168 */
4169static int
4170key_cmpspidx_exactly(struct secpolicyindex *spidx0,
4171 struct secpolicyindex *spidx1)
4172{
4173 /* sanity */
4174 if (spidx0 == NULL && spidx1 == NULL)
4175 return 1;
4176
4177 if (spidx0 == NULL || spidx1 == NULL)
4178 return 0;
4179
4180 if (spidx0->prefs != spidx1->prefs
4181 || spidx0->prefd != spidx1->prefd
4182 || spidx0->ul_proto != spidx1->ul_proto
4183 || spidx0->dir != spidx1->dir)
4184 return 0;
4185
4186 return key_sockaddrcmp(&spidx0->src.sa, &spidx1->src.sa, 1) == 0 &&
4187 key_sockaddrcmp(&spidx0->dst.sa, &spidx1->dst.sa, 1) == 0;
4188}
4189
4190/*
4191 * compare two secindex structure with mask.

Callers 3

key_allocspFunction · 0.85
key_getspFunction · 0.85
key_getspacqFunction · 0.85

Calls 1

key_sockaddrcmpFunction · 0.85

Tested by

no test coverage detected