Skip to content

Commit

Permalink
selftests/bpf: Add selftests for netkit
Browse files Browse the repository at this point in the history
Add a bigger batch of test coverage to assert correct operation of
netkit devices and their BPF program management:

  # ./test_progs -t tc_netkit
  [...]
  [    1.166267] bpf_testmod: loading out-of-tree module taints kernel.
  [    1.166831] bpf_testmod: module verification failed: signature and/or required key missing - tainting kernel
  [    1.270957] tsc: Refined TSC clocksource calibration: 3407.988 MHz
  [    1.272579] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x311fc932722, max_idle_ns: 440795381586 ns
  [    1.275336] clocksource: Switched to clocksource tsc
  torvalds#257     tc_netkit_basic:OK
  torvalds#258     tc_netkit_device:OK
  torvalds#259     tc_netkit_multi_links:OK
  torvalds#260     tc_netkit_multi_opts:OK
  torvalds#261     tc_netkit_neigh_links:OK
  Summary: 5/0 PASSED, 0 SKIPPED, 0 FAILED
  [...]

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
borkmann committed Oct 23, 2023
1 parent d3341c2 commit c7cfa1f
Show file tree
Hide file tree
Showing 4 changed files with 705 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/config
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ CONFIG_NETFILTER_SYNPROXY=y
CONFIG_NETFILTER_XT_CONNMARK=y
CONFIG_NETFILTER_XT_MATCH_STATE=y
CONFIG_NETFILTER_XT_TARGET_CT=y
CONFIG_NETKIT=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_DEFRAG_IPV4=y
Expand Down
4 changes: 4 additions & 0 deletions tools/testing/selftests/bpf/prog_tests/tc_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#define TC_HELPERS
#include <test_progs.h>

#ifndef loopback
# define loopback 1
#endif

static inline __u32 id_from_prog_fd(int fd)
{
struct bpf_prog_info prog_info = {};
Expand Down
Loading

0 comments on commit c7cfa1f

Please sign in to comment.