iptables-test: Mask address when parsing ip/prefixlen
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 13 Feb 2012 14:51:37 +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.

tools/iptables-test.c

index feefc53..5411bd1 100644 (file)
@@ -1488,6 +1488,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);