diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-11 19:16:10 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-13 23:17:42 +0200 |
commit | 988258b4270733d1dcefd884256028f647c759e2 (patch) | |
tree | 5fb04560f8ade3c87924cc480065cfdffb4d6ec2 | |
parent | bgpd: double-check notify data when debugging (diff) | |
download | frr-988258b4270733d1dcefd884256028f647c759e2.tar.xz frr-988258b4270733d1dcefd884256028f647c759e2.zip |
bgpd: move attr display into checked block
Here we have a block conditional on the nullity of a pointer, followed
by a dereferennce of the same pointer. Move the deref into the
conditional block.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to '')
-rw-r--r-- | bgpd/bgp_route.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index bd73edded..a71f5ac95 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7047,32 +7047,36 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p, default: vty_out(vty, "?"); } + + char *str = esi2str(&(attr->evpn_overlay.eth_s_id)); + + vty_out(vty, "%s", str); + XFREE(MTYPE_TMP, str); + + if (IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p)) { + vty_out(vty, "/%s", + inet_ntoa(attr->evpn_overlay.gw_ip.ipv4)); + } else if (IS_EVPN_PREFIX_IPADDR_V6((struct prefix_evpn *)p)) { + vty_out(vty, "/%s", + inet_ntop(AF_INET6, + &(attr->evpn_overlay.gw_ip.ipv6), buf, + BUFSIZ)); + } + if (attr->ecommunity) { + char *mac = NULL; + struct ecommunity_val *routermac = ecommunity_lookup( + attr->ecommunity, ECOMMUNITY_ENCODE_EVPN, + ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC); + if (routermac) + mac = ecom_mac2str((char *)routermac->val); + if (mac) { + vty_out(vty, "/%s", (char *)mac); + XFREE(MTYPE_TMP, mac); + } + } + vty_out(vty, "\n"); } - struct eth_segment_id *id = &(attr->evpn_overlay.eth_s_id); - char *str = esi2str(id); - vty_out(vty, "%s", str); - XFREE(MTYPE_TMP, str); - if (IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p)) { - vty_out(vty, "/%s", inet_ntoa(attr->evpn_overlay.gw_ip.ipv4)); - } else if (IS_EVPN_PREFIX_IPADDR_V6((struct prefix_evpn *)p)) { - vty_out(vty, "/%s", - inet_ntop(AF_INET6, &(attr->evpn_overlay.gw_ip.ipv6), - buf, BUFSIZ)); - } - if (attr->ecommunity) { - char *mac = NULL; - struct ecommunity_val *routermac = ecommunity_lookup( - attr->ecommunity, ECOMMUNITY_ENCODE_EVPN, - ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC); - if (routermac) - mac = ecom_mac2str((char *)routermac->val); - if (mac) { - vty_out(vty, "/%s", (char *)mac); - XFREE(MTYPE_TMP, mac); - } - } - vty_out(vty, "\n"); } /* dampening route */ |