mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-17 20:09:38 +00:00
ospfd: correctly process interface creation/destruction
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
eb364867d4
commit
cbf1568110
@ -1277,6 +1277,9 @@ void ospf_if_interface(struct interface *ifp)
|
|||||||
static int ospf_ifp_create(struct interface *ifp)
|
static int ospf_ifp_create(struct interface *ifp)
|
||||||
{
|
{
|
||||||
struct ospf *ospf = NULL;
|
struct ospf *ospf = NULL;
|
||||||
|
struct ospf_if_params *params;
|
||||||
|
struct route_node *rn;
|
||||||
|
uint32_t count = 0;
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
@ -1298,6 +1301,19 @@ static int ospf_ifp_create(struct interface *ifp)
|
|||||||
if (!ospf)
|
if (!ospf)
|
||||||
return 0;
|
return 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->if_ospf_cli_count += count;
|
||||||
|
ospf_interface_area_set(ospf, ifp);
|
||||||
|
}
|
||||||
|
|
||||||
ospf_if_recalculate_output_cost(ifp);
|
ospf_if_recalculate_output_cost(ifp);
|
||||||
|
|
||||||
ospf_if_update(ospf, ifp);
|
ospf_if_update(ospf, ifp);
|
||||||
@ -1363,7 +1379,10 @@ static int ospf_ifp_down(struct interface *ifp)
|
|||||||
|
|
||||||
static int ospf_ifp_destroy(struct interface *ifp)
|
static int ospf_ifp_destroy(struct interface *ifp)
|
||||||
{
|
{
|
||||||
|
struct ospf *ospf;
|
||||||
|
struct ospf_if_params *params;
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
|
uint32_t count = 0;
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
@ -1374,6 +1393,22 @@ static int ospf_ifp_destroy(struct interface *ifp)
|
|||||||
|
|
||||||
hook_call(ospf_if_delete, ifp);
|
hook_call(ospf_if_delete, ifp);
|
||||||
|
|
||||||
|
ospf = ospf_lookup_by_vrf_id(ifp->vrf_id);
|
||||||
|
if (ospf) {
|
||||||
|
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->if_ospf_cli_count -= count;
|
||||||
|
ospf_interface_area_unset(ospf, ifp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn))
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn))
|
||||||
if (rn->info)
|
if (rn->info)
|
||||||
ospf_if_free((struct ospf_interface *)rn->info);
|
ospf_if_free((struct ospf_interface *)rn->info);
|
||||||
|
Loading…
Reference in New Issue
Block a user