Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Macros

#define NPF_IP_SRC_ADDR_ALLOWLIST(_name, _ip_addr_array, _ip_addr_num, _af)
 Statically define a "ip address allowlist" packet filter condition.
#define NPF_IP_SRC_ADDR_BLOCKLIST(_name, _ip_addr_array, _ip_addr_num, _af)
 Statically define a "ip address blocklist" packet filter condition.

Detailed Description

Since
3.5
Version
0.8.0

Macro Definition Documentation

◆ NPF_IP_SRC_ADDR_ALLOWLIST

#define NPF_IP_SRC_ADDR_ALLOWLIST ( _name,
_ip_addr_array,
_ip_addr_num,
_af )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_ip _name = { \
.addr_family = _af, \
.ipaddr = (_ip_addr_array), \
.ipaddr_num = _ip_addr_num, \
.test.fn = npf_ip_src_addr_match, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "ip src allow", \
.test.type = NPF_TEST_TYPE_IP_SRC_ADDR_ALLOWLIST,)) \
}
#define IF_ENABLED(_flag, _code)
Insert code if _flag is defined and equals 1.
Definition util_macro.h:290

Statically define a "ip address allowlist" packet filter condition.

This tests if the packet source ip address matches any of the ip addresses contained in the provided set.

The set holds addresses of one address family. A packet of another address family matches none of them, so the condition is false for it.

Parameters
_nameName of the condition
_ip_addr_arrayArray of struct net_in_addr or struct net_in6_addr items to test against
_ip_addr_numnumber of IP addresses in the array
_afAddresses family type (NET_AF_INET / NET_AF_INET6) in the array

◆ NPF_IP_SRC_ADDR_BLOCKLIST

#define NPF_IP_SRC_ADDR_BLOCKLIST ( _name,
_ip_addr_array,
_ip_addr_num,
_af )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_ip _name = { \
.addr_family = _af, \
.ipaddr = (_ip_addr_array), \
.ipaddr_num = _ip_addr_num, \
.test.fn = npf_ip_src_addr_unmatch, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "ip src block", \
.test.type = NPF_TEST_TYPE_IP_SRC_ADDR_BLOCKLIST,)) \
}

Statically define a "ip address blocklist" packet filter condition.

This tests if the packet source ip address matches none of the ip addresses contained in the provided set.

The set holds addresses of one address family. A packet of another address family matches none of them, so the condition is true for it.

Parameters
_nameName of the condition
_ip_addr_arrayArray of struct net_in_addr or struct net_in6_addr items to test against
_ip_addr_numnumber of IP addresses in the array
_afAddresses family type (NET_AF_INET / NET_AF_INET6) in the array