problem with bird and unnumbered routing

Sörös Jozsef soros at multip.hu
Sat Feb 28 20:02:18 CET 2004


Hi!
I have unnumbered config on a linux box. Something like below can be seen:

1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
   inet 127.0.0.1/8 scope host lo
   inet 194.246.102.1/32 scope global lo
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
   link/ether 00:04:76:f7:cc:65 brd ff:ff:ff:ff:ff:ff
   inet 10.255.2.1/24 brd 10.255.2.255 scope link eth0
   inet 194.246.102.1/32 scope global eth0
2: br1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
   link/ether 00:04:76:f7:cc:65 brd ff:ff:ff:ff:ff:ff
   inet 10.25.1.80/24 brd 10.25.1.255 scope link eth1
   inet 194.246.102.1/32 scope global eth1
3: br2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
   link/ether 00:04:76:f7:cc:65 brd ff:ff:ff:ff:ff:ff
   inet 10.255.1.1/24 brd 10.255.1.255 scope link eth2
   inet 194.246.102.1/32 scope global eth2

In this case if a packet is sent farer than the connected network, the 
source address is the global (194.246.102.1) address.
If packet is sent to the connected network, source address is link scope 
address.
With this config bird does not work correctly.
Bird selects the global scope (194.246.102.1/32) address as primary and 
sends OSPF hello with this source address to the connected net.
I think the algoritm of the primary address selection is not  correct, 
because if there is link scope address it must be selected.
A router interacts with other routers on its connected network (except BGP).
So I suggest a patch to correct this:

--- tmp/bird-1.0.7/nest/iface.c Thu Aug 14 10:13:13 2003
+++ bird-1.0.7/nest/iface.c     Tue Feb 24 18:51:37 2004
@@ -407,9 +407,10 @@
  WALK_LIST(a, i->addrs)
    {
-      if (!(a->flags & IA_SECONDARY) && (!b || a->scope > b->scope))
-       b = a;
-      a->flags &= ~IA_PRIMARY;
+      if (!(a->flags & IA_SECONDARY)
+       && (!b || ((a->scope < b->scope)&&(a->scope != SCOPE_HOST)) ))
+               b = a;
+       a->flags &= ~IA_PRIMARY;
    }
  res = (b != i->addr);
  i->addr = b;

Best regards: Joseph

-- 
Üdvözlettel:

Sörös József
Multip Kft.
JS84-RIPE



More information about the Bird-users mailing list