bird 2.0: show only IPv4 or IPv6 routes from birdc

Craig Leres leres at ee.lbl.gov
Mon Apr 6 22:39:45 CEST 2020


We've been using bird 1.6.8 to advertise nullzero routes from a FreeBSD 
box to our routers for awhile. (We use quagga to the same for IPv4.) 
We're in the process of upgrading to 2.0.7 and will use bird for IPv4 
and IPv6.

I'm so far unable to come up with good ways of dumping only IPv4 or IPv4 
routes. I can't even find concrete examples of what's possible.

A filter example I found is:

     https://bird.network.cz/?get_doc&v=20&f=bird-5.html#ss5.3
     show route filter { if 127.0.0.5 ~ net then accept; }

So I for IPv6 I tried:

     show route filter { if net.len = 128 then accept; }

which works but it logs error messages:

      Filter (unnamed) did not return accept nor reject. Make up your mind

This works without errors:

     show route filter { if net.len = 128 then accept; reject; }

As does:

     show route where net.len = 128

Both seem like hacks to me and do not allow unambiguous printing of IPv4 
routes:

     show route where net.len = 32

In my case I know I won't have any IPv6 routes that are 32 bits but 
there must be a better way.

I also found:

     show route table master4
     show route table master6

I'd rather not depend on the names of default routing tables. I suppose 
I could explicitly import the kernel routes into v4 and v6 tables but 
routing works without this extra complexity.

One experiment I tried was:

     show route filter { print  "net.type is ", net.type; }

which logs 1 or 2 for IPv4 or IPv6:

     bird: net.type is (enum 36)1
     bird: net.type is (enum 36)2

but the obvious commands do not print any routes:

     show route where net.type = 1
     show route where net.type = 2

And anyway I couldn't find any keywords for ipv4 and ipv6.

What's the magic I'm missing? How can I dump only IPv4 or dump only IPv6 
routes?

		Craig


More information about the Bird-users mailing list