Linx.Netlink.Rtnl (Linx v0.1.0)

Copy Markdown View Source

rtnetlink (NETLINK_ROUTE) — the kernel's networking-stack interface: links, addresses, routes and neighbours.

This is the first Linx.Netlink protocol family. Each kind of object has its own module. Open a socket for the family with open/1 and pass it to those modules' functions.

Example

{:ok, sock} = Linx.Netlink.Rtnl.open()
{:ok, links} = Linx.Netlink.Rtnl.Link.list(sock)
{:ok, addrs} = Linx.Netlink.Rtnl.Address.list(sock)
:ok = Linx.Netlink.Socket.close(sock)

Summary

Functions

Opens an rtnetlink socket in network namespace netns.

Functions

open(netns \\ :host)

@spec open(Linx.Netlink.Socket.netns()) ::
  {:ok, Linx.Netlink.Socket.t()} | {:error, term()}

Opens an rtnetlink socket in network namespace netns.

See Linx.Netlink.Socket.open/2 for the netns forms. Close the socket with Linx.Netlink.Socket.close/1.