forked from Mirror/frr
Merge pull request #13797 from sri-mohan1/srib-ripng
ripngd: changes for code maintainability
This commit is contained in:
commit
fd8a8b7596
|
@ -612,8 +612,8 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng,
|
||||||
*/
|
*/
|
||||||
EVENT_OFF(rinfo->t_garbage_collect);
|
EVENT_OFF(rinfo->t_garbage_collect);
|
||||||
listnode_delete(list, rinfo);
|
listnode_delete(list, rinfo);
|
||||||
if (ripng_route_rte(rinfo)
|
if (ripng_route_rte(rinfo) &&
|
||||||
&& CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB))
|
CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB))
|
||||||
/* The ADD message implies the update. */
|
/* The ADD message implies the update. */
|
||||||
ripng_zebra_ipv6_add(ripng, rp);
|
ripng_zebra_ipv6_add(ripng, rp);
|
||||||
ripng_info_free(rinfo);
|
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_TIMER_ON(rinfo->t_garbage_collect, ripng_garbage_collect,
|
||||||
ripng->garbage_time);
|
ripng->garbage_time);
|
||||||
|
|
||||||
if (ripng_route_rte(rinfo)
|
if (ripng_route_rte(rinfo) &&
|
||||||
&& CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB))
|
CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB))
|
||||||
ripng_zebra_ipv6_delete(ripng, rp);
|
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. */
|
/* Input distribute-list filtering. */
|
||||||
if (ri->list[ripng_distribute]) {
|
if (ri->list[ripng_distribute]) {
|
||||||
if (access_list_apply(ri->list[ripng_distribute],
|
if (access_list_apply(ri->list[ripng_distribute],
|
||||||
(struct prefix *)p)
|
(struct prefix *)p) == FILTER_DENY) {
|
||||||
== FILTER_DENY) {
|
|
||||||
if (IS_RIPNG_DEBUG_PACKET)
|
if (IS_RIPNG_DEBUG_PACKET)
|
||||||
zlog_debug("%pFX filtered by distribute %s", p,
|
zlog_debug("%pFX filtered by distribute %s", p,
|
||||||
inout);
|
inout);
|
||||||
|
@ -686,8 +685,7 @@ static int ripng_filter(int ripng_distribute, struct prefix_ipv6 *p,
|
||||||
}
|
}
|
||||||
if (ri->prefix[ripng_distribute]) {
|
if (ri->prefix[ripng_distribute]) {
|
||||||
if (prefix_list_apply(ri->prefix[ripng_distribute],
|
if (prefix_list_apply(ri->prefix[ripng_distribute],
|
||||||
(struct prefix *)p)
|
(struct prefix *)p) == PREFIX_DENY) {
|
||||||
== PREFIX_DENY) {
|
|
||||||
if (IS_RIPNG_DEBUG_PACKET)
|
if (IS_RIPNG_DEBUG_PACKET)
|
||||||
zlog_debug("%pFX filtered by prefix-list %s", p,
|
zlog_debug("%pFX filtered by prefix-list %s", p,
|
||||||
inout);
|
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->tag = htons(newinfo.tag_out); /* XXX */
|
||||||
rte->metric =
|
rte->metric = newinfo.metric_out; /* XXX: the routemap uses the
|
||||||
newinfo.metric_out; /* XXX: the routemap uses the
|
metric_out field */
|
||||||
metric_out field */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Once the entry has been validated, update the metric by
|
/* 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. */
|
/* Aggregate count decrement. */
|
||||||
ripng_aggregate_decrement(rp, rinfo);
|
ripng_aggregate_decrement(rp, rinfo);
|
||||||
|
|
||||||
rinfo->flags |= RIPNG_RTF_CHANGED;
|
SET_FLAG(rinfo->flags, RIPNG_RTF_CHANGED);
|
||||||
|
|
||||||
if (IS_RIPNG_DEBUG_EVENT)
|
if (IS_RIPNG_DEBUG_EVENT)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
|
@ -1111,7 +1108,7 @@ void ripng_redistribute_withdraw(struct ripng *ripng, int type)
|
||||||
/* Aggregate count decrement. */
|
/* Aggregate count decrement. */
|
||||||
ripng_aggregate_decrement(rp, rinfo);
|
ripng_aggregate_decrement(rp, rinfo);
|
||||||
|
|
||||||
rinfo->flags |= RIPNG_RTF_CHANGED;
|
SET_FLAG(rinfo->flags, RIPNG_RTF_CHANGED);
|
||||||
|
|
||||||
if (IS_RIPNG_DEBUG_EVENT) {
|
if (IS_RIPNG_DEBUG_EVENT) {
|
||||||
struct prefix_ipv6 *p =
|
struct prefix_ipv6 *p =
|
||||||
|
@ -1645,8 +1642,8 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Changed route only output. */
|
/* Changed route only output. */
|
||||||
if (route_type == ripng_changed_route
|
if (route_type == ripng_changed_route &&
|
||||||
&& (!(rinfo->flags & RIPNG_RTF_CHANGED)))
|
(!CHECK_FLAG(rinfo->flags, RIPNG_RTF_CHANGED)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Split horizon. */
|
/* Split horizon. */
|
||||||
|
@ -1657,9 +1654,10 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(list, listnode,
|
for (ALL_LIST_ELEMENTS_RO(list, listnode,
|
||||||
tmp_rinfo))
|
tmp_rinfo))
|
||||||
if (tmp_rinfo->type == ZEBRA_ROUTE_RIPNG
|
if (tmp_rinfo->type ==
|
||||||
&& tmp_rinfo->ifindex
|
ZEBRA_ROUTE_RIPNG &&
|
||||||
== ifp->ifindex) {
|
tmp_rinfo->ifindex ==
|
||||||
|
ifp->ifindex) {
|
||||||
suppress = 1;
|
suppress = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1717,11 +1715,11 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
||||||
/* If the route is not connected or
|
/* If the route is not connected or
|
||||||
localy generated
|
localy generated
|
||||||
one, use default-metric value */
|
one, use default-metric value */
|
||||||
if (rinfo->type != ZEBRA_ROUTE_RIPNG
|
if (rinfo->type != ZEBRA_ROUTE_RIPNG &&
|
||||||
&& rinfo->type
|
rinfo->type !=
|
||||||
!= ZEBRA_ROUTE_CONNECT
|
ZEBRA_ROUTE_CONNECT &&
|
||||||
&& rinfo->metric
|
rinfo->metric !=
|
||||||
!= RIPNG_METRIC_INFINITY)
|
RIPNG_METRIC_INFINITY)
|
||||||
rinfo->metric_out =
|
rinfo->metric_out =
|
||||||
ripng->default_metric;
|
ripng->default_metric;
|
||||||
}
|
}
|
||||||
|
@ -1738,16 +1736,15 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
||||||
/* Perform split-horizon with poisoned reverse
|
/* Perform split-horizon with poisoned reverse
|
||||||
* for RIPng routes.
|
* for RIPng routes.
|
||||||
**/
|
**/
|
||||||
if (ri->split_horizon
|
if (ri->split_horizon ==
|
||||||
== RIPNG_SPLIT_HORIZON_POISONED_REVERSE) {
|
RIPNG_SPLIT_HORIZON_POISONED_REVERSE) {
|
||||||
struct ripng_info *tmp_rinfo = NULL;
|
struct ripng_info *tmp_rinfo = NULL;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(list, listnode,
|
for (ALL_LIST_ELEMENTS_RO(list, listnode,
|
||||||
tmp_rinfo))
|
tmp_rinfo))
|
||||||
if ((tmp_rinfo->type
|
if ((tmp_rinfo->type ==
|
||||||
== ZEBRA_ROUTE_RIPNG)
|
ZEBRA_ROUTE_RIPNG) &&
|
||||||
&& tmp_rinfo->ifindex
|
tmp_rinfo->ifindex == ifp->ifindex)
|
||||||
== ifp->ifindex)
|
|
||||||
rinfo->metric_out =
|
rinfo->metric_out =
|
||||||
RIPNG_METRIC_INFINITY;
|
RIPNG_METRIC_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue