]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc/f_flower: fix port range parsing
authorPuneet Sharma <pusharma@akamai.com>
Mon, 20 Sep 2021 15:00:01 +0000 (11:00 -0400)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 23 Sep 2021 00:28:48 +0000 (17:28 -0700)
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: 8930840e678b ("tc: flower: Classify packets based port ranges")
Signed-off-by: Puneet Sharma <pusharma@akamai.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/f_flower.c

index c5af02761cc63530082d320c00169e4eed9bb2ef..7f78195fd3034791a28b328ba7283644091de42b 100644 (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;
                }