Documentation ¶
Overview ¶
Package kernel contains funcs that interact with the kernel (sycalls, netlink).
Index ¶
- Constants
- type GenetlinkPort
- type Interfaces
- func (k *Interfaces) AddrSubscribe(ch chan<- netlink.AddrUpdate, done <-chan struct{}) error
- func (k *Interfaces) CreateTAP(name string) (int, error)
- func (k *Interfaces) DeleteIP(name string, ip string, prefixLen int) error
- func (k *Interfaces) LinkAdd(link netlink.Link) error
- func (k *Interfaces) LinkByIndex(idx int) (netlink.Link, error)
- func (k *Interfaces) LinkByName(name string) (netlink.Link, error)
- func (k *Interfaces) LinkList() ([]netlink.Link, error)
- func (k *Interfaces) LinkModify(link netlink.Link) error
- func (k *Interfaces) LinkSetDown(link netlink.Link) error
- func (k *Interfaces) LinkSetMaster(member netlink.Link, link netlink.Link) error
- func (k *Interfaces) LinkSetNoMaster(link netlink.Link) error
- func (k *Interfaces) LinkSetUp(link netlink.Link) error
- func (k *Interfaces) LinkSubscribe(ch chan<- netlink.LinkUpdate, done <-chan struct{}) error
- func (k *Interfaces) NeighSubscribe(ch chan<- netlink.NeighUpdate, done <-chan struct{}) error
- func (k *Interfaces) ReplaceIP(name string, ip string, prefixLen int) error
- func (k *Interfaces) SetHWAddr(name string, addr string) error
- func (k *Interfaces) SetState(name string, up bool) error
- type NLPacket
- type PacketMetadata
- type TapInterface
Constants ¶
const ( AttrDstIfIndex uint16 = iota AttrSrcIfIndex AttrContextValue AttrPayload )
Constants sourced from https://github.com/sonic-net/sonic-pins/blob/main/p4rt_app/sonic/receive_genetlink.cc#L32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenetlinkPort ¶
type GenetlinkPort struct {
// contains filtered or unexported fields
}
GenetlinkPort is connect to a netlink socket that be written to.
func NewGenetlinkPort ¶
func NewGenetlinkPort(family, group string) (*GenetlinkPort, error)
NewGenetlinkPort creates netlink socket for the given family and multicast group.
func (GenetlinkPort) Delete ¶
func (p GenetlinkPort) Delete() error
Delete closes the netlink connection.
func (GenetlinkPort) Read ¶
func (p GenetlinkPort) Read([]byte) (int, error)
Read is not implemented.
func (GenetlinkPort) Write ¶
func (p GenetlinkPort) Write(frame []byte, md *PacketMetadata) (int, error)
Writes writes a layer2 frame to the port.
type Interfaces ¶
type Interfaces struct{}
Interfaces contains methods for modifying networking interfaces.
func (*Interfaces) AddrSubscribe ¶
func (k *Interfaces) AddrSubscribe(ch chan<- netlink.AddrUpdate, done <-chan struct{}) error
AddrSubscribe subscribes to address changes for all interfaces.
func (*Interfaces) CreateTAP ¶
func (k *Interfaces) CreateTAP(name string) (int, error)
CreateTAP creates kernel TAP interface.
func (*Interfaces) DeleteIP ¶
func (k *Interfaces) DeleteIP(name string, ip string, prefixLen int) error
DeleteIP delete an IP addresses from a network interface.
func (*Interfaces) LinkAdd ¶
func (k *Interfaces) LinkAdd(link netlink.Link) error
LinkAdd adds a new network interface.
func (*Interfaces) LinkByIndex ¶
func (k *Interfaces) LinkByIndex(idx int) (netlink.Link, error)
LinkByIndex finds a link by its index.
func (*Interfaces) LinkByName ¶
func (k *Interfaces) LinkByName(name string) (netlink.Link, error)
LinkByName returns a network interface by name.
func (*Interfaces) LinkList ¶
func (k *Interfaces) LinkList() ([]netlink.Link, error)
LinkList lists all Linux network interfaces.
func (*Interfaces) LinkModify ¶
func (k *Interfaces) LinkModify(link netlink.Link) error
LinkModify modifies the link.
func (*Interfaces) LinkSetDown ¶
func (k *Interfaces) LinkSetDown(link netlink.Link) error
LinkSetDown sets the admin state to down.
func (*Interfaces) LinkSetMaster ¶
LinkSetMaster sets the member link's master to the other link.
func (*Interfaces) LinkSetNoMaster ¶
func (k *Interfaces) LinkSetNoMaster(link netlink.Link) error
LinkSetNoMaster removes the master from the link.
func (*Interfaces) LinkSetUp ¶
func (k *Interfaces) LinkSetUp(link netlink.Link) error
LinkSetDown sets the admin state to up.
func (*Interfaces) LinkSubscribe ¶
func (k *Interfaces) LinkSubscribe(ch chan<- netlink.LinkUpdate, done <-chan struct{}) error
LinkSubscribe subscribes to link status for all interfaces.
func (*Interfaces) NeighSubscribe ¶
func (k *Interfaces) NeighSubscribe(ch chan<- netlink.NeighUpdate, done <-chan struct{}) error
NeighSubscribe subscribes to neighbor table updates.
func (*Interfaces) ReplaceIP ¶
func (k *Interfaces) ReplaceIP(name string, ip string, prefixLen int) error
ReplaceIP sets the IP addresses of a network interface.
type NLPacket ¶
type NLPacket struct {
// contains filtered or unexported fields
}
NLPacket contains a packet data.
type PacketMetadata ¶
type TapInterface ¶
TapInterface is Linux tap interface.
func (*TapInterface) Delete ¶
func (t *TapInterface) Delete() error
Delete deletes the tap interface.
func (*TapInterface) IfIndex ¶
func (t *TapInterface) IfIndex() int
func (*TapInterface) Write ¶
func (t *TapInterface) Write(frame []byte, _ *PacketMetadata) (int, error)
Directories ¶
Path | Synopsis |
---|---|
package kerneltest contains fake implemetation of structs in kernel package
|
package kerneltest contains fake implemetation of structs in kernel package |