Skip to content
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

Add basic tests for VLAN #482

Merged
merged 4 commits into from
Feb 6, 2025
Merged

Add basic tests for VLAN #482

merged 4 commits into from
Feb 6, 2025

Conversation

andreaskaris
Copy link
Contributor

@andreaskaris andreaskaris commented Jan 22, 2025

Fixes #479

How to test:

cd tests
python3 -m flake8 && python3 -m pytest test_skb.py

Also fixed the issue that can be seen in:
https://cirrus-ci.com/task/6381925075517440?logs=up#L717

image

that issue didn't block the CI lane but nevertheless caused an error when bringing up the centos8 vagrant box

@andreaskaris andreaskaris marked this pull request as draft January 22, 2025 19:21
@andreaskaris andreaskaris force-pushed the issue479 branch 3 times, most recently from 45d89e3 to 3665cc7 Compare January 22, 2025 19:32
@atenart
Copy link
Contributor

atenart commented Jan 23, 2025

@andreaskaris runtime CI tests are triggered only if a PR has the run-functional-tests set. Do you want me to set it here?

@amorenoz amorenoz added the run-functional-tests Request functional tests to be run by CI label Jan 23, 2025
@amorenoz
Copy link
Contributor

Done, thanks.

@andreaskaris andreaskaris force-pushed the issue479 branch 2 times, most recently from 934b1f9 to 1178ff3 Compare January 27, 2025 19:49
@andreaskaris
Copy link
Contributor Author

todo: still need to fix the rhel8/centos8 case

@andreaskaris andreaskaris force-pushed the issue479 branch 3 times, most recently from 4e3a540 to b877685 Compare January 29, 2025 17:58
@andreaskaris andreaskaris changed the title WIP: Add basic tests for VLAN Add basic tests for VLAN Jan 29, 2025
@andreaskaris andreaskaris marked this pull request as ready for review January 29, 2025 17:59
@andreaskaris
Copy link
Contributor Author

@atenart @vlrpl This is ready for review :-)

Vagrantfile Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
retis/src/module/skb/bpf/include/if_vlan.h Outdated Show resolved Hide resolved
@andreaskaris andreaskaris force-pushed the issue479 branch 2 times, most recently from 79217ef to 10c11d1 Compare February 5, 2025 16:11
There have been various changes over the years in the kernel: The kernel uses
skb_vlan_tag_present which either relies on vlan_present or on vlan_all or
the DEI/CFI bit depending on the kernel version.
See:
* commit 354259fa73e2aac92ae5e19522adb69a92c15b49
* commit 0c4b2d370514cb4f3454dd3b18f031d2651fab73

Signed-off-by: Andreas Karis <[email protected]>
After installing centos-release-nfv-openvswitch, outdated entries must
be updated from mirror.centos.org to vault.centos.org

Signed-off-by: Andreas Karis <[email protected]>
@andreaskaris
Copy link
Contributor Author

andreaskaris commented Feb 5, 2025

The rawhide issue is new but must come from a change in rawhide. When I ran this last, all was o.k - also, I checked out before my VLAN modifications and get the same issue:

[root@cno vagrant]# ./target/debug/retis -p generic collect -f "icmp" --skb-sections all -o --print
Applying profile generic
L2+L3 packet filter(s) loaded
WARN  libbpf: prog 'probe_raw_tracepoint': BPF program load failed: No such file or directory
WARN  libbpf: prog 'probe_raw_tracepoint': -- BEGIN PROG LOAD LOG --
0: R1=ctx() R10=fp0
; int probe_raw_tracepoint(struct bpf_raw_tracepoint_args *ctx) @ raw_tracepoint.bpf.c:45
0: (bf) r6 = r1                       ; R1=ctx() R6_w=ctx()
1: (b7) r1 = 0                        ; R1_w=0
; struct retis_context context = {}; @ raw_tracepoint.bpf.c:47
2: (7b) *(u64 *)(r10 -120) = r1       ; R1_w=0 R10=fp0 fp-120_w=0
3: (7b) *(u64 *)(r10 -128) = r1       ; R1_w=0 R10=fp0 fp-128_w=0
4: (7b) *(u64 *)(r10 -136) = r1       ; R1_w=0 R10=fp0 fp-136_w=0
5: (7b) *(u64 *)(r10 -144) = r1       ; R1_w=0 R10=fp0 fp-144_w=0
6: (7b) *(u64 *)(r10 -152) = r1       ; R1_w=0 R10=fp0 fp-152_w=0
7: (7b) *(u64 *)(r10 -160) = r1       ; R1_w=0 R10=fp0 fp-160_w=0
8: (7b) *(u64 *)(r10 -168) = r1       ; R1_w=0 R10=fp0 fp-168_w=0
9: (7b) *(u64 *)(r10 -176) = r1       ; R1_w=0 R10=fp0 fp-176_w=0
10: (7b) *(u64 *)(r10 -184) = r1      ; R1_w=0 R10=fp0 fp-184_w=0
11: (7b) *(u64 *)(r10 -192) = r1      ; R1_w=0 R10=fp0 fp-192_w=0
12: (7b) *(u64 *)(r10 -200) = r1      ; R1_w=0 R10=fp0 fp-200_w=0
13: (7b) *(u64 *)(r10 -208) = r1      ; R1_w=0 R10=fp0 fp-208_w=0
14: (7b) *(u64 *)(r10 -216) = r1      ; R1_w=0 R10=fp0 fp-216_w=0
15: (7b) *(u64 *)(r10 -224) = r1      ; R1_w=0 R10=fp0 fp-224_w=0
16: (7b) *(u64 *)(r10 -232) = r1      ; R1_w=0 R10=fp0 fp-232_w=0
17: (7b) *(u64 *)(r10 -240) = r1      ; R1_w=0 R10=fp0 fp-240_w=0
18: (7b) *(u64 *)(r10 -248) = r1      ; R1_w=0 R10=fp0 fp-248_w=0
19: (7b) *(u64 *)(r10 -256) = r1      ; R1_w=0 R10=fp0 fp-256_w=0
20: (7b) *(u64 *)(r10 -264) = r1      ; R1_w=0 R10=fp0 fp-264_w=0
21: (7b) *(u64 *)(r10 -272) = r1      ; R1_w=0 R10=fp0 fp-272_w=0
; context.timestamp = bpf_ktime_get_ns(); @ raw_tracepoint.bpf.c:49
22: (85) call bpf_ktime_get_ns#5      ; R0_w=scalar()
23: (7b) *(u64 *)(r10 -264) = r0      ; R0_w=scalar(id=1) R10=fp0 fp-264_w=scalar(id=1)
; context.orig_ctx = ctx; @ raw_tracepoint.bpf.c:52
24: (7b) *(u64 *)(r10 -128) = r6      ; R6_w=ctx() R10=fp0 fp-128_w=ctx()
25: (b7) r1 = 2                       ; R1_w=2
; context.probe_type = KERNEL_PROBE_TRACEPOINT; @ raw_tracepoint.bpf.c:51
26: (63) *(u32 *)(r10 -272) = r1      ; R1_w=2 R10=fp0 fp-272_w=mmmm2
; context.ksym = ksym; @ raw_tracepoint.bpf.c:50
27: (18) r1 = 0xffffb0768473a010      ; R1_w=map_value(map=raw_trac.rodata,ks=4,vs=318,off=16)
29: (79) r1 = *(u64 *)(r1 +0)         ; R1_w=0xffffffffb4c14940
30: (7b) *(u64 *)(r10 -256) = r1      ; R1_w=0xffffffffb4c14940 R10=fp0 fp-256_w=0xffffffffb4c14940
; if (!nargs) @ raw_tracepoint.bpf.c:23
31: (18) r1 = 0xffffb0768473a018      ; R1_w=map_value(map=raw_trac.rodata,ks=4,vs=318,off=24)
33: (61) r2 = *(u32 *)(r1 +0)         ; R1_w=map_value(map=raw_trac.rodata,ks=4,vs=318,off=24) R2_w=4
34: (15) if r2 == 0x0 goto pc+47      ; R2_w=4
; switch (nargs - 1) { @ raw_tracepoint.bpf.c:26
35: (61) r1 = *(u32 *)(r1 +0)         ; R1=4
36: (65) if r1 s> 0x6 goto pc+5       ; R1=4
37: (65) if r1 s> 0x3 goto pc+9       ; R1=4
47: (15) if r1 == 0x4 goto pc+22      ; R1=4
; arg_case(3) @ raw_tracepoint.bpf.c:35
70: (79) r1 = *(u64 *)(r6 +24)        ; R1_w=scalar() R6=ctx()
71: (7b) *(u64 *)(r10 -216) = r1      ; R1_w=scalar(id=2) R10=fp0 fp-216_w=scalar(id=2)
; arg_case(2) @ raw_tracepoint.bpf.c:36
72: (79) r1 = *(u64 *)(r6 +16)        ; R1_w=scalar() R6=ctx()
73: (7b) *(u64 *)(r10 -224) = r1      ; R1_w=scalar(id=3) R10=fp0 fp-224_w=scalar(id=3)
; arg_case(1) @ raw_tracepoint.bpf.c:37
74: (79) r1 = *(u64 *)(r6 +8)         ; R1_w=scalar() R6=ctx()
75: (7b) *(u64 *)(r10 -232) = r1      ; R1=scalar(id=4) R10=fp0 fp-232=scalar(id=4)
; arg_case(0) @ raw_tracepoint.bpf.c:38
76: (79) r1 = *(u64 *)(r6 +0)         ; R1_w=scalar() R6=ctx()
77: (7b) *(u64 *)(r10 -240) = r1      ; R1_w=scalar(id=5) R10=fp0 fp-240_w=scalar(id=5)
; regs->num = nargs; @ raw_tracepoint.bpf.c:41
78: (18) r1 = 0xffffb0768473a018      ; R1_w=map_value(map=raw_trac.rodata,ks=4,vs=318,off=24)
80: (61) r1 = *(u32 *)(r1 +0)         ; R1_w=4
81: (63) *(u32 *)(r10 -136) = r1      ; R1_w=4 R10=fp0 fp-136=mmmm4
; if (unlikely(!enabled)) { @ common.h:219
82: (18) r1 = 0xffff8d91c106fd08      ; R1_w=map_value(map=raw_trac.bss,ks=4,vs=1)
84: (71) r1 = *(u8 *)(r1 +0)          ; R1_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff))
85: (55) if r1 != 0x0 goto pc+21      ; R1_w=0
86: (b7) r1 = 0                       ; R1_w=0
; u8 key = 0; @ common_defs.h:42
87: (73) *(u8 *)(r10 -96) = r1        ; R1_w=0 R10=fp0 fp-96=???????0
88: (bf) r2 = r10                     ; R2_w=fp0 R10=fp0
89: (07) r2 += -96                    ; R2_w=fp-96
; cfg = bpf_map_lookup_elem(&global_config_map, &key); @ common_defs.h:44
90: (18) r1 = 0xffff8d91c1933400      ; R1_w=map_ptr(map=global_config_m,ks=1,vs=1)
92: (85) call bpf_map_lookup_elem#1   ; R0=map_value_or_null(id=6,map=global_config_m,ks=1,vs=1)
; return cfg && !!cfg->enabled; @ common_defs.h:45
93: (55) if r0 != 0x0 goto pc+5 99: R0=map_value(map=global_config_m,ks=1,vs=1) R6=ctx() R10=fp0 fp-96=???????0 fp-120=0 fp-128=ctx() fp-136=mmmm4 fp-144=0 fp-152=0 fp-160=0 fp-168=0 fp-176=0 fp-184=0 fp-192=0 fp-200=0 fp-208=0 fp-216=scalar(id=2) fp-224=scalar(id=3) fp-232=scalar(id=4) fp-240=scalar(id=5) fp-248=0 fp-256=0xffffffffb4c14940 fp-264=scalar(id=1) fp-272=mmmm2
; return cfg && !!cfg->enabled; @ common_defs.h:45
99: (71) r1 = *(u8 *)(r0 +0)          ; R0=map_value(map=global_config_m,ks=1,vs=1) R1_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff))
100: (b7) r2 = 1                      ; R2=1
101: (55) if r1 != 0x0 goto pc+1 103: R0=map_value(map=global_config_m,ks=1,vs=1) R1=scalar(smin=umin=smin32=umin32=1,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff)) R2=1 R6=ctx() R10=fp0 fp-96=???????0 fp-120=0 fp-128=ctx() fp-136=mmmm4 fp-144=0 fp-152=0 fp-160=0 fp-168=0 fp-176=0 fp-184=0 fp-192=0 fp-200=0 fp-208=0 fp-216=scalar(id=2) fp-224=scalar(id=3) fp-232=scalar(id=4) fp-240=scalar(id=5) fp-248=0 fp-256=0xffffffffb4c14940 fp-264=scalar(id=1) fp-272=mmmm2
; enabled = collection_enabled(); @ common.h:220
103: (18) r3 = 0xffff8d91c106fd08     ; R3_w=map_value(map=raw_trac.bss,ks=4,vs=1)
105: (73) *(u8 *)(r3 +0) = r2         ; R2=1 R3=map_value(map=raw_trac.bss,ks=4,vs=1)
; if (!enabled) @ common.h:221
106: (15) if r1 == 0x0 goto pc+9501   ; R1=scalar(smin=umin=smin32=umin32=1,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff))
107: (bf) r2 = r10                    ; R2_w=fp0 R10=fp0
108: (07) r2 += -256                  ; R2_w=fp-256
; cfg = bpf_map_lookup_elem(&config_map, &ctx->ksym); @ common.h:225
109: (18) r1 = 0xffff8d91c1933c00     ; R1_w=map_ptr(map=config_map,ks=8,vs=7)
111: (85) call bpf_map_lookup_elem#1
processed 80 insns (limit 1000000) max_states_per_insn 0 total_states 5 peak_states 5 mark_read 5
-- END PROG LOAD LOG --
WARN  libbpf: prog 'probe_raw_tracepoint': failed to load: -2
WARN  libbpf: failed to load object 'raw_tracepoint_bpf'
WARN  libbpf: failed to load BPF skeleton 'raw_tracepoint_bpf': -2
Error: No such file or directory (os error 2)

created: #490

@atenart
Copy link
Contributor

atenart commented Feb 6, 2025

The rawhide issue is new but must come from a change in rawhide. When I ran this last, all was o.k - also, I checked out before my VLAN modifications and get the same issue:

created: #490

So this appeared to be a known kernel issue in recent kernels. Let's just ignore the Rawhide CI result here.

@andreaskaris andreaskaris force-pushed the issue479 branch 4 times, most recently from 4641090 to 75d0a45 Compare February 6, 2025 13:55
Signed-off-by: Andreas Karis <[email protected]>
Copy link
Contributor

@atenart atenart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for working on the CI it's always very much appreciated!

Note: the Rawhide test is failing because of #490.

@atenart atenart merged commit b228ed1 into retis-org:main Feb 6, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-functional-tests Request functional tests to be run by CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

write tests for vlan feature
3 participants