From 553dbdbf8e56c7162598908f7c53a6e020248a09 Mon Sep 17 00:00:00 2001 From: LEI BAO Date: Fri, 5 Nov 2021 14:05:36 +0800 Subject: [PATCH] zebra: Fix the RA send failed in netns mode In the rtadv_timer(), it always uses the zvrf's socket to send RA packets. In the vrf-lite mode, it's righ since it uses the default vrf to send the RA packets. But in the netns mode, it uses socket in each netns. So the issue only happens in the netns mode because the zvrf's socket may not be in the same netns as the interface's netns. In order to compatible with both vrf-lite and netns mode, the fix uses the if_lookup_by_index() to check whether interfaces can use the zvrf's socket. Signed-off-by: LEI BAO --- zebra/rtadv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 4c5b320ae0..a15d78f64b 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -494,7 +494,7 @@ static int rtadv_timer(struct thread *thread) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) FOR_ALL_INTERFACES (vrf, ifp) { if (if_is_loopback_or_vrf(ifp) || !if_is_operative(ifp) - || ifp->vrf_id != zvrf->vrf->vrf_id) + || if_lookup_by_index(ifp->ifindex, zvrf->vrf->vrf_id) == NULL) continue; zif = ifp->info; -- 2.39.5