selftests/bpf: add missing header include for htons
Subsystems (3)
PATCH 1/1 selftests/bpf: add missing header include for htons
Including the network_helpers.h header in tests can lead to the following build error:
./network_helpers.h: In function ‘csum_tcpudp_magic’:
./network_helpers.h:116:14: error: implicit declaration of function \
‘htons’ [-Werror=implicit-function-declaration]
116 | s += htons(proto + len);
The error is avoided in many cases thanks to some other headers included earlier and bringing in arpa/inet.h (ie: test_progs.h).
Make sure that test_progs build success does not depend on header ordering by adding the missing header include in network_helpers.h
--- tools/testing/selftests/bpf/network_helpers.h | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/network_helpers.h +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __NETWORK_HELPERS_H#define __NETWORK_HELPERS_H +#include <arpa/inet.h> #include <sys/socket.h> #include <sys/types.h> #include <linux/types.h>
---
base-commit: 67a7c7b656cfc10a7280f71641fb9e88726e8a5d
change-id: 20241008-network_helpers_fix-bbb7d1589930
Best regards,
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
This patch was applied to bpf/bpf-next.git (net) by Martin KaFai Lau <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (net)
by Martin KaFai Lau <[email protected]>:
Quoted 9 lines · On Tue, 08 Oct 2024 16:50:57 +0200 you wrote:
Including the
network_helpers.hheader in tests can lead to the following build error:./network_helpers.h: In function ‘csum_tcpudp_magic’:
./network_helpers.h:116:14: error: implicit declaration of function \
‘htons’ [-Werror=implicit-function-declaration]
116 | s += htons(proto + len);[...]
Here is the summary with links:
- [bpf] selftests/bpf: add missing header include for htons
https://git.kernel.org/bpf/bpf-next/c/bc9b3fb827fc
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html