xtables

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

A wrapper for google/gopacket pcap compilation for use with xt_bpf

A library for marshaling xt_bpf structs for use with nftables

Index

Constants

View Source
const (
	// https://github.com/torvalds/linux/blob/master/include/uapi/linux/netfilter/xt_bpf.h
	XtBpfModeBytecode = iota
	XtBpfModeFdPinned
	XtBpfModeFdElf
)

Constants for designating the mode xt_bpf can run in

View Source
const (
	XtBpfModePathPinned = XtBpfModeFdPinned

	XtBpfMaxNumInstr = 64

	// sizeof(struct sock_filter) == 8
	XtBpfPathMax = XtBpfMaxNumInstr * 8

	// XT_ALIGN(sizeof(struct xt_bpf_info)) == 528
	// the xt_bpf_info_v1 is expected to be aligned and padded to the max
	XtBpfInfoV1Size = 528
)

Constants for specifying bpf program lengths and attributes

Variables

This section is empty.

Functions

func CompileBpfForXtInfo

func CompileBpfForXtInfo(filter string) ([]bpf.RawInstruction, error)

Compile a tcpdump-style filter string to bpf compatible with xtables

func MarshalBpfBytecode

func MarshalBpfBytecode(filter string) ([]byte, error)

Marshal a tcpdump-style filter string into bytes compatible with xtables

func MarshalBpfFd

func MarshalBpfFd(fd int) ([]byte, error)

Marshal a socket file descriptor into bytes compatible with xtables

func MarshalBpfPinned

func MarshalBpfPinned(path string) ([]byte, error)

Marshal a pinned program path into bytes compatible with xtables

Types

This section is empty.

Jump to

Keyboard shortcuts

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