From 602ba9bd8b118d3c1302e890010ca7c5d94e0ff5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 16 Jan 2017 08:57:20 -0500 Subject: [PATCH] zebra: Some code cleanup based upon Review. Cleanup 2 spots in the code: 1) In if_netlink.c -> combine multi-line if statement into 1 line 2) In zebra_ptm.c -> only handle code that needs to be inside the if statement in the if statement. Signed-off-by: Donald Sharp --- zebra/if_netlink.c | 3 +-- zebra/zebra_ptm.c | 15 +++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 678c217321..3665ad061d 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -465,8 +465,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, zns = zebra_ns_lookup (ns_id); ifa = NLMSG_DATA (h); - if (ifa->ifa_family != AF_INET - && ifa->ifa_family != AF_INET6) + if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) return 0; if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR) diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 194833f1e9..f3f849a6f4 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -891,17 +891,12 @@ zebra_ptm_bfd_dst_deregister (struct zserv *client, int sock, u_short length, stream_get(&src_p.u.prefix, s, src_p.prefixlen); if (src_p.family == AF_INET) - { - inet_ntop(AF_INET, &src_p.u.prefix4, buf, sizeof(buf)); - ptm_lib_append_msg(ptm_hdl, out_ctxt, - ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); - } + inet_ntop(AF_INET, &src_p.u.prefix4, buf, sizeof(buf)); else - { - inet_ntop(AF_INET6, &src_p.u.prefix6, buf, sizeof(buf)); - ptm_lib_append_msg(ptm_hdl, out_ctxt, - ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); - } + inet_ntop(AF_INET6, &src_p.u.prefix6, buf, sizeof(buf)); + ptm_lib_append_msg(ptm_hdl, out_ctxt, + ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); + if (zvrf_id (zvrf) != VRF_DEFAULT) ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_VRF_NAME_FIELD, zvrf_name (zvrf)); -- 2.39.5