package stack

import "gvisor.dev/gvisor/pkg/sentry/socket/plugin/stack"

Package stack provides an implementation of plugin.PluginStack interface and an implementation of socket.Socket interface.

It glues sentry interfaces with plugin netstack interfaces defined in cgo.

Index

Constants

const (
	MaxEpollEvents = 128
	SleepInMsecond = 100
)

Types

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier holds all the state necessary to issue notifications when IO events occur on the observed FDs in plugin stack.

func NewNotifier

func NewNotifier() *Notifier

NewNotifier initialize the event notifier for plugin stack. It will allocate a eventMap with fd as key and corresponding eventInfo as value and start a goroutine waiting the arrival of events.

func (*Notifier) AddFD

func (n *Notifier) AddFD(fd uint32, eventInfo *plugin.EventInfo)

AddFD implements plugin.PluginNotifier.AddFD.

func (*Notifier) RemoveFD

func (n *Notifier) RemoveFD(fd uint32)

RemoveFD implements plugin.PluginNotifier.RemoveFD.

func (*Notifier) UpdateFD

func (n *Notifier) UpdateFD(fd uint32)

UpdateFD implements plugin.PluginNotifier.UpdateFD.

type Stack

type Stack struct {
	inet.Stack
	// contains filtered or unexported fields
}

Stack is a struct that interacts with third-party network stack. It implements inet.Stack and plugin.PluginStack.

func (*Stack) AddInterfaceAddr

func (s *Stack) AddInterfaceAddr(idx int32, addr inet.InterfaceAddr) error

AddInterfaceAddr implements inet.Stack.AddInterfaceAddr.

func (*Stack) Destroy

func (*Stack) Destroy()

Destroy implements inet.Stack.Destroy.

func (*Stack) EnableSaveRestore

func (*Stack) EnableSaveRestore() error

EnableSaveRestore implements inet.Stack.EnableSaveRestore.

func (*Stack) Init

func (s *Stack) Init(args *plugin.InitStackArgs) error

Init implements plugin.PluginStack.Init.

func (*Stack) InterfaceAddrs

func (s *Stack) InterfaceAddrs() map[int32][]inet.InterfaceAddr

InterfaceAddrs implements inet.Stack.InterfaceAddrs.

func (*Stack) Interfaces

func (s *Stack) Interfaces() map[int32]inet.Interface

Interfaces implements inet.Stack.Interfaces.

func (*Stack) PreInit

func (s *Stack) PreInit(args *plugin.PreInitStackArgs) (string, []int, error)

PreInit implements plugin.PluginStack.PreInit.

func (*Stack) RemoveInterfaceAddr

func (s *Stack) RemoveInterfaceAddr(int32, inet.InterfaceAddr) error

RemoveInterfaceAddr implements inet.Stack.RemoveInterfaceAddr.

func (*Stack) SupportsIPv6

func (s *Stack) SupportsIPv6() bool

SupportsIPv6 implements Stack.SupportsIPv6.

Source Files

notifier.go provider.go readwriter.go socket.go stack.go util.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
32 packages
Last checked
4 hours ago

Tools for package owners.