diff mbox series

[iproute2] tc/f_flower: fix port range parsing

Message ID 20210920150001.40823-1-pusharma@akamai.com (mailing list archive)
State Accepted
Delegated to: Stephen Hemminger
Headers show
Series [iproute2] tc/f_flower: fix port range parsing | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Puneet Sharma Sept. 20, 2021, 3 p.m. UTC
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
---
 tc/f_flower.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tc/f_flower.c b/tc/f_flower.c
index 53822a95..3af820a6 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -724,7 +724,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;
 		}