ospfd: Make sure all external routes are updated.
Roman Hoog Antink <rha@open.ch> reports:
When adding a connected route (using vtysh, without restart) to the
redistribution access list of ospfd, while static routes already exist,
the update timer ospf_distribute_list_update_timer() is being run for
static routes only. That way, the connected route never appears in the
OSPF database, until quagga is completely restarted.
The update timer for connected routes is cancelled in
ospfd/ospfd_zebra.c:ospf_distribute_list_update():976, were a new timer
is scheduled for static routes, caused by the loop in ospf_filter_update().
* ospf_zebra.c: (ospf_distribute_list_update_timer) make it
refresh all external routes. This fixes the problem
reported by Roman.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 6f0a71f..90bee21 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -929,14 +929,9 @@
struct external_info *ei;
struct route_table *rt;
struct ospf_lsa *lsa;
- intptr_t type;
+ int type;
struct ospf *ospf;
- type = (intptr_t)THREAD_ARG (thread);
- assert (type <= ZEBRA_ROUTE_MAX);
-
- rt = EXTERNAL_INFO (type);
-
ospf = ospf_lookup ();
if (ospf == NULL)
return 0;
@@ -946,17 +941,22 @@
zlog_info ("Zebra[Redistribute]: distribute-list update timer fired!");
/* foreach all external info. */
- if (rt)
- for (rn = route_top (rt); rn; rn = route_next (rn))
- if ((ei = rn->info) != NULL)
- {
- if (is_prefix_default (&ei->p))
- ospf_external_lsa_refresh_default (ospf);
- else if ((lsa = ospf_external_info_find_lsa (ospf, &ei->p)))
- ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_IF_CHANGED);
- else
- ospf_external_lsa_originate (ospf, ei);
- }
+ for (type = 0; type <= ZEBRA_ROUTE_MAX; type++)
+ {
+ rt = EXTERNAL_INFO (type);
+ if (!rt)
+ continue;
+ for (rn = route_top (rt); rn; rn = route_next (rn))
+ if ((ei = rn->info) != NULL)
+ {
+ if (is_prefix_default (&ei->p))
+ ospf_external_lsa_refresh_default (ospf);
+ else if ((lsa = ospf_external_info_find_lsa (ospf, &ei->p)))
+ ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_IF_CHANGED);
+ else
+ ospf_external_lsa_originate (ospf, ei);
+ }
+ }
return 0;
}