[PATCH] mport match port parsing broken: fix

Daniel Roethlisberger daniel@roe.ch
Mon, 24 Sep 2001 05:19:51 +0200


mport match parse_port() fix

The mport match extension was broken in iptables-1.2.3 and CVS:
all ports and ranges were always parsed as port number 1. The
return value of string_to_number was assigned to portnum, even
though string_to_number returns the result via the fourth pointer
argument, and not as return value.

Cheers,
Dan



diff -ru iptables-1.2.3/extensions/libipt_mport.c iptables-1.2.3-mport-fix/extensions/libipt_mport.c
--- iptables-1.2.3/extensions/libipt_mport.c    Sun Jul 22 19:03:18 2001
+++ iptables-1.2.3-mport-fix/extensions/libipt_mport.c  Mon Sep 24 04:36:39 2001
@@ -49,7 +49,7 @@
 {
        unsigned int portnum;
 
-       if (portnum = string_to_number(port, 0, 65535, &portnum) != -1 ||
+       if (string_to_number(port, 0, 65535, &portnum) != -1 ||
            (portnum = service_to_port(port, proto)) != -1)
                return (u_int16_t)portnum;