Family nftables netlink specification¶
Operations¶
batch-begin¶
Start a batch of operations
- attribute-set
- fixed-header
- do
- request
- attributes
[
genid]
- reply
- attributes
[
genid]
newtable¶
Create a new table.
- attribute-set
- fixed-header
- do
- request
- attributes
[
name,flags,userdata]
gettable¶
Get / dump tables.
- attribute-set
- fixed-header
- do
- request
- attributes
[
name]
- reply
- attributes
[
name,use,handle,flags,owner,userdata]
- dump
- reply
- attributes
[
name,use,handle,flags,owner,userdata]
destroytable¶
Delete an existing table with destroy semantics (ignoring ENOENT errors).
- attribute-set
- fixed-header
- do
- request
- attributes
[
name,handle]
newchain¶
Create a new chain.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,handle,policy,flags,hook,name,counters,userdata,type]
getchain¶
Get / dump chains.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,name]
- reply
- attributes
[
table,name,handle,hook,policy,type,flags,counters,id,use,userdata]
- dump
- reply
- attributes
[
table,name,handle,hook,policy,type,flags,counters,id,use,userdata]
delchain¶
Delete an existing chain.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,handle,name,hook]
destroychain¶
Delete an existing chain with destroy semantics (ignoring ENOENT errors).
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,handle,name,hook]
newrule¶
Create a new rule.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,chain,chain-id,handle,position,position-id,expressions,userdata,compat]
getrule¶
Get / dump rules.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,chain,handle]
- reply
- attributes
[
table,chain,handle,position,expressions,userdata]
- dump
- request
- attributes
[
table,chain]
- reply
- attributes
[
table,chain,handle,position,expressions,userdata]
getrule-reset¶
Get / dump rules and reset stateful expressions.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,chain,handle]
- reply
- attributes
[
table,chain,handle,position,expressions,userdata]
- dump
- request
- attributes
[
table,chain,handle]
- reply
- attributes
[
table,chain,handle,position,expressions,userdata]
delrule¶
Delete an existing rule.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,chain,handle,id]
destroyrule¶
Delete an existing rule with destroy semantics (ignoring ENOENT errors).
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,chain,handle,id]
getset¶
Get / dump sets.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,name]
- reply
- attributes
[
table,name,handle,flags,key-len,key-type,data-type,data-len,obj-type,gc-interval,policy,userdata,desc,expr,expressions]
- dump
- request
- attributes
[
table]
- reply
- attributes
[
table,name,handle,flags,key-len,key-type,data-type,data-len,obj-type,gc-interval,policy,userdata,desc,expr,expressions]
destroyset¶
Delete an existing set with destroy semantics (ignoring ENOENT errors).
newsetelem¶
Create a new set element.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,set,set-id,elements]
getsetelem¶
Get / dump set elements.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,set,elements]
- reply
- attributes
[
elements]
- dump
- request
- attributes
[
table,set]
- reply
- attributes
[
table,set,elements]
getsetelem-reset¶
Get / dump set elements and reset stateful expressions.
- attribute-set
- fixed-header
- do
- request
- attributes
[
elements]
- reply
- attributes
[
table,set,elements]
- dump
- request
- attributes
[
table,set]
- reply
- attributes
[
table,set,elements]
delsetelem¶
Delete an existing set element.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,set,elements]
destroysetelem¶
Delete an existing set element with destroy semantics.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,set,elements]
destroyobj¶
Delete an existing stateful object with destroy semantics.
newflowtable¶
Create a new flow table.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,name,hook,flags]
getflowtable¶
Get / dump flow tables.
- attribute-set
- fixed-header
- do
- request
- attributes
[
name,table]
- reply
- attributes
[
table,name,handle,use,flags,hook]
- dump
- reply
- attributes
[
table,name,handle,use,flags,hook]
delflowtable¶
Delete an existing flow table.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,name,handle,hook]
destroyflowtable¶
Delete an existing flow table with destroy semantics.
- attribute-set
- fixed-header
- do
- request
- attributes
[
table,name,handle,hook]
Multicast groups¶
mgmt
Definitions¶
meta-keys¶
- type
enum
- entries
lenprotocolprioritymarkiifoifiifnameoifnameiftypeoiftypeskuidskgidnftracertclassidsecmarknfprotol4-protobri-iifnamebri-oifnamepkttypecpuiifgroupoifgroupcgroupprandomsecpathiifkindoifkindbri-iifpvidbri-iifvprototime-nstime-daytime-hoursdifsdifnamebri-broute
bitwise-ops¶
- type
enum
- entries
- mask-xor
mask-and-xor operation used to implement NOT, AND, OR and XOR boolean operations
- lshift
- rshift
- and
- or
- xor
object-type¶
- type
enum
- entries
unspeccounterquotact-helperlimitconnlimittunnelct-timeoutsecmarkct-expectsynproxy
nat-range-flags¶
- type
flags
- entries
map-ipsproto-specifiedproto-randompersistentproto-random-fullyproto-offsetnetmap
table-flags¶
- type
flags
- entries
dormantownerpersist
chain-flags¶
- type
flags
- entries
basehw-offloadbinding
set-elem-flags¶
- type
flags
- entries
interval-endcatchall
lookup-flags¶
- type
flags
- entries
invert
ct-keys¶
- type
enum
- entries
statedirectionstatusmarksecmarkexpirationhelperl3protocolsrcdstprotocolproto-srcproto-dstlabelspktsbytesavgpktzoneeventmasksrc-ipdst-ipsrc-ip6dst-ip6ct-id
ct-direction¶
- type
enum
- entries
originalreply
quota-flags¶
- type
flags
- entries
invertdepleted
verdict-code¶
- type
enum
- entries
- continue
- break
- jump
- goto
- return
- drop
- accept
- stolen
- queue
- repeat
fib-result¶
- type
enum
- entries
oifoifnameaddrtype
reject-types¶
- type
enum
- entries
icmp-unreachtcp-rsticmpx-unreach
reject-inet-code¶
- doc
These codes are mapped to real ICMP and ICMPv6 codes.
- type
enum
- entries
icmpx-no-routeicmpx-port-unreachicmpx-host-unreachicmpx-admin-prohibited
payload-base¶
- type
enum
- entries
link-layer-headernetwork-headertransport-headerinner-headertun-header
registers¶
- doc
nf_tables registers. nf_tables used to have five registers: a verdict register and four data registers of size 16. The data registers have been changed to 16 registers of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still map to areas of size 16, the 4 byte registers are addressed using NFT_REG32_00 - NFT_REG32_15.
- type
enum
- entries
- reg-verdict
- reg-1
- reg-2
- reg-3
- reg-4
- reg32-00
- reg32-01
- reg32-02
- reg32-03
- reg32-04
- reg32-05
- reg32-06
- reg32-07
- reg32-08
- reg32-09
- reg32-10
- reg32-11
- reg32-12
- reg32-13
- reg32-14
- reg32-15
numgen-types¶
- type
enum
- entries
incrementalrandom
log-level¶
- doc
nf_tables log levels
- type
enum
- entries
- emerg
system is unusable
- alert
action must be taken immediately
- crit
critical conditions
- err
error conditions
- warning
warning conditions
- notice
normal but significant condition
- info
informational
- debug
debug-level messages
- audit
enabling audit logging
Attribute sets¶
log-attrs¶
log expression netlink attributes
group (u16)¶
- doc
netlink group to send messages to
- byte-order
big-endian
prefix (string)¶
- doc
prefix to prepend to log messages
snaplen (u32)¶
- doc
length of payload to include in netlink message
- byte-order
big-endian
qthreshold (u16)¶
- doc
queue threshold
- byte-order
big-endian
numgen-attrs¶
nf_tables number generator expression netlink attributes
modulus (u32)¶
- doc
maximum counter value
- byte-order
big-endian
type (u32)¶
- doc
operation type
- byte-order
big-endian
- enum
offset (u32)¶
- doc
offset to be added to the counter
- byte-order
big-endian
range-attrs¶
from-data (nest)¶
- doc
data range from
- nested-attributes
to-data (nest)¶
- doc
data range to
- nested-attributes
batch-attrs¶
genid (u32)¶
- doc
generation ID for this changeset
- byte-order
big-endian
table-attrs¶
name (string)¶
- doc
name of the table
flags (u32)¶
- byte-order
big-endian
- doc
bitmask of flags
- enum
- enum-as-flags
True
use (u32)¶
- byte-order
big-endian
- doc
number of chains in this table
handle (u64)¶
- byte-order
big-endian
- doc
numeric handle of the table
pad (pad)¶
userdata (binary)¶
- doc
user data
owner (u32)¶
- byte-order
big-endian
- doc
owner of this table through netlink portID
chain-attrs¶
table (string)¶
- doc
name of the table containing the chain
handle (u64)¶
- byte-order
big-endian
- doc
numeric handle of the chain
name (string)¶
- doc
name of the chain
hook (nest)¶
- nested-attributes
- doc
hook specification for basechains
policy (u32)¶
- byte-order
big-endian
- doc
numeric policy of the chain
use (u32)¶
- byte-order
big-endian
- doc
number of references to this chain
type (string)¶
- doc
type name of the chain
counters (nest)¶
- nested-attributes
- doc
counter specification of the chain
flags (u32)¶
- byte-order
big-endian
- doc
chain flags
- enum
- enum-as-flags
True
id (u32)¶
- byte-order
big-endian
- doc
uniquely identifies a chain in a transaction
userdata (binary)¶
- doc
user data
nft-hook-attrs¶
num (u32)¶
- byte-order
big-endian
priority (s32)¶
- byte-order
big-endian
dev (string)¶
- doc
net device name
devs (nest)¶
- nested-attributes
- doc
list of net devices
hook-dev-attrs¶
name (string)¶
- multi-attr
True
rule-attrs¶
table (string)¶
- doc
name of the table containing the rule
chain (string)¶
- doc
name of the chain containing the rule
handle (u64)¶
- byte-order
big-endian
- doc
numeric handle of the rule
expressions (nest)¶
- nested-attributes
- doc
list of expressions
compat (nest)¶
- nested-attributes
- doc
compatibility specifications of the rule
position (u64)¶
- byte-order
big-endian
- doc
numeric handle of the previous rule
userdata (binary)¶
- doc
user data
id (u32)¶
- doc
uniquely identifies a rule in a transaction
position-id (u32)¶
- doc
transaction unique identifier of the previous rule
chain-id (u32)¶
- doc
add the rule to chain by ID, alternative to chain name
expr-list-attrs¶
elem (nest)¶
- nested-attributes
- multi-attr
True
expr-attrs¶
name (string)¶
- doc
name of the expression type
rule-compat-attrs¶
proto (u32)¶
- byte-order
big-endian
- doc
numeric value of the handled protocol
flags (u32)¶
- byte-order
big-endian
- doc
bitmask of flags
set-attrs¶
table (string)¶
- doc
table name
name (string)¶
- doc
set name
key-type (u32)¶
- byte-order
big-endian
- doc
key data type, informational purpose only
key-len (u32)¶
- byte-order
big-endian
- doc
key data length
data-type (u32)¶
- byte-order
big-endian
- doc
mapping data type
data-len (u32)¶
- byte-order
big-endian
- doc
mapping data length
policy (u32)¶
- byte-order
big-endian
- doc
selection policy
desc (nest)¶
- nested-attributes
- doc
set description
id (u32)¶
- doc
uniquely identifies a set in a transaction
timeout (u64)¶
- doc
default timeout value
gc-interval (u32)¶
- doc
garbage collection interval
userdata (binary)¶
- doc
user data
pad (pad)¶
obj-type (u32)¶
- byte-order
big-endian
- doc
stateful object type
handle (u64)¶
- byte-order
big-endian
- doc
set handle
expr (nest)¶
- nested-attributes
- doc
set expression
- multi-attr
True
expressions (nest)¶
- nested-attributes
- doc
list of expressions
type (string)¶
- doc
set backend type
count (u32)¶
- byte-order
big-endian
- doc
number of set elements
set-desc-attrs¶
size (u32)¶
- byte-order
big-endian
- doc
number of elements in set
concat (nest)¶
- nested-attributes
- doc
description of field concatenation
- multi-attr
True
set-desc-concat-attrs¶
elem (nest)¶
- nested-attributes
set-field-attrs¶
len (u32)¶
- byte-order
big-endian
set-list-attrs¶
elem (nest)¶
- nested-attributes
- multi-attr
True
setelem-attrs¶
key (nest)¶
- nested-attributes
- doc
key value
data (nest)¶
- nested-attributes
- doc
data value of mapping
flags (binary)¶
- doc
bitmask of nft_set_elem_flags
timeout (u64)¶
- doc
timeout value
expiration (u64)¶
- doc
expiration time
userdata (binary)¶
- doc
user data
expr (nest)¶
- nested-attributes
- doc
expression
objref (string)¶
- doc
stateful object reference
key-end (nest)¶
- nested-attributes
- doc
closing key value
expressions (nest)¶
- nested-attributes
- doc
list of expressions
setelem-list-elem-attrs¶
elem (nest)¶
- nested-attributes
- multi-attr
True
gen-attrs¶
id (u32)¶
- byte-order
big-endian
- doc
ruleset generation id
proc-pid (u32)¶
- byte-order
big-endian
proc-name (string)¶
obj-attrs¶
table (string)¶
- doc
name of the table containing the expression
name (string)¶
- doc
name of this expression type
type (u32)¶
- enum
- byte-order
big-endian
- doc
stateful object type
use (u32)¶
- byte-order
big-endian
- doc
number of references to this expression
handle (u64)¶
- byte-order
big-endian
- doc
object handle
pad (pad)¶
userdata (binary)¶
- doc
user data
quota-attrs¶
bytes (u64)¶
- byte-order
big-endian
flags (u32)¶
- byte-order
big-endian
- enum
pad (pad)¶
consumed (u64)¶
- byte-order
big-endian
flowtable-attrs¶
table (string)¶
name (string)¶
hook (nest)¶
- nested-attributes
use (u32)¶
- byte-order
big-endian
handle (u64)¶
- byte-order
big-endian
pad (pad)¶
flags (u32)¶
- byte-order
big-endian
flowtable-hook-attrs¶
num (u32)¶
- byte-order
big-endian
priority (u32)¶
- byte-order
big-endian
devs (nest)¶
- nested-attributes
expr-bitwise-attrs¶
The bitwise expression supports boolean and shift operations. It implements the boolean operations by performing the following operation:
dreg = (sreg & mask) ^ xor
with these mask and xor values:
op mask xor
---- ---- ---
NOT: 1 1
OR: ~x x
XOR: 1 x
AND: x 0
sreg (u32)¶
- byte-order
big-endian
dreg (u32)¶
- byte-order
big-endian
len (u32)¶
- byte-order
big-endian
mask (nest)¶
- nested-attributes
xor (nest)¶
- nested-attributes
op (u32)¶
- byte-order
big-endian
- enum
data (nest)¶
- nested-attributes
verdict-attrs¶
code (u32)¶
- doc
nf_tables verdict
- byte-order
big-endian
- enum
chain (string)¶
- doc
jump target chain name
chain-id (u32)¶
- doc
jump target chain ID
- byte-order
big-endian
expr-counter-attrs¶
bytes (u64)¶
- byte-order
big-endian
- doc
Number of bytes
packets (u64)¶
- byte-order
big-endian
- doc
Number of packets
pad (pad)¶
expr-ct-attrs¶
dreg (u32)¶
- byte-order
big-endian
direction (u8)¶
- enum
sreg (u32)¶
- byte-order
big-endian
expr-flow-offload-attrs¶
name (string)¶
- doc
Flow offload table name
expr-lookup-attrs¶
set (string)¶
- doc
Name of set to use
set-id (u32)¶
- byte-order
big-endian
- doc
ID of set to use
sreg (u32)¶
- byte-order
big-endian
dreg (u32)¶
- byte-order
big-endian
flags (u32)¶
- byte-order
big-endian
- enum
expr-masq-attrs¶
flags (u32)¶
- byte-order
big-endian
- enum
- enum-as-flags
True
expr-nat-attrs¶
type (u32)¶
- byte-order
big-endian
family (u32)¶
- byte-order
big-endian
reg-addr-min (u32)¶
- byte-order
big-endian
reg-addr-max (u32)¶
- byte-order
big-endian
reg-proto-min (u32)¶
- byte-order
big-endian
reg-proto-max (u32)¶
- byte-order
big-endian
flags (u32)¶
- byte-order
big-endian
- enum
- enum-as-flags
True
expr-payload-attrs¶
nf_tables payload expression netlink attributes
base (u32)¶
- doc
payload base
- enum
- byte-order
big-endian
offset (u32)¶
- doc
payload offset relative to base
- byte-order
big-endian
len (u32)¶
- doc
payload length
- byte-order
big-endian
csum-type (u32)¶
- doc
checksum type
- byte-order
big-endian
csum-offset (u32)¶
- doc
checksum offset relative to base
- byte-order
big-endian
csum-flags (u32)¶
- doc
checksum flags
- byte-order
big-endian
expr-tproxy-attrs¶
family (u32)¶
- byte-order
big-endian
reg-addr (u32)¶
- byte-order
big-endian
reg-port (u32)¶
- byte-order
big-endian
Sub-messages¶
expr-ops¶
- bitwise
- attribute-set
- cmp
- attribute-set
- counter
- attribute-set
- ct
- attribute-set
- fib
- attribute-set
- flow_offload
- attribute-set
- immediate
- attribute-set
- log
- attribute-set
- lookup
- attribute-set
- match
- attribute-set
- meta
- attribute-set
- nat
- attribute-set
- numgen
- attribute-set
- objref
- attribute-set
- payload
- attribute-set
- quota
- attribute-set
- range
- attribute-set
- reject
- attribute-set
- target
- attribute-set
- tproxy
- attribute-set