Skip to content

Commit 15de6ba

Browse files
congwangkuba-moo
authored andcommitted
selftests/bpf: Add a specific dst port matching
After this patch: #102/1 flow_dissector_classification/ipv4:OK #102/2 flow_dissector_classification/ipv4_continue_dissect:OK #102/3 flow_dissector_classification/ipip:OK #102/4 flow_dissector_classification/gre:OK #102/5 flow_dissector_classification/port_range:OK #102/6 flow_dissector_classification/ipv6:OK #102 flow_dissector_classification:OK Summary: 1/6 PASSED, 0 SKIPPED, 0 FAILED Cc: Daniel Borkmann <[email protected]> Cc: Andrii Nakryiko <[email protected]> Signed-off-by: Cong Wang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 69ab34f commit 15de6ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,15 +542,20 @@ static void detach_program(struct bpf_flow *skel, int prog_fd)
542542

543543
static int set_port_drop(int pf, bool multi_port)
544544
{
545+
char dst_port[16];
546+
547+
snprintf(dst_port, sizeof(dst_port), "%d", CFG_PORT_INNER);
548+
545549
SYS(fail, "tc qdisc add dev lo ingress");
546-
SYS(fail_delete_qdisc, "tc filter add %s %s %s %s %s %s %s %s %s %s",
550+
SYS(fail_delete_qdisc, "tc filter add %s %s %s %s %s %s %s %s %s %s %s %s",
547551
"dev lo",
548552
"parent FFFF:",
549553
"protocol", pf == PF_INET6 ? "ipv6" : "ip",
550554
"pref 1337",
551555
"flower",
552556
"ip_proto udp",
553557
"src_port", multi_port ? "8-10" : "9",
558+
"dst_port", dst_port,
554559
"action drop");
555560
return 0;
556561

0 commit comments

Comments
 (0)