]> git.proxmox.com Git - mirror_frr.git/commitdiff
pbrd: Fix a couple SA issues
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 20 Apr 2018 14:18:47 +0000 (10:18 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 24 Apr 2018 02:09:33 +0000 (22:09 -0400)
1) addr will never be non-null because of the way we build the cli
at this point in time, but the SA system does not understand this,
add a bread crumb for it.

2) Fix a possible memory leak of the pbr_ifp

3) Fix possible integer overflow when bit shifting.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pbrd/pbr_vty.c
pbrd/pbr_zebra.c

index 475ad86b5885b8a77cd13b4df0bdc207b8aee312..03f2104835ff46463fb12dee2614a65d115a7536 100644 (file)
@@ -227,6 +227,11 @@ DEFPY(pbr_map_nexthop, pbr_map_nexthop_cmd,
        memset(&nhop, 0, sizeof(nhop));
        nhop.vrf_id = vrf->vrf_id;
 
+       /*
+        * Make SA happy.  CLIPPY is not going to give us a NULL
+        * addr.
+        */
+       assert(addr);
        if (addr->sa.sa_family == AF_INET) {
                nhop.gate.ipv4.s_addr = addr->sin.sin_addr.s_addr;
                if (intf) {
index 4e5b5f3dde90d1142a59935b77251190063f53b8..bc7dd2083213916b08d483741e65bec8795d5357 100644 (file)
@@ -60,7 +60,8 @@ struct pbr_interface *pbr_if_new(struct interface *ifp)
                return 0;
        }
 
-       return (pbr_ifp);
+       ifp->info = pbr_ifp;
+       return pbr_ifp;
 }
 
 /* Inteface addition message from zebra. */
@@ -74,12 +75,8 @@ static int interface_add(int command, struct zclient *zclient,
        if (!ifp)
                return 0;
 
-       if (!ifp->info) {
-               struct pbr_interface *pbr_ifp;
-
-               pbr_ifp = pbr_if_new(ifp);
-               ifp->info = pbr_ifp;
-       }
+       if (!ifp->info)
+               pbr_if_new(ifp);
 
        return 0;
 }
@@ -494,7 +491,7 @@ void pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
 {
        struct pbr_map *pbrm = pbrms->parent;
        struct stream *s;
-       uint64_t is_installed = 1 << pmi->install_bit;
+       uint64_t is_installed = (uint64_t)1 << pmi->install_bit;
 
        is_installed &= pbrms->installed;