Redistributing kernel routes

Alex Bligh alex at alex.org.uk
Mon May 2 21:20:36 CEST 2011


I am having difficulty redistributing kernel routes into any other
protocol.

The question is similar to the one asked here:
 http://www.mail-archive.com/bird-users@atrey.karlin.mff.cuni.cz/msg01036.htm
l
(subject "Problem with redistribute static routes from venet
          (openvz pseudointerface)")
but
a) the solution proposed there does not work.
b) I cannot get normal static "via" routes to distribute.

What I am trying to do at the moment is to get device routes
(e.g. those created like
  ip route add 4.4.4.4/32 proto SOMEPROTO nexthop dev evrr-000001
to register in bird). Ultimately I'd like to redistribute them into
ospf or similar. Right now the problem is that they do not
show up at all.

For test purposes I added normal static routes too:
# ip route add 6.6.6.6/32 proto static nexthop via 172.16.1.22
# ip route add 7.7.7.7/32 proto boot nexthop via 172.16.1.22

These don't show up either.

The interface routes, however, do show up.

I am in control of the population of the routing table, so can
set the protocol as appropriate. I would have thought "static"
would be the most appropriate protocol.

I have tried with and without "device routes yes" set in the
kernel section.

I have tried with and without the patch to
  ./sysdep/linux/netlink/netlink.c.
As far as I can tell the patch special-cases routes with RTPROT_BOOT.
I have installed dummy /32 routes with the protocols BOOT (i.e. the
default), static, kernel, and 234. They all behave the same (i.e.
bird does not see them). It also doesn't seem to apply to non-device
routes.

I can't help but think I must be doing something really stupid here.

-- 
Alex Bligh


root at alex-test:/# uname -a
Linux alex-test 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 23:42:43 UTC 
2011 x86_64 GNU/Linux

root at alex-test:/# ip r s
7.7.7.7 via 172.16.1.22 dev evrr-000001
2.3.4.5 dev evrr-000001  proto 234
5.5.5.5 dev evrr-000001
6.6.6.6 via 172.16.1.22 dev evrr-000001  proto static
1.1.1.1 dev evrr-000001  proto static
4.4.4.4 dev evrr-000001  proto kernel
2.2.2.2/31 dev evrr-000001  proto static
10.99.99.0/24 dev dummy  proto kernel  scope link  src 10.99.99.1
172.16.1.0/24 dev evrr-000001  proto kernel  scope link  src 172.16.1.223

root at alex-test:/# ip a l
534: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
535: dummy2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
state UP qlen 1000
    link/ether 42:e8:af:c7:30:db brd ff:ff:ff:ff:ff:ff
    inet6 fe80::40e8:afff:fec7:30db/64 scope link
       valid_lft forever preferred_lft forever
536: dummy: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
state UP qlen 1000
    link/ether 1a:ca:93:5b:db:93 brd ff:ff:ff:ff:ff:ff
    inet 10.99.99.1/24 scope global dummy
    inet6 fe80::18ca:93ff:fe5b:db93/64 scope link
       valid_lft forever preferred_lft forever
537: evrr-000000: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc 
pfifo_fast state UP qlen 1000
    link/ether 46:b6:4d:d3:74:c7 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::44b6:4dff:fed3:74c7/64 scope link
       valid_lft forever preferred_lft forever
539: evrr-000001: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc 
pfifo_fast state UP qlen 1000
    link/ether 12:ed:07:23:66:68 brd ff:ff:ff:ff:ff:ff
    inet 172.16.1.223/24 scope global evrr-000001
    inet6 fe80::10ed:7ff:fe23:6668/64 scope link
       valid_lft forever preferred_lft forever

root at alex-test:/# ip link show
534: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
535: dummy2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
state UP qlen 1000
    link/ether 42:e8:af:c7:30:db brd ff:ff:ff:ff:ff:ff
536: dummy: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
state UP qlen 1000
    link/ether 1a:ca:93:5b:db:93 brd ff:ff:ff:ff:ff:ff
537: evrr-000000: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc 
pfifo_fast state UP qlen 1000
    link/ether 46:b6:4d:d3:74:c7 brd ff:ff:ff:ff:ff:ff
539: evrr-000001: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc 
pfifo_fast state UP qlen 1000
    link/ether 12:ed:07:23:66:68 brd ff:ff:ff:ff:ff:ff

root at alex-test:/# birdc
BIRD 1.2.5 ready.
bird> show route all
10.99.99.0/24      dev dummy [MyOSPF 19:46] * I (150/10) [10.99.99.1]
        Type: OSPF unicast univ
        OSPF.metric1: 10
        OSPF.metric2: 16777215
        OSPF.tag: 0x00000000
        OSPF.router_id: 10.99.99.1
172.16.1.0/24      dev evrr-000001 [MyOSPF 19:46] * I (150/10) [10.99.99.1]
        Type: OSPF unicast univ
        OSPF.metric1: 10
        OSPF.metric2: 16777215
        OSPF.tag: 0x00000000
        OSPF.router_id: 10.99.99.1
bird>

root at alex-test:/# cat /etc/bird.conf
protocol kernel {
        persist;                # Don't remove routes on BIRD shutdown
        scan time 5;           # Scan kernel routing table every 20 seconds
        export all;             # Default is export none
        import all;
        device routes yes;
}

protocol device {
        scan time 10;           # Scan interfaces every 10 seconds
}


protocol ospf MyOSPF {
        rfc1583compat yes;
        tick 2;
        export filter {
               accept;
        };
        import filter {
               accept;
        };
        area 0.0.0.0 {
                interface "dummy" {
                        cost 10;
                        stub yes;
                };
                interface "evrr*" {
                        cost 10;
                        stub yes;
                };
        };
}




diff -ur --exclude='*~' 
../bird-1.2.5.original-from-natty/sysdep/linux/netlink/netlink.c 
./sysdep/linux/netlink/netlink.c
--- ../bird-1.2.5.original-from-natty/sysdep/linux/netlink/netlink.c 
	2010-08-03 16:44:51.000000000 +0100
+++ ./sysdep/linux/netlink/netlink.c	2011-05-02 19:43:48.560597108 +0100
@@ -706,8 +706,10 @@
 	   * for their 'alien' routes.
 	   */

+#if 0
 	  if (i->rtm_protocol == RTPROT_BOOT)
 	    src = KRT_SRC_KERNEL;
+#endif
 	}

       break;





More information about the Bird-users mailing list