Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
libbpftune: fix bpftune_netns_info() checks when searching for netns …
…cookie

netns cookie check does not verify cookie is the one we are looking for;
this means we match first cookie we find and misapply changes when
multiple netns are in place.

Reported-by: Roger Knobbe <https://github.com/rknobbe>
Signed-off-by: Alan Maguire <[email protected]>
  • Loading branch information
alan-maguire committed Nov 28, 2024
commit e03edfc99235b448bd577e4afb02fd3e8404b3cc
3 changes: 2 additions & 1 deletion src/libbpftune.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,8 @@ static int bpftune_netns_find(unsigned long cookie)
mntfd = open(ent->mnt_dir, O_RDONLY);
if (mntfd < 0)
continue;
if (bpftune_netns_info(0, &mntfd, &netns_cookie)) {
if (bpftune_netns_info(0, &mntfd, &netns_cookie) ||
(cookie && netns_cookie != cookie)) {
close(mntfd);
continue;
}
Expand Down