package ebtables
import "k8s.io/utils/net/ebtables"
Package ebtables allows to control the ebtables Linux-based bridging firewall. Both chains and rules can be added, deleted and modified. For ebtables specific documentation see: http://ebtables.netfilter.org/
Index ¶
Types ¶
type Chain ¶
type Chain string
Chain is an Ebtables chain type
const ( ChainPostrouting Chain = "POSTROUTING" ChainPrerouting Chain = "PREROUTING" ChainOutput Chain = "OUTPUT" ChainInput Chain = "INPUT" ChainBrouting Chain = "BROUTING" )
Chains that are built-in in ebtables
type Interface ¶
type Interface interface {
// GetVersion returns the "X.Y.Z" semver string for ebtables.
GetVersion() (string, error)
// EnsureRule checks if the specified rule is present and, if not, creates it. If the rule existed, return true.
// WARNING: ebtables does not provide check operation like iptables do. Hence we have to do a string match of args.
// Input args must follow the format and sequence of ebtables list output. Otherwise, EnsureRule will always create
// new rules and causing duplicates.
EnsureRule(position RulePosition, table Table, chain Chain, args ...string) (bool, error)
// DeleteRule checks if the specified rule is present and, if so, deletes it.
DeleteRule(table Table, chain Chain, args ...string) error
// EnsureChain checks if the specified chain is present and, if not, creates it. If the rule existed, return true.
EnsureChain(table Table, chain Chain) (bool, error)
// DeleteChain deletes the specified chain. If the chain did not exist, return error.
DeleteChain(table Table, chain Chain) error
// FlushChain flush the specified chain. If the chain did not exist, return error.
FlushChain(table Table, chain Chain) error
}
Interface for running ebtables commands. Implementations must be goroutine-safe.
func New ¶
New returns a new Interface which will exec ebtables.
type RulePosition ¶
type RulePosition string
RulePosition is the rule position within a table
const ( Prepend RulePosition = "-I" Append RulePosition = "-A" )
Relative position for a new rule
type Table ¶
type Table string
Table is an Ebtables table type
Tables available in ebtables by default
Source Files ¶
ebtables.go
- Version
- v0.0.0-20260319190234-28399d86e0b5 (latest)
- Published
- Mar 19, 2026
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 14 hours ago –
Tools for package owners.