netlink.rt.ruleModule
FIB rule (policy routing) interface.
A netlink.session specialization over theNETLINK_ROUTE protocol: create an instance with netlink.rt.rule(),
then add, delete and list FIB rules; the underlying socket is closed by
close() (or the to-be-closed __close). All methods block and require a
sleepable runtime.
See also
Class rule
| rule:__call ([pid]) | Opens a session, calling the class: netlink.rt.rule([pid]). |
| rule:add (opts) | Adds a FIB rule directing matching lookups to a routing table. |
| rule:del (opts) | Deletes a FIB rule matching the given parameters. |
| rule:list ([opts]) | Lists all FIB rules from the kernel. |
| rule:new ([o]) | Wraps a table in the class, or derives a class from it. |
Class rule in detail
- rule:__call ([pid])
-
Opens a session, calling the class:
netlink.rt.rule([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
-
rule
a new rule 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
- rule:add (opts)
-
Adds a FIB rule directing matching lookups to a routing table.
Parameters
- opts
table
rule parameters: optional
family(defaultAF_INET), table,priority,fwmark,protocol,action(defaultFR_ACT_TO_TBL).
Raises
the name of the errno a netlink error reply carries,EEXISTwhen the rule exists. - opts
table
rule parameters: optional
- rule:del (opts)
-
Deletes a FIB rule matching the given parameters.
Parameters
Raises
the name of the errno a netlink error reply carries,ENOENTwhen no rule matches. - rule:list ([opts])
-
Lists all FIB rules from the kernel.
Parameters
- opts
table
list options:
family, the address family of the records listed (defaultAF_UNSPEC, every family). (optional)
Returns
- opts
table
list options:
- rule:new ([o])
-
Wraps a table in the class, or derives a class from it. It opens no socket: calling the class
does,
netlink.rt.rule().Parameters
- o table an initial object table. (optional)
Returns
-
rule
the wrapped table or the derived class.
See also