ripngd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
This commit is contained in:
sri-mohan1 2023-06-21 22:26:43 +05:30
parent fd8a8b7596
commit 3a40f78305
2 changed files with 13 additions and 17 deletions

View file

@ -136,8 +136,8 @@ static int ripng_if_ipv6_lladdress_check(struct interface *ifp)
struct prefix *p; struct prefix *p;
p = connected->address; p = connected->address;
if ((p->family == AF_INET6) if ((p->family == AF_INET6) &&
&& IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6)) IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6))
count++; count++;
} }
@ -634,9 +634,9 @@ static void ripng_connect_set(struct interface *ifp, int set)
if (set) { if (set) {
/* Check once more whether this prefix is within a /* Check once more whether this prefix is within a
* "network IF_OR_PREF" one */ * "network IF_OR_PREF" one */
if ((ripng_enable_if_lookup(ripng, connected->ifp->name) if ((ripng_enable_if_lookup(
>= 0) ripng, connected->ifp->name) >= 0) ||
|| (ripng_enable_network_lookup2(connected) >= 0)) (ripng_enable_network_lookup2(connected) >= 0))
ripng_redistribute_add( ripng_redistribute_add(
ripng, ZEBRA_ROUTE_CONNECT, ripng, ZEBRA_ROUTE_CONNECT,
RIPNG_ROUTE_INTERFACE, &address, RIPNG_ROUTE_INTERFACE, &address,

View file

@ -83,9 +83,8 @@ int ripng_offset_list_apply_in(struct ripng *ripng, struct prefix_ipv6 *p,
alist = access_list_lookup(AFI_IP6, alist = access_list_lookup(AFI_IP6,
OFFSET_LIST_IN_NAME(offset)); OFFSET_LIST_IN_NAME(offset));
if (alist if (alist && access_list_apply(alist, (struct prefix *)p) ==
&& access_list_apply(alist, (struct prefix *)p) FILTER_PERMIT) {
== FILTER_PERMIT) {
*metric += OFFSET_LIST_IN_METRIC(offset); *metric += OFFSET_LIST_IN_METRIC(offset);
return 1; return 1;
} }
@ -97,9 +96,8 @@ int ripng_offset_list_apply_in(struct ripng *ripng, struct prefix_ipv6 *p,
alist = access_list_lookup(AFI_IP6, alist = access_list_lookup(AFI_IP6,
OFFSET_LIST_IN_NAME(offset)); OFFSET_LIST_IN_NAME(offset));
if (alist if (alist && access_list_apply(alist, (struct prefix *)p) ==
&& access_list_apply(alist, (struct prefix *)p) FILTER_PERMIT) {
== FILTER_PERMIT) {
*metric += OFFSET_LIST_IN_METRIC(offset); *metric += OFFSET_LIST_IN_METRIC(offset);
return 1; return 1;
} }
@ -121,9 +119,8 @@ int ripng_offset_list_apply_out(struct ripng *ripng, struct prefix_ipv6 *p,
alist = access_list_lookup(AFI_IP6, alist = access_list_lookup(AFI_IP6,
OFFSET_LIST_OUT_NAME(offset)); OFFSET_LIST_OUT_NAME(offset));
if (alist if (alist && access_list_apply(alist, (struct prefix *)p) ==
&& access_list_apply(alist, (struct prefix *)p) FILTER_PERMIT) {
== FILTER_PERMIT) {
*metric += OFFSET_LIST_OUT_METRIC(offset); *metric += OFFSET_LIST_OUT_METRIC(offset);
return 1; return 1;
} }
@ -136,9 +133,8 @@ int ripng_offset_list_apply_out(struct ripng *ripng, struct prefix_ipv6 *p,
alist = access_list_lookup(AFI_IP6, alist = access_list_lookup(AFI_IP6,
OFFSET_LIST_OUT_NAME(offset)); OFFSET_LIST_OUT_NAME(offset));
if (alist if (alist && access_list_apply(alist, (struct prefix *)p) ==
&& access_list_apply(alist, (struct prefix *)p) FILTER_PERMIT) {
== FILTER_PERMIT) {
*metric += OFFSET_LIST_OUT_METRIC(offset); *metric += OFFSET_LIST_OUT_METRIC(offset);
return 1; return 1;
} }