summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsri-mohan1 <sri.mohan@samsung.com>2023-03-27 08:57:01 +0200
committersri-mohan1 <sri.mohan@samsung.com>2023-03-27 08:57:01 +0200
commit248d33434e15ad67b0169d440335ec617771a35a (patch)
tree99171ed1acff7b72f57b4d9ba8193b3ffeb73b7a
parentldpd: changes for code maintainability (diff)
downloadfrr-248d33434e15ad67b0169d440335ec617771a35a.tar.xz
frr-248d33434e15ad67b0169d440335ec617771a35a.zip
ldpd: changes for code maintainability
these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
-rw-r--r--ldpd/ldp_zebra.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index 059115915..7d2bb03d0 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -103,7 +103,7 @@ pw2zpw(struct l2vpn_pw *pw, struct zapi_pw *zpw)
zpw->nexthop.ipv6 = pw->addr.v6;
zpw->local_label = NO_LABEL;
zpw->remote_label = NO_LABEL;
- if (pw->flags & F_PW_CWORD)
+ if (CHECK_FLAG(pw->flags, F_PW_CWORD))
zpw->flags = F_PSEUDOWIRE_CWORD;
zpw->data.ldp.lsr_id = pw->lsr_id;
zpw->data.ldp.pwid = pw->pwid;
@@ -176,10 +176,10 @@ ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS)
struct zapi_rlfa_igp igp;
struct zapi_rlfa_request rlfa;
- s = zclient->ibuf;
+ s = zclient->ibuf;
- if (zclient_opaque_decode(s, &info) != 0)
- return -1;
+ if(zclient_opaque_decode(s, &info) != 0)
+ return -1;
switch (info.type) {
case LDP_IGP_SYNC_IF_STATE_REQUEST:
@@ -253,7 +253,7 @@ ldp_zebra_send_mpls_labels(int cmd, struct kroute *kr)
* dropping them).
*/
if (kr->remote_label == NO_LABEL
- && !(ldpd_conf->flags & F_LDPD_ALLOW_BROKEN_LSP)
+ && !CHECK_FLAG(ldpd_conf->flags, F_LDPD_ALLOW_BROKEN_LSP)
&& cmd == ZEBRA_MPLS_LABELS_ADD)
return 0;
@@ -363,8 +363,7 @@ kif_redistribute(const char *ifname)
for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, ifc)) {
ifc2kaddr(ifp, ifc, &ka);
- main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka,
- sizeof(ka));
+ main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka));
}
}
}
@@ -432,14 +431,12 @@ ldp_interface_status_change(struct interface *ifp)
if (if_is_operative(ifp)) {
for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
ifc2kaddr(ifp, ifc, &ka);
- main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka,
- sizeof(ka));
+ main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka));
}
} else {
for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
ifc2kaddr(ifp, ifc, &ka);
- main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka,
- sizeof(ka));
+ main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka, sizeof(ka));
}
}
@@ -544,7 +541,7 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS)
switch (api.type) {
case ZEBRA_ROUTE_CONNECT:
- kr.flags |= F_CONNECTED;
+ SET_FLAG(kr.flags, F_CONNECTED);
break;
case ZEBRA_ROUTE_BGP:
/* LDP should follow the IGP and ignore BGP routes */
@@ -594,7 +591,7 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS)
kr.ifindex = api_nh->ifindex;
break;
case NEXTHOP_TYPE_IFINDEX:
- if (!(kr.flags & F_CONNECTED))
+ if (!CHECK_FLAG(kr.flags, F_CONNECTED))
continue;
break;
default:
@@ -607,8 +604,7 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS)
zebra_route_string(api.type));
if (add)
- main_imsg_compose_lde(IMSG_NETWORK_ADD, 0, &kr,
- sizeof(kr));
+ main_imsg_compose_lde(IMSG_NETWORK_ADD, 0, &kr, sizeof(kr));
}
main_imsg_compose_lde(IMSG_NETWORK_UPDATE, 0, &kr, sizeof(kr));
@@ -669,7 +665,7 @@ ldp_zebra_connected(struct zclient *zclient)
/* if MPLS was already enabled and we are re-connecting, register again
*/
- if (vty_conf->flags & F_LDPD_ENABLED)
+ if (CHECK_FLAG(vty_conf->flags, F_LDPD_ENABLED))
ldp_zebra_regdereg_zebra_info(true);
ldp_zebra_opaque_register();
@@ -684,11 +680,9 @@ ldp_zebra_filter_update(struct access_list *access)
if (access && access->name[0] != '\0') {
strlcpy(laccess.name, access->name, sizeof(laccess.name));
- debug_evt("%s ACL update filter name %s", __func__,
- access->name);
+ debug_evt("%s ACL update filter name %s", __func__, access->name);
- main_imsg_compose_both(IMSG_FILTER_UPDATE, &laccess,
- sizeof(laccess));
+ main_imsg_compose_both(IMSG_FILTER_UPDATE, &laccess, sizeof(laccess));
}
}
@@ -707,8 +701,7 @@ static zclient_handler *const ldp_handlers[] = {
void
ldp_zebra_init(struct thread_master *master)
{
- if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up,
- ldp_ifp_down, ldp_ifp_destroy);
+ if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up, ldp_ifp_down, ldp_ifp_destroy);
/* Set default values. */
zclient = zclient_new(master, &zclient_options_default, ldp_handlers,