filters: Implement "ifname" and "ifindex" route attributes
Hello, BIRD developers! Currently there is no way in filter rules to match routes by interface name and interface index. However string comparison (=,!=,>,<,... operations), and pattern matching (using ~ operator) already implemented in filters, so expressions like: if "eth0" ~ "eth*" || "eth1" = "eth1" then print "This pattern matches!"; already works. Only one thing that is really needed is exposing attribute with name to filter which references route outgoing interface name and index. Of course all of these variables must be readonly. Interface indexes are taken from kernel (at least on Linux, and FreeBSD) and represents interface number in system. Matching to indexes is not such reliable as matching with interface names, as indexes might change on interface addition/removal. Currently only sink (blackhole, unreachable and prohibit) routes in BIRD have no interface associated. Return an empty string and index equal to zero (no real index in kernel) for such routes. -- SP5474-RIPE Sergey Popovich
On Thu, Sep 26, 2013 at 12:45:37PM +0300, Sergey Popovich wrote:
Hello, BIRD developers!
Currently there is no way in filter rules to match routes by interface name and interface index.
Only one thing that is really needed is exposing attribute with name to filter which references route outgoing interface name and index. Of course all of these variables must be readonly.
Thanks for this patch too, but the original static attribute handling code was rather messy and your patch would make it even more messier, so i finally rewrote that part: https://gitlab.labs.nic.cz/labs/bird/commit/a5fc59587fe864e4fcfb44eb3be57231...
Currently only sink (blackhole, unreachable and prohibit) routes in BIRD have no interface associated. Return an empty string and index equal to zero (no real index in kernel) for such routes.
BTW, multipath routes also do not have an associated interface in rta. -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
В письме от 27 сентября 2013 11:26:36 пользователь Ondrej Zajicek написал:
On Thu, Sep 26, 2013 at 12:45:37PM +0300, Sergey Popovich wrote:
Hello, BIRD developers!
Currently there is no way in filter rules to match routes by interface name and interface index.
Only one thing that is really needed is exposing attribute with name to filter which references route outgoing interface name and index. Of course all of these variables must be readonly.
Thanks for this patch too, but the original static attribute handling code was rather messy and your patch would make it even more messier, so i finally rewrote that part:
Agree with this, static attribute handing code after your rewrite looks much more cleaner.
https://gitlab.labs.nic.cz/labs/bird/commit/a5fc59587fe864e4fcfb44eb3be57231 b4ca339b
Currently only sink (blackhole, unreachable and prohibit) routes in BIRD have no interface associated. Return an empty string and index equal to zero (no real index in kernel) for such routes.
BTW, multipath routes also do not have an associated interface in rta.
Thanks, I will keep this in my mind. -- SP5474-RIPE Sergey Popovich
participants (2)
-
Ondrej Zajicek -
Sergey Popovich