Skip to content

Commit 5f103c5

Browse files
jrfastabborkmann
authored andcommitted
bpf: only build sockmap with CONFIG_INET
The sockmap infrastructure is only aware of TCP sockets at the moment. In the future we plan to add UDP. In both cases CONFIG_NET should be built-in. So lets only build sockmap if CONFIG_INET is enabled. Signed-off-by: John Fastabend <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent c20a71a commit 5f103c5

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

include/linux/bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static inline bool bpf_prog_is_dev_bound(struct bpf_prog_aux *aux)
554554
}
555555
#endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */
556556

557-
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL)
557+
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_INET)
558558
struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key);
559559
int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type);
560560
#else

include/linux/bpf_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops)
4242
BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
4343
#ifdef CONFIG_NET
4444
BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
45-
#ifdef CONFIG_STREAM_PARSER
45+
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_INET)
4646
BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)
4747
#endif
4848
BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)

kernel/bpf/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ obj-$(CONFIG_BPF_SYSCALL) += devmap.o
99
obj-$(CONFIG_BPF_SYSCALL) += cpumap.o
1010
obj-$(CONFIG_BPF_SYSCALL) += offload.o
1111
ifeq ($(CONFIG_STREAM_PARSER),y)
12+
ifeq ($(CONFIG_INET),y)
1213
obj-$(CONFIG_BPF_SYSCALL) += sockmap.o
1314
endif
1415
endif
16+
endif
1517
ifeq ($(CONFIG_PERF_EVENTS),y)
1618
obj-$(CONFIG_BPF_SYSCALL) += stackmap.o
1719
endif

0 commit comments

Comments
 (0)