---
name: "rte_ipsec_sad_lookup"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_ipsec_sad.h"
---

# rte\_ipsec\_sad\_lookup(3)

Part of [rte\_ipsec\_sad.h(3)](/rte_ipsec_sad.h/3.md).

## NAME

rte\_ipsec\_sad.h

## SYNOPSIS

`#include <stdint.h>`\
 `#include <rte_ip6.h>`\

### Data Structures

struct **rte\_ipsec\_sad\_conf**\

### Macros

\#define **RTE\_IPSEC\_SAD\_NAMESIZE**   64\
 \#define **RTE\_IPSEC\_SAD\_FLAG\_IPV6**   0x1\
 \#define **RTE\_IPSEC\_SAD\_FLAG\_RW\_CONCURRENCY**   0x2\

### Enumerations

enum \

### Functions

int **rte\_ipsec\_sad\_add** (struct rte\_ipsec\_sad \*sad, const union rte\_ipsec\_sad\_key \*key, int key\_type, void \*sa)\
 int **rte\_ipsec\_sad\_del** (struct rte\_ipsec\_sad \*sad, const union rte\_ipsec\_sad\_key \*key, int key\_type)\
 struct rte\_ipsec\_sad \* **rte\_ipsec\_sad\_find\_existing** (const char \*name)\
 void **rte\_ipsec\_sad\_destroy** (struct rte\_ipsec\_sad \*sad)\
 int **rte\_ipsec\_sad\_lookup** (const struct rte\_ipsec\_sad \*sad, const union rte\_ipsec\_sad\_key \*keys\[\], void \*sa\[\], uint32\_t n)\

## Detailed Description

RTE IPsec security association database (SAD) support. Contains helper functions to lookup and maintain SAD

Definition in file **rte\_ipsec\_sad.h**.

## Macro Definition Documentation

### #define RTE\_IPSEC\_SAD\_NAMESIZE 64

Max number of characters in SAD name.

Definition at line **52** of file **rte\_ipsec\_sad.h**.

### #define RTE\_IPSEC\_SAD\_FLAG\_IPV6 0x1

Flag to create SAD with ipv6 dip and sip addresses

Definition at line **54** of file **rte\_ipsec\_sad.h**.

### #define RTE\_IPSEC\_SAD\_FLAG\_RW\_CONCURRENCY 0x2

Flag to support reader writer concurrency

Definition at line **56** of file **rte\_ipsec\_sad.h**.

## Enumeration Type Documentation

### anonymous enum

Type of key

Definition at line **27** of file **rte\_ipsec\_sad.h**.

## Function Documentation

### int rte\_ipsec\_sad\_add (struct rte\_ipsec\_sad \* sad, const union rte\_ipsec\_sad\_key \* key, int key\_type, void \* sa)

Add a rule into the SAD. Could be safely called with concurrent lookups if RTE\_IPSEC\_SAD\_FLAG\_RW\_CONCURRENCY flag was configured on creation time. While with this flag multi-reader - one-writer model Is MT safe, multi-writer model is not and required extra synchronisation.

**Parameters**

*sad* SAD object handle \
 *key* pointer to the key \
 *key\_type* key type (spi only/spi+dip/spi+dip+sip) \
 *sa* Pointer associated with the key to save in a SAD Must be 4 bytes aligned.

**Returns**

0 on success, negative value otherwise

### int rte\_ipsec\_sad\_del (struct rte\_ipsec\_sad \* sad, const union rte\_ipsec\_sad\_key \* key, int key\_type)

Delete a rule from the SAD. Could be safely called with concurrent lookups if RTE\_IPSEC\_SAD\_FLAG\_RW\_CONCURRENCY flag was configured on creation time. While with this flag multi-reader - one-writer model Is MT safe, multi-writer model is not and required extra synchronisation.

**Parameters**

*sad* SAD object handle \
 *key* pointer to the key \
 *key\_type* key type (spi only/spi+dip/spi+dip+sip)

**Returns**

0 on success, negative value otherwise

### struct rte\_ipsec\_sad \* rte\_ipsec\_sad\_find\_existing (const char \* name)

Find an existing SAD object and return a pointer to it.

**Parameters**

*name* Name of the SAD object as passed to rte\_ipsec\_sad\_create()

**Returns**

Pointer to sad object or NULL if object not found with rte\_errno set appropriately. Possible rte\_errno values include:

- •

  ENOENT - required entry not available to return.

### void rte\_ipsec\_sad\_destroy (struct rte\_ipsec\_sad \* sad)

Destroy SAD object.

**Parameters**

*sad* pointer to the SAD object

### int rte\_ipsec\_sad\_lookup (const struct rte\_ipsec\_sad \* sad, const union rte\_ipsec\_sad\_key \* keys\[\], void \* sa\[\], uint32\_t n)

Lookup multiple keys in the SAD.

**Parameters**

*sad* SAD object handle \
 *keys* Array of keys to be looked up in the SAD \
 *sa* Pointer associated with the keys. If the lookup for the given key failed, then corresponding sa will be NULL \
 *n* Number of elements in keys array to lookup.

**Returns**

\-EINVAL for incorrect arguments, otherwise number of successful lookups.

## Author

Generated automatically by Doxygen for DPDK from the source code.
