]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Support loopback/dummy addresses.
authorOndrej Zajicek <santiago@crfreenet.org>
Wed, 26 May 2010 14:09:22 +0000 (16:09 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Wed, 26 May 2010 14:09:22 +0000 (16:09 +0200)
proto/ospf/iface.c
sysdep/linux/netlink/netlink.c

index ae7b80c9a39179a91c859b9ea49bbc0750ff1bb1..bef311251406e771e09d2739a821930ac141c36c 100644 (file)
@@ -453,6 +453,10 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ifa *addr,
   else
     ifa->type = ip->type;
 
+  /* a loopback/dummy address */
+  if ((addr->pxlen == MAX_PREFIX_LENGTH) && ipa_zero(addr->opposite))
+    ifa->stub = 1;
+
 #ifdef OSPFv2
   if ((ifa->type != OSPF_IT_PTP) && (ifa->type != OSPF_IT_VLINK) &&
       (addr->flags & IA_UNNUMBERED))
index 365d4a95897557e7429a0e0d766bdbb63dc696aa..a10a2e9f8056d356eb7b9bcadc4f92e30df72a36 100644 (file)
@@ -382,10 +382,17 @@ nl_parse_addr(struct nlmsghdr *h)
     }
   if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS)
     {
-      ifa.flags |= IA_UNNUMBERED;
-      memcpy(&ifa.opposite, RTA_DATA(a[IFA_ADDRESS]), sizeof(ifa.opposite));
-      ipa_ntoh(ifa.opposite);
-      ifa.prefix = ifa.brd = ifa.opposite;
+      ip_addr addr;
+      memcpy(&addr, RTA_DATA(a[IFA_ADDRESS]), sizeof(addr));
+      ipa_ntoh(addr);
+      ifa.prefix = ifa.brd = addr;
+
+      /* It is either a peer address, or loopback/dummy address */
+      if (!ipa_equal(ifa.ip, addr))
+       {
+         ifa.flags |= IA_UNNUMBERED;
+         ifa.opposite = addr;
+       }
     }
   else
     {