]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Clean up some static analysis warnings
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 7 May 2016 00:19:05 +0000 (20:19 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 19 May 2016 14:42:26 +0000 (10:42 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
bgpd/bgp_aspath.c
bgpd/bgp_mpath.c
bgpd/bgp_open.c
bgpd/bgp_packet.c
bgpd/bgp_route.c
bgpd/bgp_updgrp_packet.c
bgpd/bgp_vty.c

index f4d7c4aad8582653193d5f43328bd504fc70dec0..031f71c3059d3dd4a99686a34e9e88c021f9deb6 100644 (file)
@@ -1045,20 +1045,15 @@ struct aspath *
 aspath_aggregate (struct aspath *as1, struct aspath *as2)
 {
   int i;
-  int minlen;
-  int match;
+  int minlen = 0;
+  int match = 0;
   int from;
   struct assegment *seg1 = as1->segments;
   struct assegment *seg2 = as2->segments;
   struct aspath *aspath = NULL;
-  struct assegment *asset;
+  struct assegment *asset = NULL;
   struct assegment *prevseg = NULL;
 
-  match = 0;
-  minlen = 0;
-  aspath = NULL;
-  asset = NULL;
-
   /* First of all check common leading sequence. */
   while (seg1 && seg2)
     {      
index 852d863296445ecaa928a723d3ac30cb2bdfc59c..8397177f8fd2960ee3c8ac1a31f05967cd601fb3 100644 (file)
@@ -564,7 +564,7 @@ bgp_info_mpath_update (struct bgp_node *rn, struct bgp_info *new_best,
               bgp_info_nexthop_cmp (prev_mpath, new_mpath))
             {
               if (new_mpath == next_mpath)
-                next_mpath = bgp_info_mpath_next (new_mpath);
+                bgp_info_mpath_next (new_mpath);
               bgp_info_mpath_dequeue (new_mpath);
 
               bgp_info_mpath_enqueue (prev_mpath, new_mpath);
index 0adde3f894ae0cb2a7c1b033bbc762b41015f252..18d135997d9b81ad03c0ac897aa98e1429fadd30 100644 (file)
@@ -993,13 +993,12 @@ end:
 int
 bgp_open_option_parse (struct peer *peer, u_char length, int *mp_capability)
 {
-  int ret;
+  int ret = 0;
   u_char *error;
   u_char error_data[BGP_MAX_PACKET_SIZE];
   struct stream *s = BGP_INPUT(peer);
   size_t end = stream_get_getp (s) + length;
 
-  ret = 0;
   error = error_data;
 
   if (bgp_debug_neighbor_events(peer))
index 933a5048514b32b6e5977b627bac3582ad8da089..08082161fa81a03b820e2c3a85b09ef7e4243ae3 100644 (file)
@@ -2348,7 +2348,7 @@ bgp_read (struct thread *thread)
     goto done;
 
   /* Get size and type again. */
-  size = stream_getw_from (peer->ibuf, BGP_MARKER_SIZE);
+  (void)stream_getw_from (peer->ibuf, BGP_MARKER_SIZE);
   type = stream_getc_from (peer->ibuf, BGP_MARKER_SIZE + 2);
 
   /* BGP packet dump function. */
index a0dd59183322b362df9ab0153b04884c92e87efc..c8781a85b10e8bd02edabdeb9e62511bba0e2d99 100644 (file)
@@ -1542,7 +1542,6 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn,
               continue;
 
           new_select = ri1;
-          old_select = CHECK_FLAG (ri1->flags, BGP_INFO_SELECTED) ? ri1 : NULL;
           if (ri1->next)
             {
               for (ri2 = ri1->next; ri2; ri2 = ri2->next)
@@ -1561,8 +1560,6 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn,
                       || aspath_cmp_left_confed (ri1->attr->aspath,
                                                  ri2->attr->aspath))
                     {
-                      if (CHECK_FLAG (ri2->flags, BGP_INFO_SELECTED))
-                        old_select = ri2;
                       if (bgp_info_cmp (bgp, ri2, new_select, &paths_eq,
                                         mpath_cfg, debug, pfx_buf))
                         {
index 320eef21d28c2f6e08d34bfa6e9c2dd6677dc2ae..9577d1b19e20f4d2ddcd873ff2c1e0bc0e0580e4 100644 (file)
@@ -1048,7 +1048,7 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
   unsigned long attrlen_pos = 0;
   unsigned long cp;
   bgp_size_t unfeasible_len;
-  bgp_size_t total_attr_len;
+  bgp_size_t total_attr_len = 0;
   size_t mp_start = 0;
   size_t mplen_pos = 0;
   afi_t afi;
@@ -1070,8 +1070,6 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
     str2prefix ("::/0", &p);
 #endif /* HAVE_IPV6 */
 
-  total_attr_len = 0;
-
   if (bgp_debug_update(NULL, &p, subgrp->update_group, 0))
     {
       char buf[INET6_BUFSIZ];
index bde127350850b853e60484506ad528de82644a78..ad04308f06fc8d4d13aee180d53b192ce4ede99c 100644 (file)
@@ -393,7 +393,7 @@ bgp_clear (struct vty *vty, struct bgp *bgp,  afi_t afi, safi_t safi,
        {
          if (stype == BGP_CLEAR_SOFT_NONE)
            {
-             ret = peer_clear (peer, NULL);
+             peer_clear (peer, NULL);
              continue;
            }