iptables: Mask address when parsing ip/prefixlen
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 13 Feb 2012 14:51:38 +0000 (15:51 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 13 Feb 2012 16:24:56 +0000 (17:24 +0100)
Netfilter likes to have the address properly masked.

src/iptables.c

index 80f63ec2bd6c812bedf5665d375781a8ee249259..7c62ec3d74f87417c6d107729f48eb37e60b229a 100644 (file)
@@ -1498,6 +1498,7 @@ static int parse_ip_and_mask(const char *str, struct in_addr *ip, struct in_addr
        }
 
        mask->s_addr = htonl(tmp);
+       ip->s_addr = ip->s_addr & mask->s_addr;
        err = 0;
 out:
        g_strfreev(tokens);