Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: fix crash when macvlan link-interface is in another netns #15399

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

louis-6wind
Copy link
Contributor

@louis-6wind louis-6wind commented Feb 20, 2024

A macvlan interface can have its underlying link-interface in another
namespace (aka. netns). However, by default, zebra does not know the
interface from the other namespaces. It results in a crash the pointer
to the link interface is NULL.

6 0x0000559d77a329d3 in zebra_vxlan_macvlan_up (ifp=0x559d798b8e00) at /root/frr/zebra/zebra_vxlan.c:4676
4676 link_zif = link_ifp->info;
(gdb) list
4671 struct interface *link_ifp, *link_if;
4672
4673 zif = ifp->info;
4674 assert(zif);
4675 link_ifp = zif->link;
4676 link_zif = link_ifp->info;
4677 assert(link_zif);
4678
(gdb) p zif->link
$2 = (struct interface *) 0x0
(gdb) p zif->link_ifindex
$3 = 15

Fix the crash by returning when the macvlan link-interface is in another
namespace. No need to go further because any vxlan under the macvlan
interface would not be accessible by zebra.

Closes #15370

@louis-6wind
Copy link
Contributor Author

ci:rerun

A macvlan interface can have its underlying link-interface in another
namespace (aka. netns). However, by default, zebra does not know the
interface from the other namespaces. It results in a crash the pointer
to the link interface is NULL.

> 6  0x0000559d77a329d3 in zebra_vxlan_macvlan_up (ifp=0x559d798b8e00) at /root/frr/zebra/zebra_vxlan.c:4676
> 4676		link_zif = link_ifp->info;
> (gdb) list
> 4671		struct interface *link_ifp, *link_if;
> 4672
> 4673		zif = ifp->info;
> 4674		assert(zif);
> 4675		link_ifp = zif->link;
> 4676		link_zif = link_ifp->info;
> 4677		assert(link_zif);
> 4678
> (gdb) p zif->link
> $2 = (struct interface *) 0x0
> (gdb) p zif->link_ifindex
> $3 = 15

Fix the crash by returning when the macvlan link-interface is in another
namespace. No need to go further because any vxlan under the macvlan
interface would not be accessible by zebra.

Link: FRRouting#15370
Signed-off-by: Louis Scalbert <[email protected]>
@louis-6wind louis-6wind changed the title zebra: fix crash if macvlan link-interface invalid zebra: fix crash if macvlan link in another netns Feb 21, 2024
@louis-6wind louis-6wind changed the title zebra: fix crash if macvlan link in another netns zebra: fix crash when macvlan link-interface is in another netns Feb 21, 2024
@louis-6wind
Copy link
Contributor Author

ci:rerun

@ton31337 ton31337 added this to the 10.0 milestone Feb 23, 2024
@ton31337
Copy link
Member

@Mergifyio backport dev/10.0 stable/9.1 stable/9.0 stable/8.5

Copy link

mergify bot commented Feb 23, 2024

backport dev/10.0 stable/9.1 stable/9.0 stable/8.5

✅ Backports have been created

@ton31337 ton31337 merged commit c27fc65 into FRRouting:master Feb 27, 2024
9 checks passed
riw777 added a commit that referenced this pull request Feb 27, 2024
zebra: fix crash when macvlan link-interface is in another netns (backport #15399)
riw777 added a commit that referenced this pull request Feb 27, 2024
zebra: fix crash when macvlan link-interface is in another netns (backport #15399)
riw777 added a commit that referenced this pull request Feb 27, 2024
zebra: fix crash when macvlan link-interface is in another netns (backport #15399)
riw777 added a commit that referenced this pull request Feb 27, 2024
zebra: fix crash when macvlan link-interface is in another netns (backport #15399)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FRR crash using macvlan interface in a lxc/lxd/incus container
2 participants