netlink

package module
v0.0.0-...-580d228 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 4 Imported by: 0

README

This project provides the building blocks for linux netlink. Please see RFC359 and netlink(7)-manpage.

My motivation for creating this library was that I could not find one that had the following properties:

  • Does not directly depend on the unsafe package and the deprecated syscall package.
  • Allows users to explicitly set the endian order.

Features

  • The netlink package provides some serializers, constructors and other parsers for handling netlink messages.

  • The sock_diag package has serializers and request constructors for the netlink family, NETLINK_SOCK_DIAG. Please see sock_diag.

Example

In the playground directory, you can find different examples on how these packages are used.

TODO

  • support IPv4 and IPv6 sockets
  • support Unix domain sockets

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NlMsgDoesNotFit  = errors.New("nlmsg does not fit into buffer")
	NlMsgHeaderError = errors.New("nlmsghdr error")
)
View Source
var ByteOrder = binary.LittleEndian
View Source
var NlmsgAlignTo uint32 = 4

Functions

func IsOkToParse

func IsOkToParse(data []byte, nlmsglen uint32) bool

func NewSerializedNetlinkMessage

func NewSerializedNetlinkMessage(h unix.NlMsghdr) []byte

Types

type NetlinkMessage

type NetlinkMessage struct {
	Header  unix.NlMsghdr
	Payload []byte
}

func DeserializeNetlinkMsg

func DeserializeNetlinkMsg(data []byte) (*NetlinkMessage, error)

func ParseNetlinkMessage

func ParseNetlinkMessage(data []byte) ([]NetlinkMessage, error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL