]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Cleanup some SA
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 15 May 2017 11:33:48 +0000 (07:33 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 15 May 2017 11:33:48 +0000 (07:33 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_attr.c
bgpd/bgp_clist.c
bgpd/bgp_dump.c
bgpd/bgp_packet.c
bgpd/bgp_route.c

index b97ba61c955c046ef32cbdb745930af4c23653a4..7d5a98fec6fd2c97b75db5d20ad8a0b72a189e40 100644 (file)
@@ -1500,8 +1500,7 @@ bgp_attr_as4_path (struct bgp_attr_parser_args *args, struct aspath **as4_path)
     }
 
   /* Set aspath attribute flag. */
-  if (as4_path)
-    attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_PATH);
+  attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_PATH);
 
   return BGP_ATTR_PARSE_PROCEED;
 }
index 3def97c73d132eac0cdfb99cc0710f590689a8cc..91cd7e37627802cf6a4e21de10dffa659f1280ab 100644 (file)
@@ -1158,16 +1158,13 @@ extcommunity_list_set (struct community_list_handler *ch,
        }
     }
 
-  if (str)
-    {
-      if (style == EXTCOMMUNITY_LIST_STANDARD)
-       ecom = ecommunity_str2com (str, 0, 1);
-      else
-       regex = bgp_regcomp (str);
+  if (style == EXTCOMMUNITY_LIST_STANDARD)
+    ecom = ecommunity_str2com (str, 0, 1);
+  else
+    regex = bgp_regcomp (str);
 
-      if (! ecom && ! regex)
-       return COMMUNITY_LIST_ERR_MALFORMED_VAL;
-    }
+  if (! ecom && ! regex)
+    return COMMUNITY_LIST_ERR_MALFORMED_VAL;
 
   if (ecom)
     ecom->str = ecommunity_ecom2str (ecom, ECOMMUNITY_FORMAT_DISPLAY, 0);
@@ -1180,8 +1177,7 @@ extcommunity_list_set (struct community_list_handler *ch,
     entry->config = ecommunity_ecom2str (ecom, ECOMMUNITY_FORMAT_COMMUNITY_LIST, 0);
   else if (regex)
     entry->config = XSTRDUP (MTYPE_COMMUNITY_LIST_CONFIG, str);
-  else
-    entry->config = NULL;
+
   entry->u.ecom = ecom;
   entry->reg = regex;
 
index 10ddf1660c71f1b424893b7829375f1ad12890f6..c552ceab5aa0af54da7be81b01522d52a2107ba4 100644 (file)
@@ -626,7 +626,7 @@ bgp_dump_parse_time (const char *str)
            return 0;
          total += time * 60;
          time = 0;
-         seen_h = 1;
+         seen_m = 1;
        }
       else
        return 0;
index 0800dd74bafa5b6dd41d76e589544e5d3178b733..ca211589f7cff48b8e8e519f6fb64d8c52a7478a 100644 (file)
@@ -603,6 +603,8 @@ bgp_notify_send_with_data (struct peer *peer, u_char code, u_char sub_code,
   struct stream *s;
   int length;
 
+  assert (data);
+
   /* Allocate new stream. */
   s = stream_new (BGP_MAX_PACKET_SIZE);
 
@@ -614,8 +616,7 @@ bgp_notify_send_with_data (struct peer *peer, u_char code, u_char sub_code,
   stream_putc (s, sub_code);   /* BGP notify sub_code */
 
   /* If notify data is present. */
-  if (data)
-    stream_write (s, data, datalen);
+  stream_write (s, data, datalen);
   
   /* Set BGP packet length. */
   length = bgp_packet_set_size (s);
index 834b9e073e24a7226983eb1fb0f6d4e39bfe826b..01032193a5ee5f04a1d8b1ddabee180a5925dce2 100644 (file)
@@ -8887,6 +8887,7 @@ bgp_show_community (struct vty *vty, struct bgp *bgp, int argc,
   int i;
   char *str;
   int first = 0;
+  int ret = 0;
 
   b = buffer_new (1024);
   for (i = 0; i < argc; i++)
@@ -8915,9 +8916,12 @@ bgp_show_community (struct vty *vty, struct bgp *bgp, int argc,
       return CMD_WARNING;
     }
 
-  return bgp_show (vty, bgp, afi, safi,
-                   (exact ? bgp_show_type_community_exact :
-                   bgp_show_type_community), com, 0);
+  ret = bgp_show (vty, bgp, afi, safi,
+                  (exact ? bgp_show_type_community_exact :
+                 bgp_show_type_community), com, 0);
+  community_free (com);
+
+  return ret;
 }
 
 static int