Documentation ¶
Overview ¶
Package Sockmap represents the map from 5-tuple to the socket. It is primarily managed from the datapath using a sockops program. Cilium side is primarily for pretty printing.
Index ¶
Constants ¶
View Source
const (
// MaxEntries represents the maximum number of endpoints in the map
MaxEntries = 65535
)
Variables ¶
View Source
var ( // SockMap represents the BPF map for sockets SockMap = bpf.NewMap(mapName, bpf.MapTypeSockHash, int(unsafe.Sizeof(SockmapKey{})), 4, MaxEntries, 0, 0, func(key []byte, value []byte) (bpf.MapKey, bpf.MapValue, error) { k, v := &SockmapKey{}, &SockmapValue{} if err := bpf.ConvertKeyValue(key, value, k, v); err != nil { return nil, nil, err } return k, v, nil }, ) )
Functions ¶
Types ¶
type SockmapKey ¶
type SockmapKey struct { DIP types.IPv6 `align:"$union0"` SIP types.IPv6 `align:"$union1"` Family uint8 `align:"family"` Pad7 uint8 `align:"pad7"` Pad8 uint16 `align:"pad8"` SPort uint32 `align:"sport"` DPort uint32 `align:"dport"` }
SockmapKey is the 5-tuple used to lookup a socket
func NewSockmapKey ¶
func NewSockmapKey(dip, sip net.IP, sport, dport uint32) SockmapKey
NewSockmapKey returns a new key using 5-tuple input.
func (*SockmapKey) GetKeyPtr ¶
func (k *SockmapKey) GetKeyPtr() unsafe.Pointer
GetKeyPtr returns the unsafe pointer to the BPF key
func (SockmapKey) NewValue ¶
func (k SockmapKey) NewValue() bpf.MapValue
NewValue returns a new empty instance of the structure representing the BPF map value
func (SockmapKey) String ¶
func (v SockmapKey) String() string
String pretty print the 5-tuple as sip:sport->dip:dport
type SockmapValue ¶
type SockmapValue struct {
// contains filtered or unexported fields
}
SockmapValue is the fd of a socket
func (*SockmapValue) GetValuePtr ¶
func (v *SockmapValue) GetValuePtr() unsafe.Pointer
GetValuePtr returns the unsafe pointer to the BPF value.
func (SockmapValue) String ¶
func (v SockmapValue) String() string
String pretty print the file descriptor value, note this is local to agent.
Click to show internal directories.
Click to hide internal directories.