summaryrefslogtreecommitdiff
path: root/pimd/pim_static.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-01-25 11:57:09 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-01-25 12:07:02 -0500
commit04b6c83d56688355d7998ae24d101d8ccab4e98f (patch)
treecd7498e0fb03e1785f47f35d5ecdeb9e41f4cb6b /pimd/pim_static.c
parent761d8b29dd300936ec84af371b32f4cc1040f822 (diff)
pimd: Prevent crash from using pim static mroutes
If you have an interface being added to a static mroute and that interface has been configured w/ pim but does not have a valid ip address yet, we do not create a VIF for that device yet. As such when we attempt to assign the vif array in the pim static data structure we attempt to write into -1 of that array. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_static.c')
-rw-r--r--pimd/pim_static.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pimd/pim_static.c b/pimd/pim_static.c
index 7334353c37..f7f6ea17c1 100644
--- a/pimd/pim_static.c
+++ b/pimd/pim_static.c
@@ -76,7 +76,7 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
ifindex_t iif_index = pim_iif ? pim_iif->mroute_vif_index : 0;
ifindex_t oif_index = pim_oif ? pim_oif->mroute_vif_index : 0;
- if (!iif_index || !oif_index) {
+ if (!iif_index || !oif_index || iif_index == -1 || oif_index == -1) {
zlog_warn(
"%s %s: Unable to add static route: Invalid interface index(iif=%d,oif=%d)",
__FILE__, __PRETTY_FUNCTION__, iif_index, oif_index);