From: Puneet Sharma Date: Mon, 20 Sep 2021 15:00:01 +0000 (-0400) Subject: tc/f_flower: fix port range parsing X-Git-Tag: v5.15.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d756c08a3d45a9912ee422fa3ca78488b044ebd4;p=thirdparty%2Fiproute2.git 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: 8930840e678b ("tc: flower: Classify packets based port ranges") Signed-off-by: Puneet Sharma Signed-off-by: Stephen Hemminger --- diff --git a/tc/f_flower.c b/tc/f_flower.c index c5af02761..7f78195fd 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -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; }