Module netlink.rt

rtnetlink interface for routes, links and addresses.

A netlink.session specialization over the NETLINK_ROUTE protocol: create an instance with rt() and call its methods; the underlying socket is closed by close() (or the to-be-closed __close). All methods block and require a sleepable runtime.

See also:

Class rt

rt:addr_list ([family=AF_UNSPEC]) Lists all interface addresses from the kernel.
rt:link_list () Lists all network interfaces from the kernel.
rt:new ([o]) Creates a new rt object.
rt:route_add (opts) Adds a route to the kernel routing table.
rt:route_del (opts) Deletes a route from the kernel routing table.
rt:route_list ([family=AF_UNSPEC]) Lists all routes from the kernel routing tables.


Class rt

rt:addr_list ([family=AF_UNSPEC])
Lists all interface addresses from the kernel.

Parameters:

  • family integer address family. (default AF_UNSPEC)

Returns:

    table list of address tables.
rt:link_list ()
Lists all network interfaces from the kernel.

Returns:

    table list of link tables.
rt:new ([o])
Creates a new rt object.

Parameters:

  • o table an initial object table. (optional)

Returns:

    rt the new rt object.

See also:

rt:route_add (opts)
Adds a route to the kernel routing table.

Parameters:

  • opts table route parameters: optional family (default AF_INET), dst_len, dst, gateway, oif, table, protocol, scope, rtype.
rt:route_del (opts)
Deletes a route from the kernel routing table.

Parameters:

  • opts table route parameters: optional family (default AF_INET), dst_len, dst, oif, table.
rt:route_list ([family=AF_UNSPEC])
Lists all routes from the kernel routing tables.

Parameters:

  • family integer address family. (default AF_UNSPEC)

Returns:

    table list of route tables.
generated by LDoc 1.5.0 Last updated 2026-07-04 13:06:33