From: Igor Ryzhov Date: Tue, 22 Jun 2021 13:09:28 +0000 (+0300) Subject: ospf6d: small ospf6_asbr_redistribute_set improvement X-Git-Tag: base_8.1~397^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2fdc4f8dea787ff54ed564255ef51befa72db6e5;p=matthieu%2Ffrr.git ospf6d: small ospf6_asbr_redistribute_set improvement We always have a pointer to the ospf6 instance when the function is called. Signed-off-by: Igor Ryzhov --- diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index c17af758b0..c963976088 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -58,7 +58,7 @@ DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_EXTERNAL_INFO, "OSPF6 ext. info"); DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_DIST_ARGS, "OSPF6 Distribute arguments"); DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_REDISTRIBUTE, "OSPF6 Redistribute arguments"); -static void ospf6_asbr_redistribute_set(int type, vrf_id_t vrf_id); +static void ospf6_asbr_redistribute_set(struct ospf6 *ospf6, int type); static void ospf6_asbr_redistribute_unset(struct ospf6 *ospf6, struct ospf6_redist *red, int type); @@ -1111,8 +1111,7 @@ void ospf6_asbr_routemap_update(const char *mapname) type)); ospf6_asbr_redistribute_unset(ospf6, red, type); ospf6_asbr_routemap_set(red, mapname); - ospf6_asbr_redistribute_set( - type, ospf6->vrf_id); + ospf6_asbr_redistribute_set(ospf6, type); } } } @@ -1231,15 +1230,9 @@ void ospf6_asbr_status_update(struct ospf6 *ospf6, int status) OSPF6_ROUTER_LSA_SCHEDULE(oa); } -static void ospf6_asbr_redistribute_set(int type, vrf_id_t vrf_id) +static void ospf6_asbr_redistribute_set(struct ospf6 *ospf6, int type) { - struct ospf6 *ospf6 = NULL; - ospf6_zebra_redistribute(type, vrf_id); - - ospf6 = ospf6_lookup_by_vrf_id(vrf_id); - - if (!ospf6) - return; + ospf6_zebra_redistribute(type, ospf6->vrf_id); ospf6_asbr_status_update(ospf6, ++ospf6->redist_count); } @@ -1263,7 +1256,6 @@ static void ospf6_asbr_redistribute_unset(struct ospf6 *ospf6, } ospf6_asbr_routemap_unset(red); - zlog_debug("%s: redist_count %d", __func__, ospf6->redist_count); ospf6_asbr_status_update(ospf6, --ospf6->redist_count); } @@ -1590,7 +1582,7 @@ DEFUN (ospf6_redistribute, return CMD_SUCCESS; ospf6_asbr_redistribute_unset(ospf6, red, type); - ospf6_asbr_redistribute_set(type, ospf6->vrf_id); + ospf6_asbr_redistribute_set(ospf6, type); return CMD_SUCCESS; } @@ -1621,7 +1613,7 @@ DEFUN (ospf6_redistribute_routemap, ospf6_asbr_redistribute_unset(ospf6, red, type); ospf6_asbr_routemap_set(red, argv[idx_word]->arg); - ospf6_asbr_redistribute_set(type, ospf6->vrf_id); + ospf6_asbr_redistribute_set(ospf6, type); return CMD_SUCCESS; }