iptables-1.3.2-20050720
[iptables.git] / extensions / libipt_mport.c
index 2ae61ff..a387b21 100644 (file)
@@ -136,30 +136,34 @@ parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case '1':
+               check_inverse(argv[optind-1], &invert, &optind, 0);
                proto = check_proto(entry);
                parse_multi_ports(argv[optind-1], minfo, proto);
                minfo->flags = IPT_MPORT_SOURCE;
-               *nfcache |= NFC_IP_SRC_PT;
                break;
 
        case '2':
+               check_inverse(argv[optind-1], &invert, &optind, 0);
                proto = check_proto(entry);
                parse_multi_ports(argv[optind-1], minfo, proto);
                minfo->flags = IPT_MPORT_DESTINATION;
-               *nfcache |= NFC_IP_DST_PT;
                break;
 
        case '3':
+               check_inverse(argv[optind-1], &invert, &optind, 0);
                proto = check_proto(entry);
                parse_multi_ports(argv[optind-1], minfo, proto);
                minfo->flags = IPT_MPORT_EITHER;
-               *nfcache |= NFC_IP_SRC_PT | NFC_IP_DST_PT;
                break;
 
        default:
                return 0;
        }
 
+       if (invert)
+               exit_error(PARAMETER_PROBLEM,
+                          "multiport does not support invert");
+
        if (*flags)
                exit_error(PARAMETER_PROBLEM,
                           "multiport can only have one option");
@@ -285,19 +289,19 @@ static void save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
        printf(" ");
 }
 
-struct iptables_match mport
-= { NULL,
-    "mport",
-    IPTABLES_VERSION,
-    IPT_ALIGN(sizeof(struct ipt_mport)),
-    IPT_ALIGN(sizeof(struct ipt_mport)),
-    &help,
-    &init,
-    &parse,
-    &final_check,
-    &print,
-    &save,
-    opts
+static struct iptables_match mport = { 
+       .next           = NULL,
+       .name           = "mport",
+       .version        = IPTABLES_VERSION,
+       .size           = IPT_ALIGN(sizeof(struct ipt_mport)),
+       .userspacesize  = IPT_ALIGN(sizeof(struct ipt_mport)),
+       .help           = &help,
+       .init           = &init,
+       .parse          = &parse,
+       .final_check    = &final_check,
+       .print          = &print,
+       .save           = &save,
+       .extra_opts     = opts
 };
 
 void