Skip to content

Commit

Permalink
selftests/bpf: Add a specific dst port matching
Browse files Browse the repository at this point in the history
After this patch:

 torvalds#102/1   flow_dissector_classification/ipv4:OK
 torvalds#102/2   flow_dissector_classification/ipv4_continue_dissect:OK
 torvalds#102/3   flow_dissector_classification/ipip:OK
 torvalds#102/4   flow_dissector_classification/gre:OK
 torvalds#102/5   flow_dissector_classification/port_range:OK
 torvalds#102/6   flow_dissector_classification/ipv6:OK
 torvalds#102     flow_dissector_classification:OK
 Summary: 1/6 PASSED, 0 SKIPPED, 0 FAILED

Cc: [email protected]
Cc: Daniel Borkmann <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: NipaLocal <nipa@local>
  • Loading branch information
congwang authored and NipaLocal committed Feb 19, 2025
1 parent 1f59db7 commit b200ee2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,20 @@ static void detach_program(struct bpf_flow *skel, int prog_fd)

static int set_port_drop(int pf, bool multi_port)
{
char dst_port[16];

snprintf(dst_port, sizeof(dst_port), "%d", CFG_PORT_INNER);

SYS(fail, "tc qdisc add dev lo ingress");
SYS(fail_delete_qdisc, "tc filter add %s %s %s %s %s %s %s %s %s %s",
SYS(fail_delete_qdisc, "tc filter add %s %s %s %s %s %s %s %s %s %s %s %s",
"dev lo",
"parent FFFF:",
"protocol", pf == PF_INET6 ? "ipv6" : "ip",
"pref 1337",
"flower",
"ip_proto udp",
"src_port", multi_port ? "8-10" : "9",
"dst_port", dst_port,
"action drop");
return 0;

Expand Down

0 comments on commit b200ee2

Please sign in to comment.