]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Revert "extensions: libxt_quota: Allow setting the remaining quota"
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 19 Oct 2018 09:48:59 +0000 (11:48 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 19 Oct 2018 09:51:30 +0000 (11:51 +0200)
This reverts commit 0a8f2bcadff157489a737f8cc8846adcb750b91f.

Google folks are reporting some issues with 32-bits arch, let's revert
this until we have a new version for this.

extensions/libxt_quota.c
include/linux/netfilter/xt_quota.h

index 6371aa0f1ffff2ef23a8e2d88bfdb531b49e40b5..bad77d236e6b8899e35acc94b957d740d885fead 100644 (file)
@@ -9,36 +9,26 @@
 
 enum {
        O_QUOTA = 0,
-       O_REMAIN = 1,
 };
 
 static const struct xt_option_entry quota_opts[] = {
        {.name = "quota", .id = O_QUOTA, .type = XTTYPE_UINT64,
         .flags = XTOPT_MAND | XTOPT_INVERT | XTOPT_PUT,
         XTOPT_POINTER(struct xt_quota_info, quota)},
-       {.name = "remain", .id = O_REMAIN, .type = XTTYPE_UINT64,
-        .flags = XTOPT_PUT, XTOPT_POINTER(struct xt_quota_info, remain)},
        XTOPT_TABLEEND,
 };
 
 static void quota_help(void)
 {
        printf("quota match options:\n"
-              "[!] --quota quota               quota (bytes)\n"
-              "    --remain remain             remain (bytes)\n");
+              "[!] --quota quota               quota (bytes)\n");
 }
 
 static void
 quota_print(const void *ip, const struct xt_entry_match *match, int numeric)
 {
        const struct xt_quota_info *q = (const void *)match->data;
-       if (q->flags & XT_QUOTA_INVERT)
-               printf(" !");
        printf(" quota: %llu bytes", (unsigned long long)q->quota);
-       if (q->remain) {
-               printf(" remain: %llu bytes",
-                       (unsigned long long)q->remain - 1);
-       }
 }
 
 static void
@@ -49,10 +39,6 @@ quota_save(const void *ip, const struct xt_entry_match *match)
        if (q->flags & XT_QUOTA_INVERT)
                printf(" !");
        printf(" --quota %llu", (unsigned long long) q->quota);
-       if (q->remain) {
-               printf(" --remain %llu",
-                       (unsigned long long) q->remain - 1);
-       }
 }
 
 static void quota_parse(struct xt_option_call *cb)
@@ -62,8 +48,6 @@ static void quota_parse(struct xt_option_call *cb)
        xtables_option_parse(cb);
        if (cb->invert)
                info->flags |= XT_QUOTA_INVERT;
-       if (cb->entry->id == O_REMAIN)
-               info->remain++;
 }
 
 static int quota_xlate(struct xt_xlate *xl,
@@ -82,12 +66,7 @@ static struct xtables_match quota_match = {
        .name           = "quota",
        .version        = XTABLES_VERSION,
        .size           = XT_ALIGN(sizeof (struct xt_quota_info)),
-       /*
-        * This size is only used for rule matching purpose when deleting
-        * rules. The real size copied out from new kernel xt_quota module
-        * is the whole struct xt_quota_info.
-        */
-       .userspacesize  = offsetof(struct xt_quota_info, remain),
+       .userspacesize  = offsetof(struct xt_quota_info, master),
        .help           = quota_help,
        .print          = quota_print,
        .save           = quota_save,
index d817aab282287609a14342b5c76e3a91f46fbe84..9314723f39ca19bb4f257e60f711ffedaaa52ee1 100644 (file)
@@ -14,11 +14,9 @@ struct xt_quota_info {
        __u32 flags;
        __u32 pad;
        __aligned_u64 quota;
-#ifdef __KERNEL__
-       atomic64_t counter;
-#else
-       __aligned_u64 remain;
-#endif
+
+       /* Used internally by the kernel */
+       struct xt_quota_priv    *master;
 };
 
 #endif /* _XT_QUOTA_H */