From ff5c476dc2ad09f35e423c5ef7773f5fa45d4a79 Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Mon, 10 Jan 2022 20:45:10 -0500 Subject: [PATCH] ospfd,ospf6d: make clear the comparison of routemap name Comparison of the two pointer is confusing, they have no relevance except the time both of them are empty. Additionly modify one variable name and correct some comment words, they are same in both ospfd and ospf6d. Signed-off-by: anlan_cs --- ospf6d/ospf6_asbr.c | 10 +++++----- ospfd/ospf_vty.c | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 99f30a4a06..5cb6244bbc 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1936,13 +1936,13 @@ DEFPY (ospf6_default_route_originate, if (mtype_str == NULL) mtype = -1; - /* To check ,if user is providing same route map */ - if ((rtmap == ROUTEMAP_NAME(red)) - || (rtmap && ROUTEMAP_NAME(red) - && (strcmp(rtmap, ROUTEMAP_NAME(red)) == 0))) + /* To check if user is providing same route map */ + if ((!rtmap && !ROUTEMAP_NAME(red)) || + (rtmap && ROUTEMAP_NAME(red) && + (strcmp(rtmap, ROUTEMAP_NAME(red)) == 0))) sameRtmap = true; - /* Don't allow if the same lsa is aleardy originated. */ + /* Don't allow if the same lsa is already originated. */ if ((sameRtmap) && (red->dmetric.type == mtype) && (red->dmetric.value == mval) && (cur_originate == default_originate)) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 8cab6b9897..2df6103a6f 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -9275,7 +9275,7 @@ DEFUN (ospf_default_information_originate, struct ospf_redist *red; int idx = 0; int cur_originate = ospf->default_originate; - int sameRtmap = 0; + bool sameRtmap = false; char *rtmap = NULL; red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0); @@ -9300,13 +9300,13 @@ DEFUN (ospf_default_information_originate, if (argv_find(argv, argc, "WORD", &idx)) rtmap = argv[idx]->arg; - /* To check ,if user is providing same route map */ - if ((rtmap == ROUTEMAP_NAME(red)) || - (rtmap && ROUTEMAP_NAME(red) - && (strcmp(rtmap, ROUTEMAP_NAME(red)) == 0))) - sameRtmap = 1; + /* To check if user is providing same route map */ + if ((!rtmap && !ROUTEMAP_NAME(red)) || + (rtmap && ROUTEMAP_NAME(red) && + (strcmp(rtmap, ROUTEMAP_NAME(red)) == 0))) + sameRtmap = true; - /* Don't allow if the same lsa is aleardy originated. */ + /* Don't allow if the same lsa is already originated. */ if ((sameRtmap) && (red->dmetric.type == type) && (red->dmetric.value == metric)