diff options
author | Mark Stapp <mjs@voltanet.io> | 2021-03-30 14:48:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-30 14:48:25 +0200 |
commit | 5c9254bd52ae69d957c08dd396948e29ae016c16 (patch) | |
tree | bf19222e6c6e8f7723e87a52ed406acfcbd73590 /ospfd/ospfd.c | |
parent | Merge pull request #8351 from volta-networks/fix_ospf6_abr_examin_summary_che... (diff) | |
parent | ospfd: fix counting of "ip ospf area" commands (diff) | |
download | frr-5c9254bd52ae69d957c08dd396948e29ae016c16.tar.xz frr-5c9254bd52ae69d957c08dd396948e29ae016c16.zip |
Merge pull request #8362 from idryzhov/fix-ospf-cli-count
ospfd: fix counting of "ip ospf area" commands
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r-- | ospfd/ospfd.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index f126577ae..b1b832407 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -476,41 +476,11 @@ struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name) static void ospf_init(struct ospf *ospf) { - struct vrf *vrf; - struct interface *ifp; - ospf_opaque_type11_lsa_init(ospf); if (ospf->vrf_id != VRF_UNKNOWN) ospf->oi_running = 1; - /* Activate 'ip ospf area x' configured interfaces for given - * vrf. Activate area on vrf x aware interfaces. - * vrf_enable callback calls router_id_update which - * internally will call ospf_if_update to trigger - * network_run_state - */ - vrf = vrf_lookup_by_id(ospf->vrf_id); - - FOR_ALL_INTERFACES (vrf, ifp) { - struct ospf_if_params *params; - struct route_node *rn; - uint32_t count = 0; - - params = IF_DEF_PARAMS(ifp); - if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) - count++; - - for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn)) - if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area)) - count++; - - if (count > 0) { - ospf_interface_area_set(ospf, ifp); - ospf->if_ospf_cli_count += count; - } - } - ospf_router_id_update(ospf); } @@ -554,6 +524,23 @@ struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id) return (vrf->info) ? (struct ospf *)vrf->info : NULL; } +uint32_t ospf_count_area_params(struct ospf *ospf) +{ + struct vrf *vrf; + struct interface *ifp; + uint32_t count = 0; + + if (ospf->vrf_id != VRF_UNKNOWN) { + vrf = vrf_lookup_by_id(ospf->vrf_id); + + FOR_ALL_INTERFACES (vrf, ifp) { + count += ospf_if_count_area_params(ifp); + } + } + + return count; +} + /* It should only be used when processing incoming info update from zebra. * Other situations, it is not sufficient to lookup the ospf instance by * vrf_name only without using the instance number. |