]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Neighbors on OSPF broadcast networks should be identified by IP address, not RID.
authorOndrej Zajicek <santiago@crfreenet.org>
Mon, 26 Apr 2010 17:08:57 +0000 (19:08 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Mon, 26 Apr 2010 17:08:57 +0000 (19:08 +0200)
Allows simple support for multiple interfaces to the same network.

proto/ospf/packet.c

index e78eeea52027c1a4dcc69780816e0b8ee4c354f0..74ce5507f73bc041e07e69255c77f42546f0afcb 100644 (file)
@@ -242,6 +242,19 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_
  
 #endif
 
+#ifdef OSPFv2
+static inline struct ospf_neighbor *
+find_neigh_by_ip(struct ospf_iface *ifa, ip_addr ip)
+{
+  struct ospf_neighbor *n;
+  WALK_LIST(n, ifa->neigh_list)
+    if (ipa_equal(n->ip, ip))
+      return n;
+  return NULL;
+}
+#endif
+
+
 
 /**
  * ospf_rx_hook
@@ -419,10 +432,16 @@ ospf_rx_hook(sock *sk, int size)
     return 1;
   }
 
-  /* This is deviation from RFC 2328 - neighbours should be identified by
-   * IP address on broadcast and NBMA networks.
-   */
+#ifdef OSPFv2
+  /* In OSPFv2, neighbors are identified by either IP or Router ID, base on network type */
+  struct ospf_neighbor *n;
+  if ((ifa->type == OSPF_IT_BCAST) || (ifa->type == OSPF_IT_NBMA))
+    n = find_neigh_by_ip(ifa, sk->faddr);
+  else
+    n = find_neigh(ifa, rid);
+#else
   struct ospf_neighbor *n = find_neigh(ifa, rid);
+#endif
 
   if(!n && (ps->type != HELLO_P))
   {