Skip to content

Commit 75860b5

Browse files
author
Alexei Starovoitov
committed
selftests/bpf: Workaround for older vm_sockets.h.
Some distros ship with older vm_sockets.h that doesn't have VMADDR_CID_LOCAL which causes selftests build to fail: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c:261:18: error: ‘VMADDR_CID_LOCAL’ undeclared (first use in this function); did you mean ‘VMADDR_CID_HOST’? 261 | addr->svm_cid = VMADDR_CID_LOCAL; | ^~~~~~~~~~~~~~~~ | VMADDR_CID_HOST Workaround this issue by defining it on demand. Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent c04135a commit 75860b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/testing/selftests/bpf/prog_tests/sockmap_listen.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#include <unistd.h>
2121
#include <linux/vm_sockets.h>
2222

23+
/* workaround for older vm_sockets.h */
24+
#ifndef VMADDR_CID_LOCAL
25+
#define VMADDR_CID_LOCAL 1
26+
#endif
27+
2328
#include <bpf/bpf.h>
2429
#include <bpf/libbpf.h>
2530

0 commit comments

Comments
 (0)