Commit b5e76398 authored by Ondřej Zajíček's avatar Ondřej Zajíček
Browse files

OSPF: Fixes some issues with link detection

Thanks to Bernardo Figueiredo and Israel G. Lugo for the bugreport.
parent c7b99a93
...@@ -493,8 +493,11 @@ ospf_iface_add(struct object_lock *lock) ...@@ -493,8 +493,11 @@ ospf_iface_add(struct object_lock *lock)
ifa->flood_queue = mb_allocz(ifa->pool, ifa->flood_queue_size * sizeof(void *)); 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 */ /* Do iface UP, unless there is no link (then wait in LOOP state) */
ospf_iface_sm(ifa, (ifa->check_link && !(ifa->iface->flags & IF_LINK_UP)) ? ISM_LOOP : ISM_UP); 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 static inline void
......
...@@ -231,6 +231,10 @@ ospf_rx_hook(sock *sk, int len) ...@@ -231,6 +231,10 @@ ospf_rx_hook(sock *sk, int len)
const char *err_dsc = NULL; const char *err_dsc = NULL;
uint err_val = 0; uint err_val = 0;
/* Should not happen */
if (ifa->state <= OSPF_IS_LOOP)
return 1;
int src_local, dst_local, dst_mcast; int src_local, dst_local, dst_mcast;
src_local = ipa_in_net(sk->faddr, ifa->addr->prefix, ifa->addr->pxlen); src_local = ipa_in_net(sk->faddr, ifa->addr->prefix, ifa->addr->pxlen);
dst_local = ipa_equal(sk->laddr, ifa->addr->ip); dst_local = ipa_equal(sk->laddr, ifa->addr->ip);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment