summaryrefslogtreecommitdiffstats
path: root/pbrd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-04-20 16:18:47 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-04-24 04:09:33 +0200
commit10a00758a76956be734353caf0a88205de51009f (patch)
tree02ecd56a35ee3892896a9e936e692a94c2415349 /pbrd
parentMerge pull request #2111 from mjstapp/zmq_sockopt (diff)
downloadfrr-10a00758a76956be734353caf0a88205de51009f.tar.xz
frr-10a00758a76956be734353caf0a88205de51009f.zip
pbrd: Fix a couple SA issues
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>
Diffstat (limited to 'pbrd')
-rw-r--r--pbrd/pbr_vty.c5
-rw-r--r--pbrd/pbr_zebra.c13
2 files changed, 10 insertions, 8 deletions
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index 475ad86b5..03f210483 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -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) {
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c
index 4e5b5f3dd..bc7dd2083 100644
--- a/pbrd/pbr_zebra.c
+++ b/pbrd/pbr_zebra.c
@@ -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;