package sniffer

import "gvisor.dev/gvisor/tools/ioctl_sniffer/sniffer"

Package sniffer parses the output of the ioctl hook.

Index

Functions

func Init

func Init() error

Init reads from nvproxy and sets up the supported ioctl maps.

Types

type Connection

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

Connection is a connection to the sniffer hook.

func (Connection) ReadHookOutput

func (c Connection) ReadHookOutput(ctx context.Context) *Results

ReadHookOutput reads the output of the ioctl hook until an EOF is reached.

func (*Connection) ReadIoctlProto

func (c *Connection) ReadIoctlProto(ctx context.Context) (*pb.Ioctl, error)

ReadIoctlProto reads a single ioctl proto from this connection. Our format is:

This should match the format in sniffer_bridge.h.

type Ioctl

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

Ioctl contains the parsed ioctl protobuf information.

func ParseIoctlOutput

func ParseIoctlOutput(ioctl *pb.Ioctl) (Ioctl, error)

ParseIoctlOutput parses an ioctl protobuf from the ioctl hook.

func (Ioctl) IsSupported

func (i Ioctl) IsSupported() bool

IsSupported returns true if the ioctl is supported by nvproxy.

func (Ioctl) String

func (i Ioctl) String() string

type Results

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

Results contains the list of unsupported ioctls.

func NewResults

func NewResults() *Results

NewResults creates a new Results object.

func (*Results) AddUnsupportedIoctl

func (r *Results) AddUnsupportedIoctl(ioctl Ioctl)

AddUnsupportedIoctl adds an unsupported ioctl to the results.

func (*Results) HasUnsupportedIoctl

func (r *Results) HasUnsupportedIoctl() bool

HasUnsupportedIoctl returns true if there are any unsupported ioctls.

func (*Results) Merge

func (r *Results) Merge(other *Results)

Merge merges the results from another Results object into this one.

func (*Results) String

func (r *Results) String() string

type Server

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

Server is a server that accepts connections from the sniffer hook. It reads ioctl protos from each connection and sends them to the results channel.

func NewServer

func NewServer() *Server

NewServer creates a new Server.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the address of the socket.

func (*Server) AllResults

func (s *Server) AllResults() *Results

AllResults blocks until all connections have closed and returns an aggregate of all the results.

func (*Server) Listen

func (s *Server) Listen() error

Listen opens a new socket server.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve opens a new socket server, continually accepts connections from the socket and reads ioctl protos from each connection. It blocks until the context is cancelled.

Source Files

sniffer.go sniffer_bridge.go

Version
v0.0.0-20250618232322-85c27ad0efac (latest)
Published
Jun 18, 2025
Platform
linux/amd64
Imports
18 packages
Last checked
7 hours ago

Tools for package owners.