A new "ListMatch" function has been added to the RouteService to allow
for kernel-based filtering of the routing tables. The netlink flags
required for getting a route for an IP (eg, rtnl.RouteGetAll) is
different than those required while filtering the table.
This changeset removes the superfluous "netlink.DumpFiltered" flag from
the Get function of RouteService, as this flag is for kernel responses.
Signed-off-by: Terin Stock <terinjokes@gmail.com>
* module: `go mod tidy`
Signed-off-by: Jeremiejig <me@jeremiejig.fr>
* route: Implement support for RTA_MARK
The RTA_MARK attribute allow to send get request with mark information;
it is useful when having multiple table selected by rule policy
matching on fwmark.
Signed-off-by: Jeremiejig <me@jeremiejig.fr>
Use netlink attribute en-/decoder infrastructure
This should pave the way for endian aware code.
Ref #56
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
The RTA_EXPIRES attribute allows creating self-deleting routes; it is
useful for example when installing routes obtained from a DHCP lease.
The natural zero-value of the attribute needs special care, since it
means the route will be immediately deleted, a very different behaviour
from when the attribute is omitted (where the rule does never expire).
This means we need to separate these cases, which we do by using a
*uint32, where the nil value means the attribute is omitted and any
other values are passed as-is
Signed-off-by: Anatole Denis <anatole@unverle.fr>
In #27 I erroneously computed SrcLen and DstLen believing that it was
the octet-length of the Src and Dst addresses in the attributes. This is
actually the prefix length of Src and Dst, which should be set
independently. Also updated comments to reflect this.
Signed-off-by: Andrea Barberio <insomniac@slackware.it>
* Basic RouteService
* Netlink header flag name changed in netlink lib
* Add fallthrough for RTM_GETROUTE and RTM_DELROUTE message parsing
* RouteService tests
* Update conn_test to use new netlink header flag names
* Fix off-by-one bug in AddressMessage.UnmarshalBinary()
* Update address test for off-by-one bug in AddressMessage.UnmarshalBinary()
* Fix case statement in messageUnmarshall