setenv

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeTablesInterface

func MakeTablesInterface(ns netns.NsHandle) nftableslib.TablesInterface

MakeTablesInterface instantiates TablesInterface for a namespace passed as a parameter

func NFTablesSet

func NFTablesSet(ti nftableslib.TablesInterface, version nftables.TableFamily,
	nfrules []TestChain, debug bool, tableName ...string) (nftableslib.TablesInterface, error)

NFTablesSet sets up nftables rules in the namespace

func NewNS

func NewNS(name ...string) (ns netns.NsHandle, err error)

NewNS returns a namespace handle either for an already existing namespace specified by its name, or a new one which it creates.

func ProgramTestRules

func ProgramTestRules(ti nftableslib.TablesInterface, tn string, version nftables.TableFamily, nfrules []TestChain) error

ProgramTestRules program rules for a nf table specified by name and version

func TestICMP

func TestICMP(sourceNS netns.NsHandle, protocol nftables.TableFamily, saddr, daddr *nftableslib.IPAddr) error

TestICMP tests icmp connectivity between two namespaces, ping is initiated in source namespace and destination namespace is expected to reply with echo reply packets

Types

type NFTablesTest

type NFTablesTest struct {
	Name         string
	TableName    string
	Version      nftables.TableFamily
	SrcNFRules   []TestChain
	DstNFRules   []TestChain
	Saddr        string
	Daddr        string
	Validation   func(nftables.TableFamily, []netns.NsHandle, []*nftableslib.IPAddr) error
	DebugNFRules bool
}

NFTablesTest defines structure used for tests

type P2PTestEnv

type P2PTestEnv interface {
	Cleanup()
	GetNamespace() []netns.NsHandle
	GetIPs() []*nftableslib.IPAddr
}

P2PTestEnv defines methods to interact with an instantiated p2p test environment

func NewP2PTestEnv

func NewP2PTestEnv(version nftables.TableFamily, ip1s, ip2s string) (P2PTestEnv, error)

NewP2PTestEnv sets up two new net namespaces, builds a link between them and assigns ip addresses to each end of the link. It also checks connectivity by using ping.

type TestChain

type TestChain struct {
	Name  string
	Attr  *nftableslib.ChainAttributes
	Rules []nftableslib.Rule
}

TestChain defines a key in NFTablesTes map

Jump to

Keyboard shortcuts

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