Addresses in the lo interface not being announced in OSPFv3

Bernardo Figueiredo bernardopascoalfigueiredo at tecnico.ulisboa.pt
Tue Jul 26 15:45:51 CEST 2016


I'm having a problem with bird 1.5.0 running OSPFv3.
When I add a host route(/128) to "lo" interface, and add the "lo"
interface to an OSPF area, the interface doesn't get picked up, and
consequently the route isn't announced.

This problem doesn't happen using bird when running in IPv4 using
OSPFv2.

I digged through the code and think found the cause of difference in behaviour. When being notified of interface changes, the protocols use different functions:
OSPFv2 uses proto/ospf/iface.c:ospf_ifa_notify2
OSPFv3 uses proto/ospf/iface.c:ospf_ifa_notify3

In OSPFv2 the interface is added to the ospf protocol(ospf_iface_new) if it has a address that is not secondary, with scope greater than link and the interface is changed to up.
This works, because the IPv4 we add to the lo interface is primary and global.

In OSPFv3 the interface is added to the ospf protocol if it has an address that is not secondary and has scope link.
The lo interface only has 2 addresses:
::1 which is host scope
the /128 address that we add, which is scope global
Neither of those make the function add the interface, thus causing the problem which I'm describing.

The workaround I found to this problem is to add a link local address to the lo interface, but I don't think it's a good one, because it makes no sense for the lo to have a link local address.

I think a better fix, could be something like this:
--- proto/ospf/iface.c	2016-04-29 10:13:23.000000000 +0100
+++ proto/ospf/iface.c.fixed	2016-07-26 14:37:12.528817401 +0100
@@ -1108,7 +1108,7 @@
 
   /* In OSPFv3, we create OSPF iface for link-local address,
      other addresses are used for link-LSA. */
-  if (a->scope == SCOPE_LINK)
+  if (a->scope == SCOPE_LINK || (a->iface->flags & IF_LOOPBACK))
   {
     if (flags & IF_CHANGE_UP)
     {

I don't know if it compiles.
>From what I saw in the structs, I think it does what I want.
I just don't know if you think this is a good way to do it.

I'll include the information that I think is relevant:

# ip a l dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet x.x.x.x/32 scope global lo
       valid_lft forever preferred_lft forever
    inet6 x:x:x:x::x/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever


*** bird configuration

Relevant bird configuration
# cat /etc/bird/bird.conf
(....)
protocol ospf backbone {
  area x.x.x.x {
 
  stub no;
    (...)
    interface "lo" { stub; };
  }
}

Information in birdc
bird> show interfaces 
lo up (index=1)
        MultiAccess AdminUp LinkUp Loopback Ignored MTU=65536
        x.x.x.x/32 (Primary, scope univ)
        127.0.0.1/8 (Unselected, scope host)
(...other interfaces...)

bird> show ospf interface 
backbone:
Interface lo (x.x.x.x/32)
	(...lo info)
(...other interfaces...)

*** bird6 information

# cat /etc/bird/bird6.conf
(....)
protocol ospf backbone {
  area x.x.x.x {
    stub no;
    (...)
    interface "lo" { stub; };
  }
}

Information in birdc6
bird> show interfaces 
lo up (index=1)
        MultiAccess AdminUp LinkUp Loopback Ignored MTU=65536
        x:x:x:x::x/128 (Primary, scope univ)
        ::1/128 (Unselected, scope host)
(...other interfaces...)

bird> show ospf interface
(...other interfaces...)
(no lo interface)

Thanks,
Bernardo Figueiredo


More information about the Bird-users mailing list