]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_quota: require --quota to be specified
authorJan Engelhardt <jengelh@medozas.de>
Sun, 20 Feb 2011 19:30:56 +0000 (20:30 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 20 Feb 2011 19:30:56 +0000 (20:30 +0100)
It is pretty pointless to use -m quota without specifying --quota.
There would be nothing left to count down on.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libxt_quota.c

index e6ed9bc7692b8e0db13a38f56d303aa6e8fb1228..e3699ad788240ada06f31102bdf8e0f39757d461 100644 (file)
@@ -72,12 +72,19 @@ quota_parse(int c, char **argv, int invert, unsigned int *flags,
 
                if (invert)
                        info->flags |= XT_QUOTA_INVERT;
-
+               *flags |= 1;
                break;
        }
        return 1;
 }
 
+static void quota_check(unsigned int flags)
+{
+       if (flags == 0)
+               xtables_error(PARAMETER_PROBLEM,
+                       "quota: the --quota argument must be specified\n");
+}
+
 static struct xtables_match quota_match = {
        .family         = NFPROTO_UNSPEC,
        .name           = "quota",
@@ -86,6 +93,7 @@ static struct xtables_match quota_match = {
        .userspacesize  = offsetof(struct xt_quota_info, master),
        .help           = quota_help,
        .parse          = quota_parse,
+       .final_check    = quota_check,
        .print          = quota_print,
        .save           = quota_save,
        .extra_opts     = quota_opts,