netlink.rt.linkModule
Network interface (link) management.
A netlink.session specialization over theNETLINK_ROUTE protocol: create an instance with netlink.rt.link()
to list the kernel’s interfaces and set their up state; the underlying
socket is closed by close() (or the to-be-closed __close). All methods
block and require a sleepable runtime.
See also
Class link
| link:__call ([pid]) | Opens a session, calling the class: netlink.rt.link([pid]). |
| link:list ([opts]) | Lists all network interfaces from the kernel. |
| link:new ([o]) | Wraps a table in the class, or derives a class from it. |
| link:set (opts) | Sets an interface’s administrative up state. |
Class link in detail
- link:__call ([pid])
-
Opens a session, calling the class:
netlink.rt.link([pid]).Parameters
- pid integer a task whose network namespace the session talks to, as socket.new takes it; the initial network namespace when absent. (optional)
Returns
-
link
a new link object;
niland"ESRCH"if no task has that pid, or the task has exited.Raises
EOPNOTSUPPon a kernel whose sockets cannot hold a namespace of their own.See also
- link:list ([opts])
-
Lists all network interfaces from the kernel.
Parameters
- opts table list options, of which a link takes none. (optional)
Returns
- link:new ([o])
-
Wraps a table in the class, or derives a class from it. It opens no socket: calling the class
does,
netlink.rt.link().Parameters
- o table an initial object table. (optional)
Returns
-
link
the wrapped table or the derived class.
See also
- link:set (opts)
-
Sets an interface’s administrative up state.
Parameters
- opts
table
link parameters:
ifindexandup(boolean).
Raises
on a netlink error. - opts
table
link parameters: