Skip to content

nftables ¤

Classes:

Functions:

Attributes:

NFPROTO_INET module-attribute ¤

NFPROTO_INET = 1

NFPROTO_IPV4 module-attribute ¤

NFPROTO_IPV4 = 2

NFPROTO_ARP module-attribute ¤

NFPROTO_ARP = 3

NFPROTO_NETDEV module-attribute ¤

NFPROTO_NETDEV = 5

NFPROTO_BRIDGE module-attribute ¤

NFPROTO_BRIDGE = 7

NFPROTO_IPV6 module-attribute ¤

NFPROTO_IPV6 = 10

nftables_table_family module-attribute ¤

nftables_table_family = {
    "inet": NFPROTO_INET,
    "ip": NFPROTO_IPV4,
    "arp": NFPROTO_ARP,
    "netdev": NFPROTO_NETDEV,
    "bridge": NFPROTO_BRIDGE,
    "ip6": NFPROTO_IPV6,
}

NftFields ¤

Bases: object

Methods:

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

Expr ¤

Expr(addr: Value)

Methods:

Attributes:

expr_name property ¤

expr_name: str

print_expr_iptables ¤

print_expr_iptables(expr_name: str)

print_expr_nftables ¤

print_expr_nftables(expr_name: str)

print ¤

print(print_nested: bool = True)

Rule ¤

Rule(addr: Value, chain: 'Chain')

Bases: NftFields

Methods:

Attributes:

handle instance-attribute ¤

handle: int

userdata property ¤

userdata: bytearray

find classmethod ¤

find(
    table_name: str,
    table_family: int,
    chain_name: str,
    rule_id: int,
    nsid: int | None = None,
) -> Iterator["Rule"]

iter_exprs ¤

iter_exprs() -> Iterator[Expr]

print ¤

print(print_nested: bool = True)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

ChainHook ¤

ChainHook(parent: 'Chain')

Bases: NftFields

Methods:

Attributes:

hooknum instance-attribute ¤

hooknum: int

priority instance-attribute ¤

priority: int

dev property ¤

dev: str

devs property ¤

devs: list[str]

is_netdev ¤

is_netdev() -> bool

get_netdevs ¤

get_netdevs() -> list[str]

nested_print ¤

nested_print(nested: int = 0)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

Chain ¤

Chain(addr: Value)

Bases: NftFields

Methods:

Attributes:

bound instance-attribute ¤

bound: int

genmask instance-attribute ¤

genmask: int

handle instance-attribute ¤

handle: int

use instance-attribute ¤

use: int

flags instance-attribute ¤

flags: int

name instance-attribute ¤

name: str

hook instance-attribute ¤

hook: ChainHook = ChainHook(self)

userdata property ¤

userdata: bytearray

policy property ¤

policy: int

type property ¤

type: str

table property ¤

table: 'Table'

basechain property ¤

basechain: Value | None

find classmethod ¤

find(
    table_family: int | None = None,
    table_name: str | None = None,
    chain_name: str | None = None,
    nsid: int | None = None,
) -> Iterator["Chain"]

iter_rules ¤

iter_rules() -> Iterator[Rule]

print ¤

print(print_nested: bool = True)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

Set ¤

Set(addr: Value)

Bases: NftFields

Methods:

Attributes:

use instance-attribute ¤

use: int

dead instance-attribute ¤

dead: int

genmask instance-attribute ¤

genmask: int

field_count instance-attribute ¤

field_count: int

num_exprs instance-attribute ¤

num_exprs: int

name instance-attribute ¤

name: str

flags instance-attribute ¤

flags: int

ktype instance-attribute ¤

ktype: int

klen instance-attribute ¤

klen: int

dtype instance-attribute ¤

dtype: int

dlen instance-attribute ¤

dlen: int

policy instance-attribute ¤

policy: int

timeout instance-attribute ¤

timeout: int

gc_int instance-attribute ¤

gc_int: int

objtype instance-attribute ¤

objtype: int

handle instance-attribute ¤

handle: int

nelems property ¤

nelems: int

desc_size property ¤

desc_size: int

desc_concat property ¤

desc_concat: list[int]

table property ¤

table: 'Table'

userdata property ¤

userdata: bytearray

iter_expr ¤

iter_expr() -> Iterator[Expr]

iter_elems ¤

iter_elems() -> Iterator[None]

print ¤

print(print_nested: bool = True)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

Object ¤

Object(addr: Value)

Bases: NftFields

Methods:

Attributes:

genmask instance-attribute ¤

genmask: int

use instance-attribute ¤

use: int

handle instance-attribute ¤

handle: int

type property ¤

type: int

name property ¤

name: str

table property ¤

table: 'Table'

userdata property ¤

userdata: bytearray

iter_data ¤

iter_data() -> Iterator[None]

print ¤

print(print_nested: bool = True)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

FlowtableHook ¤

FlowtableHook(parent: 'Flowtable')

Bases: NftFields

Methods:

Attributes:

hooknum property ¤

hooknum: int

priority property ¤

priority: int

devs property ¤

devs: list[str]

nested_print ¤

nested_print(nested: int = 0)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

Flowtable ¤

Flowtable(addr: Value)

Bases: NftFields

Methods:

Attributes:

genmask instance-attribute ¤

genmask: int

name instance-attribute ¤

name: str

use instance-attribute ¤

use: int

handle instance-attribute ¤

handle: int

hook instance-attribute ¤

table property ¤

table: 'Table'

flags property ¤

flags: int

print ¤

print(print_nested: bool = True)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

Table ¤

Table(addr: Value)

Bases: NftFields

Methods:

Attributes:

family instance-attribute ¤

family: int

genmask instance-attribute ¤

genmask: int

name instance-attribute ¤

name: str

handle instance-attribute ¤

handle: int

use instance-attribute ¤

use: int

flags instance-attribute ¤

flags: int

nlpid instance-attribute ¤

nlpid: int

find classmethod ¤

find(
    table_name: str | None = None,
    table_family: int | None = None,
    nsid: int | None = None,
) -> Iterator["Table"]

iter_chains ¤

iter_chains() -> Iterator[Chain]

iter_sets ¤

iter_sets() -> Iterator[Set]

iter_flowtables ¤

iter_flowtables() -> Iterator[Flowtable]

iter_objects ¤

iter_objects() -> Iterator[Object]

nested_print ¤

nested_print(nested: int = 0)

print ¤

print(print_nested: bool = True)

__getattr__ ¤

__getattr__(name: str)

get_hook_list_dev_names classmethod ¤

get_hook_list_dev_names(hook_list: Value) -> list[str]

print_fields ¤

print_fields(nested: int = 0, keys: list[str] = None)

Nftables ¤

Nftables(addr: Value)

Methods:

find classmethod ¤

find(nsid: int | None = None) -> 'Nftables' | None

iter_tables ¤

iter_tables() -> Iterator[Table]

print ¤

print()

catch_error ¤

catch_error(func)

get_init_net_namespace ¤

get_init_net_namespace() -> Value