tc/f_flower: fix port range parsing

Provided port range in tc rule are parsed incorrectly.
Even though range is passed as min-max. It throws an error.

$ tc filter add dev eth0 ingress handle 100 priority 10000 protocol ipv4 flower ip_proto tcp dst_port 10368-61000 action pass
max value should be greater than min value
Illegal "dst_port"

Fixes: 8930840e67 ("tc: flower: Classify packets based port ranges")
Signed-off-by: Puneet Sharma <pusharma@akamai.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Puneet Sharma 2021-09-20 11:00:01 -04:00 committed by Stephen Hemminger
parent 92e32f7791
commit d756c08a3d
1 changed files with 1 additions and 1 deletions

View File

@ -725,7 +725,7 @@ static int flower_parse_port(char *str, __u8 ip_proto,
if (min && max) {
__be16 min_port_type, max_port_type;
if (max <= min) {
if (ntohs(max) <= ntohs(min)) {
fprintf(stderr, "max value should be greater than min value\n");
return -1;
}