From d214b64afa640e63f23b53eb40eda777c84d6556 Mon Sep 17 00:00:00 2001 From: Manoj Naragund Date: Fri, 22 Oct 2021 00:33:10 -0700 Subject: [PATCH 1/3] ospf6d: minor code enhancements. Description: code changes involve removal of increment and decrement operators during function calls. These expressions make code less readable. Signed-off-by: Manoj Naragund --- ospf6d/ospf6_asbr.c | 6 ++++-- ospf6d/ospf6_nssa.c | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index cd2791fc48..fafe3dc36d 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1308,7 +1308,8 @@ static void ospf6_asbr_redistribute_set(struct ospf6 *ospf6, int type) { ospf6_zebra_redistribute(type, ospf6->vrf_id); - ospf6_asbr_status_update(ospf6, ++ospf6->redist_count); + ++ospf6->redist_count; + ospf6_asbr_status_update(ospf6, ospf6->redist_count); } static void ospf6_asbr_redistribute_unset(struct ospf6 *ospf6, @@ -1330,7 +1331,8 @@ static void ospf6_asbr_redistribute_unset(struct ospf6 *ospf6, } ospf6_asbr_routemap_unset(red); - ospf6_asbr_status_update(ospf6, --ospf6->redist_count); + --ospf6->redist_count; + ospf6_asbr_status_update(ospf6, ospf6->redist_count); } /* When an area is unstubified, flood all the external LSAs in the area */ diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index c2e9b7f28a..c12964ea2f 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -185,12 +185,15 @@ void ospf6_abr_nssa_check_status(struct ospf6 *ospf6) * when they are not translating. */ if (old_state != area->NSSATranslatorState) { - if (old_state == OSPF6_NSSA_TRANSLATE_DISABLED) + if (old_state == OSPF6_NSSA_TRANSLATE_DISABLED) { + ++ospf6->redist_count; ospf6_asbr_status_update(ospf6, - ++ospf6->redist_count); - else + ospf6->redist_count); + } else { + --ospf6->redist_count; ospf6_asbr_status_update(ospf6, - --ospf6->redist_count); + ospf6->redist_count); + } } } } From a48bc483b0bb4298135ea9f8f8a2b602d93f0561 Mon Sep 17 00:00:00 2001 From: Manoj Naragund Date: Fri, 22 Oct 2021 00:46:27 -0700 Subject: [PATCH 2/3] ospf6d: prefix structure compare changes. Description: Code changes involve replacing memcmp with prefix_same, for comparing prefix structures. Signed-off-by: Manoj Naragund --- ospf6d/ospf6_route.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 4b87c4cf30..3958ea8776 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -580,9 +580,7 @@ ospf6_route_lookup_identical(struct ospf6_route *route, for (target = ospf6_route_lookup(&route->prefix, table); target; target = target->next) { if (target->type == route->type - && (memcmp(&target->prefix, &route->prefix, - sizeof(struct prefix)) - == 0) + && prefix_same(&target->prefix, &route->prefix) && target->path.type == route->path.type && target->path.cost == route->path.cost && target->path.u.cost_e2 == route->path.u.cost_e2 From 46e9628d01943f437a8f0439a3322159eb9bb18a Mon Sep 17 00:00:00 2001 From: Manoj Naragund Date: Tue, 26 Oct 2021 00:45:25 -0700 Subject: [PATCH 3/3] ospf6d: remove unnecessary break. Signed-off-by: Manoj Naragund --- ospf6d/ospf6_snmp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 92922567e8..fb8c5d6950 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -1039,7 +1039,6 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, return SNMP_INTEGER(OSPF6_LSA_IS_KNOWN(lsa->header->type) ? SNMP_TRUE : SNMP_FALSE); - break; } return NULL; }