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>
This commit is contained in:
Quentin Young 2018-04-11 13:16:10 -04:00
parent e0981960cd
commit 988258b427

View File

@ -7047,18 +7047,20 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p,
default: default:
vty_out(vty, "?"); vty_out(vty, "?");
} }
}
struct eth_segment_id *id = &(attr->evpn_overlay.eth_s_id); char *str = esi2str(&(attr->evpn_overlay.eth_s_id));
char *str = esi2str(id);
vty_out(vty, "%s", str); vty_out(vty, "%s", str);
XFREE(MTYPE_TMP, str); XFREE(MTYPE_TMP, str);
if (IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p)) { if (IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p)) {
vty_out(vty, "/%s", inet_ntoa(attr->evpn_overlay.gw_ip.ipv4)); vty_out(vty, "/%s",
inet_ntoa(attr->evpn_overlay.gw_ip.ipv4));
} else if (IS_EVPN_PREFIX_IPADDR_V6((struct prefix_evpn *)p)) { } else if (IS_EVPN_PREFIX_IPADDR_V6((struct prefix_evpn *)p)) {
vty_out(vty, "/%s", vty_out(vty, "/%s",
inet_ntop(AF_INET6, &(attr->evpn_overlay.gw_ip.ipv6), inet_ntop(AF_INET6,
buf, BUFSIZ)); &(attr->evpn_overlay.gw_ip.ipv6), buf,
BUFSIZ));
} }
if (attr->ecommunity) { if (attr->ecommunity) {
char *mac = NULL; char *mac = NULL;
@ -7075,6 +7077,8 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p,
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
}
/* dampening route */ /* dampening route */
static void damp_route_vty_out(struct vty *vty, struct prefix *p, static void damp_route_vty_out(struct vty *vty, struct prefix *p,
struct bgp_info *binfo, int display, safi_t safi, struct bgp_info *binfo, int display, safi_t safi,