filters: Implement "ifname" and "ifindex" route attributes

Sergey Popovich popovich_sergei at
Thu Sep 26 11:45:37 CEST 2013

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.

Sergey Popovich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bird-1.3.11-introduce-ifname-and-ifindex-attrs.patch
Type: text/x-patch
Size: 3446 bytes
Desc: not available
URL: <>

More information about the Bird-users mailing list