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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-01-16 08:57:20 -05:00
parent 9aa7f43f7e
commit 602ba9bd8b
2 changed files with 6 additions and 12 deletions

View File

@ -465,8 +465,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h,
zns = zebra_ns_lookup (ns_id); zns = zebra_ns_lookup (ns_id);
ifa = NLMSG_DATA (h); ifa = NLMSG_DATA (h);
if (ifa->ifa_family != AF_INET if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6)
&& ifa->ifa_family != AF_INET6)
return 0; return 0;
if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR) if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR)

View File

@ -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); stream_get(&src_p.u.prefix, s, src_p.prefixlen);
if (src_p.family == AF_INET) if (src_p.family == AF_INET)
{
inet_ntop(AF_INET, &src_p.u.prefix4, buf, sizeof(buf)); 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);
}
else else
{
inet_ntop(AF_INET6, &src_p.u.prefix6, buf, sizeof(buf)); inet_ntop(AF_INET6, &src_p.u.prefix6, buf, sizeof(buf));
ptm_lib_append_msg(ptm_hdl, out_ctxt, ptm_lib_append_msg(ptm_hdl, out_ctxt,
ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); ZEBRA_PTM_BFD_SRC_IP_FIELD, buf);
}
if (zvrf_id (zvrf) != VRF_DEFAULT) if (zvrf_id (zvrf) != VRF_DEFAULT)
ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_VRF_NAME_FIELD, ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_VRF_NAME_FIELD,
zvrf_name (zvrf)); zvrf_name (zvrf));