diff options
Diffstat (limited to 'ospfd/ospf_interface.c')
| -rw-r--r-- | ospfd/ospf_interface.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 81cc346000..299e753ccf 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -360,9 +360,8 @@ void ospf_if_free(struct ospf_interface *oi) if (IS_DEBUG_OSPF_EVENT) zlog_debug("%s: ospf interface %s vrf %s id %u deleted", - __func__, oi->ifp->name, - ospf_vrf_id_to_name(oi->ifp->vrf_id), - oi->ifp->vrf_id); + __func__, oi->ifp->name, oi->ifp->vrf->name, + oi->ifp->vrf->vrf_id); ospf_delete_from_if(oi->ifp, oi); @@ -477,7 +476,7 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf, if (oi->type == OSPF_IFTYPE_VIRTUALLINK) continue; - if (if_is_loopback_or_vrf(oi->ifp)) + if (if_is_loopback(oi->ifp)) continue; if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED)) @@ -705,11 +704,11 @@ static int ospf_if_delete_hook(struct interface *ifp) */ ospf_del_if_params(ifp, IF_DEF_PARAMS(ifp)); - route_table_finish(IF_OIFS(ifp)); - for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn)) if (rn->info) ospf_del_if_params(ifp, rn->info); + + route_table_finish(IF_OIFS(ifp)); route_table_finish(IF_OIFS_PARAMS(ifp)); XFREE(MTYPE_OSPF_IF_INFO, ifp->info); @@ -719,7 +718,7 @@ static int ospf_if_delete_hook(struct interface *ifp) int ospf_if_is_enable(struct ospf_interface *oi) { - if (!(if_is_loopback_or_vrf(oi->ifp))) + if (!(if_is_loopback(oi->ifp))) if (if_is_up(oi->ifp)) return 1; @@ -915,9 +914,9 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf, ospf->vrf_id); snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count); - vi = if_create_name(ifname, ospf->vrf_id); + vi = if_get_by_name(ifname, ospf->vrf_id, ospf->name); /* - * if_create_name sets ZEBRA_INTERFACE_LINKDETECTION + * if_get_by_name sets ZEBRA_INTERFACE_LINKDETECTION * virtual links don't need this. */ UNSET_FLAG(vi->status, ZEBRA_INTERFACE_LINKDETECTION); @@ -971,11 +970,14 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf, static void ospf_vl_if_delete(struct ospf_vl_data *vl_data) { struct interface *ifp = vl_data->vl_oi->ifp; + struct vrf *vrf = ifp->vrf; vl_data->vl_oi->address->u.prefix4.s_addr = INADDR_ANY; vl_data->vl_oi->address->prefixlen = 0; ospf_if_free(vl_data->vl_oi); if_delete(&ifp); + if (!vrf_is_enabled(vrf)) + vrf_delete(vrf); vlink_count--; } @@ -1291,7 +1293,7 @@ uint8_t ospf_default_iftype(struct interface *ifp) { if (if_is_pointopoint(ifp)) return OSPF_IFTYPE_POINTOPOINT; - else if (if_is_loopback_or_vrf(ifp)) + else if (if_is_loopback(ifp)) return OSPF_IFTYPE_LOOPBACK; else return OSPF_IFTYPE_BROADCAST; @@ -1328,10 +1330,9 @@ static int ospf_ifp_create(struct interface *ifp) if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) zlog_debug( "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u", - ifp->name, ospf_vrf_id_to_name(ifp->vrf_id), - ifp->vrf_id, ifp->ifindex, - (unsigned long long)ifp->flags, ifp->metric, ifp->mtu, - ifp->speed); + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, + ifp->ifindex, (unsigned long long)ifp->flags, + ifp->metric, ifp->mtu, ifp->speed); assert(ifp->info); @@ -1344,7 +1345,7 @@ static int ospf_ifp_create(struct interface *ifp) IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp); } - ospf = ospf_lookup_by_vrf_id(ifp->vrf_id); + ospf = ifp->vrf->info; if (!ospf) return 0; @@ -1428,13 +1429,13 @@ static int ospf_ifp_destroy(struct interface *ifp) if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) zlog_debug( "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d", - ifp->name, ospf_vrf_id_to_name(ifp->vrf_id), - ifp->vrf_id, ifp->ifindex, - (unsigned long long)ifp->flags, ifp->metric, ifp->mtu); + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, + ifp->ifindex, (unsigned long long)ifp->flags, + ifp->metric, ifp->mtu); hook_call(ospf_if_delete, ifp); - ospf = ospf_lookup_by_vrf_id(ifp->vrf_id); + ospf = ifp->vrf->info; if (ospf) { if (ospf_if_count_area_params(ifp) > 0) ospf_interface_area_unset(ospf, ifp); |
