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

Function rte_ipsec_sad_find_existing

dpdk/lib/ipsec/ipsec_sad.c:383–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383struct rte_ipsec_sad *
384rte_ipsec_sad_find_existing(const char *name)
385{
386 char sad_name[RTE_IPSEC_SAD_NAMESIZE];
387 struct rte_ipsec_sad *sad = NULL;
388 struct rte_tailq_entry *te;
389 struct rte_ipsec_sad_list *sad_list;
390 int ret;
391
392 ret = snprintf(sad_name, RTE_IPSEC_SAD_NAMESIZE, SAD_FORMAT, name);
393 if (ret < 0 || ret >= RTE_IPSEC_SAD_NAMESIZE) {
394 rte_errno = ENAMETOOLONG;
395 return NULL;
396 }
397
398 sad_list = RTE_TAILQ_CAST(rte_ipsec_sad_tailq.head,
399 rte_ipsec_sad_list);
400
401 rte_mcfg_tailq_read_lock();
402 TAILQ_FOREACH(te, sad_list, next) {
403 sad = (struct rte_ipsec_sad *) te->data;
404 if (strncmp(sad_name, sad->name, RTE_IPSEC_SAD_NAMESIZE) == 0)
405 break;
406 }
407 rte_mcfg_tailq_read_unlock();
408
409 if (te == NULL) {
410 rte_errno = ENOENT;
411 return NULL;
412 }
413
414 return sad;
415}
416
417void
418rte_ipsec_sad_destroy(struct rte_ipsec_sad *sad)

Callers 1

test_find_existingFunction · 0.85

Calls 4

snprintfFunction · 0.85
rte_mcfg_tailq_read_lockFunction · 0.85
strncmpFunction · 0.85

Tested by 1

test_find_existingFunction · 0.68