-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
BPF: fix missing "break" in nat46 switch, and minor cleanup #11410
Conversation
test-me-please |
restart-ginkgo |
Just given that BPF backports are a bit painful (particularly due to bpf.sha update and other areas), and that no user is reporting any issue, I wonder if we should just restrict this to v1.7. For reference, here's the criteria for backports: |
Looks like I broke |
Thanks for the pointer to the criteria. Ok, agreed, I'll remove the labels for older versions. |
There are missing "break" keywords in the switch statement to process the different ICMPv6 message types. Let's add them. Indirectly reported by cppcheck which would complain that icmp4.code would be overwritten before being read (which happens indeed if we fall through). Fixes: f7396ba ("Add support for nat46 icmp translation.") Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Fix minor issues in the BPF code. Namely: - Use "void" to tell functions take no argument in their declaration, instead of non-ANSI empty parenthesis. - Remove an unused "ret" variable. - Fix format specifiers for sscanf() and fprintf(). - Remove a useless variable increment. - Compile out some code in bpf_sockops.c if ENABLE_IPV4 is not defined. These issues were reported by various code analyzers. Signed-off-by: Quentin Monnet <quentin@isovalent.com>
5646864
to
03a1755
Compare
test-me-please Incremental diffdiff --git a/bpf/cilium-map-migrate.c b/bpf/cilium-map-migrate.c
index ded8eef9b33a..f47259684d40 100644
--- a/bpf/cilium-map-migrate.c
+++ b/bpf/cilium-map-migrate.c
@@ -278,7 +278,7 @@ static int bpf_derive_elf_map_from_fdinfo(int fd, struct bpf_elf_map *map)
map->size_value = val;
else if (sscanf(buff, "max_entries:\t%u", &val) == 1)
map->max_elem = val;
- else if (sscanf(buff, "map_flags:\t%u", &val) == 1)
+ else if (sscanf(buff, "map_flags:\t%x", &val) == 1)
map->flags = val;
}
|
... then timeout. restart-ginkgo |
restart-ginkgo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@qmonnet Please note that the commit you refer as first is the second one in GitHub's API. I haven't checked the actual git order, but it's possible GitHub gets confused because you reordered commits at some point.
EDIT: Out of curiosity: which tool found the missing break
s?
Git history has it first, and indeed I reordered them before pushing and GitHub seems to use commit creation date. I try to reset the date before pushing, but forgot this time. Thanks for the note!
From commit log 😛:
|
While the work on checkers/static analysers for BPF code is still in progress, here are a few fixes for issues already reported by some of the tools I've been trying.
The first commit adds missing
break
keywords in a switch statement in NAT46. The bug is present since version 0.8.0, but it only concerns ICMPv6 handling and probably has a low impact. In doubt, I'm marking this commit for backport on 1.7.The second patch is trivial fixes at various places in the BPF code. This second commit does not need to be backported.