]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: small ospf6_asbr_redistribute_set improvement
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 22 Jun 2021 13:09:28 +0000 (16:09 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 22 Jun 2021 22:05:07 +0000 (01:05 +0300)
We always have a pointer to the ospf6 instance when the function is called.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
ospf6d/ospf6_asbr.c

index c17af758b03e42fbe01c377f5a8ee76afde46284..c963976088833aa8e1f89acc6fdfbaba106527c2 100644 (file)
@@ -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;
 }