/* Flush (inline) all external LSAs which now match the new
router-id,
- need to adjust the OSPF_LSA_SELF flag, so the flush doesnt
+ need to adjust the OSPF_LSA_SELF flag, so the flush doesn't
hit
asserts in ospf_refresher_unregister_lsa(). This step is
needed
new->instance = instance;
new->router_id.s_addr = htonl(0);
new->router_id_static.s_addr = htonl(0);
- if (name && !strmatch(name, VRF_DEFAULT_NAME)) {
- new->vrf_id = VRF_UNKNOWN;
+ if (name) {
+ vrf = vrf_lookup_by_name(name);
+ if (vrf)
+ new->vrf_id = vrf->vrf_id;
+ else
+ new->vrf_id = VRF_UNKNOWN;
/* Freed in ospf_finish_final */
new->name = XSTRDUP(MTYPE_OSPF_TOP, name);
if (IS_DEBUG_OSPF_EVENT)
vrf = vrf_lookup_by_id(vrf_id);
if (!vrf)
return NULL;
+ return ospf_lookup_by_vrf(vrf);
+}
+
+struct ospf *ospf_lookup_by_vrf(struct vrf *vrf)
+{
return (vrf->info) ? (struct ospf *)vrf->info : NULL;
}
area = ospf_area_lookup_by_area_id(ospf, area_id);
if (area && listcount(area->oiflist) == 0 && area->ranges->top == NULL
+ && !ospf_vl_count(ospf, area)
&& area->shortcut_configured == OSPF_SHORTCUT_DEFAULT
&& area->external_routing == OSPF_AREA_DEFAULT
&& area->no_summary == 0 && area->default_cost == 1
update_redistributed(ospf, 0); /* interfaces possibly removed */
}
+bool ospf_interface_area_is_already_set(struct ospf *ospf,
+ struct interface *ifp)
+{
+ struct route_node *rn_oi;
+
+ if (!ospf)
+ return false; /* Ospf not ready yet */
+
+ /* Find interfaces that may need to be removed. */
+ for (rn_oi = route_top(IF_OIFS(ifp)); rn_oi;
+ rn_oi = route_next(rn_oi)) {
+ struct ospf_interface *oi = rn_oi->info;
+
+ if (oi == NULL)
+ continue;
+
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ continue;
+ /* at least one route covered by interface
+ * that implies already done
+ */
+ return true;
+ }
+ return false;
+}
+
/* Check whether interface matches given network
* returns: 1, true. 0, false
*/
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "%s: interface %s ifp->vrf_id %u ospf vrf %s vrf_id %u router_id %s",
- __PRETTY_FUNCTION__, ifp->name, ifp->vrf_id,
+ "%s: interface %s ifp->vrf->vrf_id %u ospf vrf %s vrf_id %u router_id %s",
+ __PRETTY_FUNCTION__, ifp->name, vrf_to_id(ifp->vrf),
ospf_vrf_id_to_name(ospf->vrf_id), ospf->vrf_id,
inet_ntoa(ospf->router_id));