]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
OSPF: Fixes some issues with link detection
authorOndrej Zajicek <santiago@crfreenet.org>
Wed, 19 Aug 2015 09:16:23 +0000 (11:16 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Wed, 19 Aug 2015 09:16:23 +0000 (11:16 +0200)
Thanks to Bernardo Figueiredo and Israel G. Lugo for the bugreport.

proto/ospf/iface.c
proto/ospf/packet.c

index 9b0f7797643dc89f42192bd715d036fa1bbbecdb..77ce839a4fb166f602be3b8da38e92e1eaa14442 100644 (file)
@@ -493,8 +493,11 @@ ospf_iface_add(struct object_lock *lock)
     ifa->flood_queue = mb_allocz(ifa->pool, ifa->flood_queue_size * sizeof(void *));
   }
 
-  /* Do iface UP, unless there is no link and we use link detection */
-  ospf_iface_sm(ifa, (ifa->check_link && !(ifa->iface->flags & IF_LINK_UP)) ? ISM_LOOP : ISM_UP);
+  /* Do iface UP, unless there is no link (then wait in LOOP state) */
+  if (!ifa->check_link || (ifa->iface->flags & IF_LINK_UP))
+    ospf_iface_sm(ifa, ISM_UP);
+  else
+    ospf_iface_chstate(ifa, OSPF_IS_LOOP);
 }
 
 static inline void
index fb63e61c497733270c52ff6c3fea59c62e0fd76f..6b8fd7b5ce8030e72a39e466b442cd82e58c9fde 100644 (file)
@@ -231,6 +231,10 @@ ospf_rx_hook(sock *sk, int len)
   const char *err_dsc = NULL;
   uint err_val = 0;
 
+  /* Should not happen */
+  if (ifa->state <= OSPF_IS_LOOP)
+    return 1;
+
   int src_local, dst_local, dst_mcast;
   src_local = ipa_in_net(sk->faddr, ifa->addr->prefix, ifa->addr->pxlen);
   dst_local = ipa_equal(sk->laddr, ifa->addr->ip);