Documentation ¶
Overview ¶
Package hostinet implements AF_INET and AF_INET6 sockets using the host's network stack.
Index ¶
- func ExtractHostInterfaces(links []syscall.NetlinkMessage, addrs []syscall.NetlinkMessage, ...) error
- func ExtractHostRoutes(routeMsgs []syscall.NetlinkMessage) ([]inet.Route, error)
- type Socket
- func (s *Socket) Accept(t *kernel.Task, peerRequested bool, flags int, blocking bool) (int32, linux.SockAddr, uint32, *syserr.Error)
- func (s *Socket) Bind(_ *kernel.Task, sockaddr []byte) *syserr.Error
- func (s *Socket) Connect(t *kernel.Task, sockaddr []byte, blocking bool) *syserr.Error
- func (s *Socket) Epollable() bool
- func (s *Socket) EventRegister(e *waiter.Entry) error
- func (s *Socket) EventUnregister(e *waiter.Entry)
- func (s *Socket) GetPeerName(t *kernel.Task) (linux.SockAddr, uint32, *syserr.Error)
- func (s *Socket) GetSockName(t *kernel.Task) (linux.SockAddr, uint32, *syserr.Error)
- func (s *Socket) GetSockOpt(t *kernel.Task, level int, name int, optValAddr hostarch.Addr, outLen int) (marshal.Marshallable, *syserr.Error)
- func (s *Socket) Ioctl(ctx context.Context, uio usermem.IO, args arch.SyscallArguments) (uintptr, error)
- func (s *Socket) Listen(_ *kernel.Task, backlog int) *syserr.Error
- func (s *Socket) PRead(ctx context.Context, dst usermem.IOSequence, offset int64, ...) (int64, error)
- func (s *Socket) PWrite(ctx context.Context, dst usermem.IOSequence, offset int64, ...) (int64, error)
- func (s *Socket) Read(ctx context.Context, dst usermem.IOSequence, opts vfs.ReadOptions) (int64, error)
- func (s *Socket) Readiness(mask waiter.EventMask) waiter.EventMask
- func (s *Socket) RecvMsg(t *kernel.Task, dst usermem.IOSequence, flags int, haveDeadline bool, ...) (int, int, linux.SockAddr, uint32, socket.ControlMessages, *syserr.Error)
- func (s *Socket) Release(ctx context.Context)
- func (s *Socket) SendMsg(t *kernel.Task, src usermem.IOSequence, to []byte, flags int, ...) (int, *syserr.Error)
- func (s *Socket) SetSockOpt(t *kernel.Task, level int, name int, opt []byte) *syserr.Error
- func (s *Socket) Shutdown(_ *kernel.Task, how int) *syserr.Error
- func (s *Socket) State() uint32
- func (s *Socket) Type() (family int, skType linux.SockType, protocol int)
- func (s *Socket) Write(ctx context.Context, src usermem.IOSequence, opts vfs.WriteOptions) (int64, error)
- type Stack
- func (*Stack) AddInterfaceAddr(int32, inet.InterfaceAddr) error
- func (*Stack) CleanupEndpoints() []stack.TransportEndpoint
- func (s *Stack) Configure() error
- func (*Stack) Destroy()
- func (s *Stack) GROTimeout(NICID int32) (time.Duration, error)
- func (s *Stack) InterfaceAddrs() map[int32][]inet.InterfaceAddr
- func (s *Stack) Interfaces() map[int32]inet.Interface
- func (*Stack) Pause()
- func (*Stack) PortRange() (uint16, uint16)
- func (*Stack) RegisteredEndpoints() []stack.TransportEndpoint
- func (*Stack) RemoveInterface(int32) error
- func (*Stack) RemoveInterfaceAddr(int32, inet.InterfaceAddr) error
- func (*Stack) RestoreCleanupEndpoints([]stack.TransportEndpoint)
- func (*Stack) Resume()
- func (s *Stack) RouteTable() []inet.Route
- func (*Stack) SetForwarding(tcpip.NetworkProtocolNumber, bool) error
- func (s *Stack) SetGROTimeout(NICID int32, timeout time.Duration) error
- func (*Stack) SetPortRange(uint16, uint16) error
- func (*Stack) SetTCPReceiveBufferSize(inet.TCPBufferSize) error
- func (*Stack) SetTCPRecovery(inet.TCPLossRecovery) error
- func (*Stack) SetTCPSACKEnabled(bool) error
- func (*Stack) SetTCPSendBufferSize(inet.TCPBufferSize) error
- func (s *Stack) Statistics(stat any, arg string) error
- func (s *Stack) SupportsIPv6() bool
- func (s *Stack) TCPReceiveBufferSize() (inet.TCPBufferSize, error)
- func (s *Stack) TCPRecovery() (inet.TCPLossRecovery, error)
- func (s *Stack) TCPSACKEnabled() (bool, error)
- func (s *Stack) TCPSendBufferSize() (inet.TCPBufferSize, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractHostInterfaces ¶
func ExtractHostInterfaces(links []syscall.NetlinkMessage, addrs []syscall.NetlinkMessage, interfaces map[int32]*inet.Interface, interfaceAddrs map[int32][]inet.InterfaceAddr) error
ExtractHostInterfaces will populate an interface map and interfaceAddrs map with the results of the equivalent netlink messages.
func ExtractHostRoutes ¶
func ExtractHostRoutes(routeMsgs []syscall.NetlinkMessage) ([]inet.Route, error)
ExtractHostRoutes populates the given routes slice with the data from the host route table.
Types ¶
type Socket ¶
type Socket struct { vfs.FileDescriptionDefaultImpl vfs.LockFD // We store metadata for hostinet sockets internally. Technically, we should // access metadata (e.g. through stat, chmod) on the host for correctness, // but this is not very useful for inet socket fds, which do not belong to a // concrete file anyway. vfs.DentryMetadataFileDescriptionImpl socket.SendReceiveTimeout // contains filtered or unexported fields }
Socket implements socket.Socket (and by extension, vfs.FileDescriptionImpl) for host sockets.
+stateify savable
func (*Socket) Accept ¶
func (s *Socket) Accept(t *kernel.Task, peerRequested bool, flags int, blocking bool) (int32, linux.SockAddr, uint32, *syserr.Error)
Accept implements socket.Socket.Accept.
func (*Socket) EventRegister ¶
EventRegister implements waiter.Waitable.EventRegister.
func (*Socket) EventUnregister ¶
EventUnregister implements waiter.Waitable.EventUnregister.
func (*Socket) GetPeerName ¶
GetPeerName implements socket.Socket.GetPeerName.
func (*Socket) GetSockName ¶
GetSockName implements socket.Socket.GetSockName.
func (*Socket) GetSockOpt ¶
func (s *Socket) GetSockOpt(t *kernel.Task, level int, name int, optValAddr hostarch.Addr, outLen int) (marshal.Marshallable, *syserr.Error)
GetSockOpt implements socket.Socket.GetSockOpt.
func (*Socket) Ioctl ¶
func (s *Socket) Ioctl(ctx context.Context, uio usermem.IO, args arch.SyscallArguments) (uintptr, error)
Ioctl implements vfs.FileDescriptionImpl.
func (*Socket) PRead ¶
func (s *Socket) PRead(ctx context.Context, dst usermem.IOSequence, offset int64, opts vfs.ReadOptions) (int64, error)
PRead implements vfs.FileDescriptionImpl.PRead.
func (*Socket) PWrite ¶
func (s *Socket) PWrite(ctx context.Context, dst usermem.IOSequence, offset int64, opts vfs.WriteOptions) (int64, error)
PWrite implements vfs.FileDescriptionImpl.
func (*Socket) Read ¶
func (s *Socket) Read(ctx context.Context, dst usermem.IOSequence, opts vfs.ReadOptions) (int64, error)
Read implements vfs.FileDescriptionImpl.
func (*Socket) RecvMsg ¶
func (s *Socket) RecvMsg(t *kernel.Task, dst usermem.IOSequence, flags int, haveDeadline bool, deadline ktime.Time, senderRequested bool, controlLen uint64) (int, int, linux.SockAddr, uint32, socket.ControlMessages, *syserr.Error)
RecvMsg implements socket.Socket.RecvMsg.
func (*Socket) SendMsg ¶
func (s *Socket) SendMsg(t *kernel.Task, src usermem.IOSequence, to []byte, flags int, haveDeadline bool, deadline ktime.Time, controlMessages socket.ControlMessages) (int, *syserr.Error)
SendMsg implements socket.Socket.SendMsg.
func (*Socket) SetSockOpt ¶
SetSockOpt implements socket.Socket.SetSockOpt.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack implements inet.Stack for host sockets.
func (*Stack) AddInterfaceAddr ¶
func (*Stack) AddInterfaceAddr(int32, inet.InterfaceAddr) error
AddInterfaceAddr implements inet.Stack.AddInterfaceAddr.
func (*Stack) CleanupEndpoints ¶
func (*Stack) CleanupEndpoints() []stack.TransportEndpoint
CleanupEndpoints implements inet.Stack.CleanupEndpoints.
func (*Stack) GROTimeout ¶
GROTimeout implements inet.Stack.GROTimeout.
func (*Stack) InterfaceAddrs ¶
func (s *Stack) InterfaceAddrs() map[int32][]inet.InterfaceAddr
InterfaceAddrs implements inet.Stack.InterfaceAddrs.
func (*Stack) Interfaces ¶
Interfaces implements inet.Stack.Interfaces.
func (*Stack) RegisteredEndpoints ¶
func (*Stack) RegisteredEndpoints() []stack.TransportEndpoint
RegisteredEndpoints implements inet.Stack.RegisteredEndpoints.
func (*Stack) RemoveInterface ¶
RemoveInterface implements inet.Stack.RemoveInterface.
func (*Stack) RemoveInterfaceAddr ¶
func (*Stack) RemoveInterfaceAddr(int32, inet.InterfaceAddr) error
RemoveInterfaceAddr implements inet.Stack.RemoveInterfaceAddr.
func (*Stack) RestoreCleanupEndpoints ¶
func (*Stack) RestoreCleanupEndpoints([]stack.TransportEndpoint)
RestoreCleanupEndpoints implements inet.Stack.RestoreCleanupEndpoints.
func (*Stack) RouteTable ¶
RouteTable implements inet.Stack.RouteTable.
func (*Stack) SetForwarding ¶
func (*Stack) SetForwarding(tcpip.NetworkProtocolNumber, bool) error
SetForwarding implements inet.Stack.SetForwarding.
func (*Stack) SetGROTimeout ¶
SetGROTimeout implements inet.Stack.SetGROTimeout.
func (*Stack) SetPortRange ¶
SetPortRange implements inet.Stack.SetPortRange.
func (*Stack) SetTCPReceiveBufferSize ¶
func (*Stack) SetTCPReceiveBufferSize(inet.TCPBufferSize) error
SetTCPReceiveBufferSize implements inet.Stack.SetTCPReceiveBufferSize.
func (*Stack) SetTCPRecovery ¶
func (*Stack) SetTCPRecovery(inet.TCPLossRecovery) error
SetTCPRecovery implements inet.Stack.SetTCPRecovery.
func (*Stack) SetTCPSACKEnabled ¶
SetTCPSACKEnabled implements inet.Stack.SetTCPSACKEnabled.
func (*Stack) SetTCPSendBufferSize ¶
func (*Stack) SetTCPSendBufferSize(inet.TCPBufferSize) error
SetTCPSendBufferSize implements inet.Stack.SetTCPSendBufferSize.
func (*Stack) Statistics ¶
Statistics implements inet.Stack.Statistics.
func (*Stack) SupportsIPv6 ¶
SupportsIPv6 implements inet.Stack.SupportsIPv6.
func (*Stack) TCPReceiveBufferSize ¶
func (s *Stack) TCPReceiveBufferSize() (inet.TCPBufferSize, error)
TCPReceiveBufferSize implements inet.Stack.TCPReceiveBufferSize.
func (*Stack) TCPRecovery ¶
func (s *Stack) TCPRecovery() (inet.TCPLossRecovery, error)
TCPRecovery implements inet.Stack.TCPRecovery.
func (*Stack) TCPSACKEnabled ¶
TCPSACKEnabled implements inet.Stack.TCPSACKEnabled.
func (*Stack) TCPSendBufferSize ¶
func (s *Stack) TCPSendBufferSize() (inet.TCPBufferSize, error)
TCPSendBufferSize implements inet.Stack.TCPSendBufferSize.