]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: move attr display into checked block
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 11 Apr 2018 17:16:10 +0000 (13:16 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 13 Apr 2018 21:17:42 +0000 (17:17 -0400)
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>
bgpd/bgp_route.c

index bd73edded346d54051bff6d5b44090567b22778e..a71f5ac95659e9be650c53a307458d305b8c304a 100644 (file)
@@ -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 */