diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-06-21 17:00:00 +0300 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-21 17:00:00 +0300 | 
| commit | fd8a8b759629003d98d03b4ab5e5f8ef7cd0768e (patch) | |
| tree | c46226e1fc6e763a3b970519d4df31f3f2a77fd6 /ripngd | |
| parent | be4cfbd2b83e59e3c87024acb0140882f27414e1 (diff) | |
| parent | df22d15d7cc7f6a01c6c07a894ea4e1d10780271 (diff) | |
Merge pull request #13797 from sri-mohan1/srib-ripng
ripngd: changes for code maintainability
Diffstat (limited to 'ripngd')
| -rw-r--r-- | ripngd/ripngd.c | 55 | 
1 files changed, 26 insertions, 29 deletions
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index d5618b63f2..465b40bd3f 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -612,8 +612,8 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng,  		 */  		EVENT_OFF(rinfo->t_garbage_collect);  		listnode_delete(list, rinfo); -		if (ripng_route_rte(rinfo) -		    && CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB)) +		if (ripng_route_rte(rinfo) && +		    CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB))  			/* The ADD message implies the update. */  			ripng_zebra_ipv6_add(ripng, rp);  		ripng_info_free(rinfo); @@ -629,8 +629,8 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng,  		RIPNG_TIMER_ON(rinfo->t_garbage_collect, ripng_garbage_collect,  			       ripng->garbage_time); -		if (ripng_route_rte(rinfo) -		    && CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB)) +		if (ripng_route_rte(rinfo) && +		    CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB))  			ripng_zebra_ipv6_delete(ripng, rp);  	} @@ -676,8 +676,7 @@ static int ripng_filter(int ripng_distribute, struct prefix_ipv6 *p,  	/* Input distribute-list filtering. */  	if (ri->list[ripng_distribute]) {  		if (access_list_apply(ri->list[ripng_distribute], -				      (struct prefix *)p) -		    == FILTER_DENY) { +				      (struct prefix *)p) == FILTER_DENY) {  			if (IS_RIPNG_DEBUG_PACKET)  				zlog_debug("%pFX filtered by distribute %s", p,  					   inout); @@ -686,8 +685,7 @@ static int ripng_filter(int ripng_distribute, struct prefix_ipv6 *p,  	}  	if (ri->prefix[ripng_distribute]) {  		if (prefix_list_apply(ri->prefix[ripng_distribute], -				      (struct prefix *)p) -		    == PREFIX_DENY) { +				      (struct prefix *)p) == PREFIX_DENY) {  			if (IS_RIPNG_DEBUG_PACKET)  				zlog_debug("%pFX filtered by prefix-list %s", p,  					   inout); @@ -818,9 +816,8 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from,  			}  		}  		rte->tag = htons(newinfo.tag_out); /* XXX */ -		rte->metric = -			newinfo.metric_out; /* XXX: the routemap uses the -					       metric_out field */ +		rte->metric = newinfo.metric_out;  /* XXX: the routemap uses the +			 metric_out field */  	}  	/* Once the entry has been validated, update the metric by @@ -1072,7 +1069,7 @@ void ripng_redistribute_delete(struct ripng *ripng, int type, int sub_type,  				/* Aggregate count decrement. */  				ripng_aggregate_decrement(rp, rinfo); -				rinfo->flags |= RIPNG_RTF_CHANGED; +				SET_FLAG(rinfo->flags, RIPNG_RTF_CHANGED);  				if (IS_RIPNG_DEBUG_EVENT)  					zlog_debug( @@ -1111,7 +1108,7 @@ void ripng_redistribute_withdraw(struct ripng *ripng, int type)  				/* Aggregate count decrement. */  				ripng_aggregate_decrement(rp, rinfo); -				rinfo->flags |= RIPNG_RTF_CHANGED; +				SET_FLAG(rinfo->flags, RIPNG_RTF_CHANGED);  				if (IS_RIPNG_DEBUG_EVENT) {  					struct prefix_ipv6 *p = @@ -1645,8 +1642,8 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,  				continue;  			/* Changed route only output. */ -			if (route_type == ripng_changed_route -			    && (!(rinfo->flags & RIPNG_RTF_CHANGED))) +			if (route_type == ripng_changed_route && +			    (!CHECK_FLAG(rinfo->flags, RIPNG_RTF_CHANGED)))  				continue;  			/* Split horizon. */ @@ -1657,9 +1654,10 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,  				for (ALL_LIST_ELEMENTS_RO(list, listnode,  							  tmp_rinfo)) -					if (tmp_rinfo->type == ZEBRA_ROUTE_RIPNG -					    && tmp_rinfo->ifindex -						       == ifp->ifindex) { +					if (tmp_rinfo->type == +						    ZEBRA_ROUTE_RIPNG && +					    tmp_rinfo->ifindex == +						    ifp->ifindex) {  						suppress = 1;  						break;  					} @@ -1717,11 +1715,11 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,  					/* If the route is not connected or  					   localy generated  					   one, use default-metric value */ -					if (rinfo->type != ZEBRA_ROUTE_RIPNG -					    && rinfo->type -						       != ZEBRA_ROUTE_CONNECT -					    && rinfo->metric -						       != RIPNG_METRIC_INFINITY) +					if (rinfo->type != ZEBRA_ROUTE_RIPNG && +					    rinfo->type != +						    ZEBRA_ROUTE_CONNECT && +					    rinfo->metric != +						    RIPNG_METRIC_INFINITY)  						rinfo->metric_out =  							ripng->default_metric;  				} @@ -1738,16 +1736,15 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,  			/* Perform split-horizon with poisoned reverse  			 * for RIPng routes.  			 **/ -			if (ri->split_horizon -			    == RIPNG_SPLIT_HORIZON_POISONED_REVERSE) { +			if (ri->split_horizon == +			    RIPNG_SPLIT_HORIZON_POISONED_REVERSE) {  				struct ripng_info *tmp_rinfo = NULL;  				for (ALL_LIST_ELEMENTS_RO(list, listnode,  							  tmp_rinfo)) -					if ((tmp_rinfo->type -					     == ZEBRA_ROUTE_RIPNG) -					    && tmp_rinfo->ifindex -						       == ifp->ifindex) +					if ((tmp_rinfo->type == +					     ZEBRA_ROUTE_RIPNG) && +					    tmp_rinfo->ifindex == ifp->ifindex)  						rinfo->metric_out =  							RIPNG_METRIC_INFINITY;  			}  | 
