iptables

package
v2.4.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForwardExists

func ForwardExists(t *testing.T, ipt *iptables.IPTables, chain, containerIP string, port int) bool

ForwardExists check that at least 2 rules are present in the CNI-HOSTPORT-DNAT chain and checks for regex matches in the list of rules

func ForwardExistsFromRules

func ForwardExistsFromRules(rules []string, containerIP string, port int) (bool, error)

ForwardExistsFromRules checks whether an iptables forwarding rule exists in the provided list of rule strings. Unlike ForwardExists, this function does not query iptables directly, making it suitable for use with pre-captured command output (e.g., from helpers.Custom("iptables", ...)).

func GetRedirectedChain

func GetRedirectedChain(t *testing.T, ipt *iptables.IPTables, chain, namespace, containerID string) string

GetRedirectedChain returns the chain where the traffic is being redirected. This is how libcni manage its port maps. Suppose you have the following rule: -A CNI-HOSTPORT-DNAT -p tcp -m comment --comment "dnat name: \"bridge\" id: \"default-YYYYYY\"" -m multiport --dports 9999 -j CNI-DN-XXXXXX So the chain where the traffic is redirected is CNI-DN-XXXXXX Returns an empty string in case nothing was found.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL