From aa4e1f5032f2b273e992bd2ebf3c7e787ede0882 Mon Sep 17 00:00:00 2001 From: Tomi Salminen Date: Wed, 13 Dec 2023 11:37:21 +0200 Subject: [PATCH] zebra: Fix crash on macvlan link down/up Whenever a link up change was detected on a macvlan device where the linked device wasn't visible in the namespace zebra was running in, the linked zebra interface was NULL. This was already handled in the event of a link down, but was ommitted from the upside. Added the same null check to the up-side. Signed-off-by: Tomi Salminen (cherry picked from commit bdf6a9ba810b58146371e8a0000397d2ae9ea956) --- zebra/zebra_vxlan.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 64eae38fc9ba..2ffaefd1d5c0 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -5163,6 +5163,15 @@ void zebra_vxlan_macvlan_up(struct interface *ifp) return; link_ifp = zif->link; + if (!link_ifp) { + if (IS_ZEBRA_DEBUG_VXLAN) + zlog_debug( + "macvlan parent link is not found. Parent index %d ifp %s", + zif->link_ifindex, + ifindex2ifname(zif->link_ifindex, + ifp->vrf->vrf_id)); + return; + } link_zif = link_ifp->info; assert(link_zif);