diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-07-09 17:10:49 +0200 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-07-09 17:30:49 +0200 |
commit | 822c9af2302e4e53708a169513ddfc6de755c69e (patch) | |
tree | 522ac49aa8086f301920fddac9df9432f2ed3a1b | |
parent | Merge pull request #4655 from qlyoung/fix-vrrp-iface-del-infiniteloop (diff) | |
download | frr-822c9af2302e4e53708a169513ddfc6de755c69e.tar.xz frr-822c9af2302e4e53708a169513ddfc6de755c69e.zip |
zebra: Add a conditional guard if zvrf lookup fail
Add a conditional to guard against segfaulting on the debug
statement when zvrf lookup fails.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
-rw-r--r-- | zebra/rt_netlink.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index f951738b7..b1d0c1e3a 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -811,7 +811,9 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h, } if (IS_ZEBRA_DEBUG_KERNEL) { - struct interface *ifp; + struct interface *ifp = NULL; + struct zebra_vrf *zvrf = NULL; + strlcpy(sbuf, inet_ntoa(m->sg.src), sizeof(sbuf)); strlcpy(gbuf, inet_ntoa(m->sg.grp), sizeof(gbuf)); for (count = 0; count < oif_count; count++) { @@ -822,13 +824,14 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h, oif[count]); strlcat(oif_list, temp, sizeof(oif_list)); } - struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(vrf); + zvrf = zebra_vrf_lookup_by_id(vrf); ifp = if_lookup_by_index(iif, vrf); - zlog_debug("MCAST VRF: %s(%d) %s (%s,%s) IIF: %s(%d) OIF: %s jiffies: %lld", - zvrf->vrf->name, vrf, - nl_msg_type_to_str(h->nlmsg_type), - sbuf, gbuf, ifp ? ifp->name : "Unknown", iif, - oif_list, m->lastused); + zlog_debug( + "MCAST VRF: %s(%d) %s (%s,%s) IIF: %s(%d) OIF: %s jiffies: %lld", + (zvrf ? zvrf->vrf->name : "Unknown"), vrf, + nl_msg_type_to_str(h->nlmsg_type), sbuf, gbuf, + ifp ? ifp->name : "Unknown", iif, oif_list, + m->lastused); } return 0; } |