]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib,bgpd,babeld,ripngd,nhrpd,bfdd: clean up SA warnings 4457/head
authorMark Stapp <mjs@voltanet.io>
Tue, 4 Jun 2019 19:06:26 +0000 (15:06 -0400)
committerMark Stapp <mjs@voltanet.io>
Thu, 6 Jun 2019 17:13:15 +0000 (13:13 -0400)
Clean up several SA warnings.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
babeld/message.c
bfdd/bfd_packet.c
bgpd/bgp_mpath.c
bgpd/rfapi/rfapi_import.c
lib/vty.c
nhrpd/vici.c
ripngd/ripng_interface.c

index 794b6e997609b31f3437709d2732fd4e0f4a02df..d88790824cc2bf3c8557f2e6ecf7d4b82ff40484 100644 (file)
@@ -1115,7 +1115,9 @@ really_send_update(struct interface *ifp,
     if(channels_len >= 0) {
         accumulate_byte(ifp, 2);
         accumulate_byte(ifp, channels_len);
-        accumulate_bytes(ifp, channels, channels_len);
+
+       if (channels && channels_len > 0)
+               accumulate_bytes(ifp, channels, channels_len);
     }
     end_message(ifp, MESSAGE_UPDATE, 10 + (real_plen + 7) / 8 - omit +
                 channels_size);
index f3acfa4167f5c8c045b3f5f1d58691fec48de3e0..d68a1ad5fd98759b884f4f5fbce3e91744f3bc1b 100644 (file)
@@ -435,16 +435,18 @@ ssize_t bfd_recv_ipv6(int sd, uint8_t *msgbuf, size_t msgbuflen, uint8_t *ttl,
 #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
 
                                *ifindex = pi6->ipi6_ifindex;
+
+                               /* Set scope ID for link local addresses. */
+                               if (IN6_IS_ADDR_LINKLOCAL(
+                                           &peer->sa_sin6.sin6_addr))
+                                       peer->sa_sin6.sin6_scope_id = *ifindex;
+                               if (IN6_IS_ADDR_LINKLOCAL(
+                                           &local->sa_sin6.sin6_addr))
+                                       local->sa_sin6.sin6_scope_id = *ifindex;
                        }
                }
        }
 
-       /* Set scope ID for link local addresses. */
-       if (IN6_IS_ADDR_LINKLOCAL(&peer->sa_sin6.sin6_addr))
-               peer->sa_sin6.sin6_scope_id = *ifindex;
-       if (IN6_IS_ADDR_LINKLOCAL(&local->sa_sin6.sin6_addr))
-               local->sa_sin6.sin6_scope_id = *ifindex;
-
        return mlen;
 }
 
index d5b3d6b1974da26a2da084f64d8680db03d223d4..648c3be47e07c8426bb353f4de9dadace57bf7d3 100644 (file)
@@ -294,6 +294,10 @@ static struct bgp_path_info_mpath *
 bgp_path_info_mpath_get(struct bgp_path_info *path)
 {
        struct bgp_path_info_mpath *mpath;
+
+       if (!path)
+               return NULL;
+
        if (!path->mpath) {
                mpath = bgp_path_info_mpath_new();
                if (!mpath)
@@ -523,6 +527,7 @@ void bgp_path_info_mpath_update(struct bgp_node *rn,
                        list_delete_node(mp_list, mp_node);
                        bgp_path_info_mpath_dequeue(cur_mpath);
                        if ((mpath_count < maxpaths)
+                           && prev_mpath
                            && bgp_path_info_nexthop_cmp(prev_mpath,
                                                         cur_mpath)) {
                                bgp_path_info_mpath_enqueue(prev_mpath,
index b6d32d36eaa585ed625bb904bd4f4feb1672ade6..583adcda77cc17bf98b4ff3b68e78d588f5c8c46 100644 (file)
@@ -1143,6 +1143,9 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
                break;
        }
 
+       memset(&pfx_un1, 0, sizeof(pfx_un1));
+       memset(&pfx_un2, 0, sizeof(pfx_un2));
+
        /*
         * UN address comparisons
         */
@@ -1184,7 +1187,7 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
                }
        }
 
-       if (!pfx_un1.family || !pfx_un2.family)
+       if (pfx_un1.family == 0 || pfx_un2.family == 0)
                return 0;
 
        if (pfx_un1.family != pfx_un2.family)
index 639307b507b746382d73f37015260834e8c8daa8..e306e69b873c4f42e8558cdf9bd90f28207078be 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -151,7 +151,7 @@ int vty_out(struct vty *vty, const char *format, ...)
        va_list args;
        ssize_t len;
        char buf[1024];
-       char *p = buf;
+       char *p = NULL;
        char *filtered;
 
        if (vty->frame_pos) {
index 3de4609a2bc435966bbb18d6881b370db08b14d7..d6105b71d4270a247743ea639011f647321b9240 100644 (file)
@@ -207,7 +207,7 @@ static void parse_sa_message(struct vici_message_ctx *ctx,
                }
                break;
        default:
-               if (!key)
+               if (!key || !key->ptr)
                        break;
 
                switch (key->ptr[0]) {
@@ -550,7 +550,7 @@ int sock_open_unix(const char *path)
 
        memset(&addr, 0, sizeof(struct sockaddr_un));
        addr.sun_family = AF_UNIX;
-       strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
+       strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
 
        ret = connect(fd, (struct sockaddr *)&addr,
                      sizeof(addr.sun_family) + strlen(addr.sun_path));
index 5a4087b177e8e0427a9ceb63a40074a65a958d03..d83f4d27914506a3f6644c6cf164bf4b0e669cc2 100644 (file)
@@ -184,7 +184,8 @@ static int ripng_if_down(struct interface *ifp)
                        zlog_debug("turn off %s", ifp->name);
 
                /* Leave from multicast group. */
-               ripng_multicast_leave(ifp, ripng->sock);
+               if (ripng)
+                       ripng_multicast_leave(ifp, ripng->sock);
 
                ri->running = 0;
        }