Linux Kernel: xt_quota: report initial quota value instead of current value to userspace

Posted on In Linux, Linux Kernel

This change “xt_quota: report initial quota value instead of current value to userspace” (commit 49daf6a) in Linux kernel is authored by Changli Gao <xiaosuo [at] gmail.com> on Fri Jul 23 14:07:47 2010 +0200.

Description of “xt_quota: report initial quota value instead of current value to userspace”

The change “xt_quota: report initial quota value instead of current value to userspace” introduces changes as follows.

xt_quota: report initial quota value instead of current value to userspace

We should copy the initial value to userspace for iptables-save and
to allow removal of specific quota rules.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>

Linux kernel code changes from “xt_quota: report initial quota value instead of current value to userspace”

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 include/linux/netfilter/xt_quota.h | 2 +-
 net/netfilter/xt_quota.c           | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index 8dc89dfc1361..b0d28c659ab7 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -11,9 +11,9 @@ struct xt_quota_priv;
 struct xt_quota_info {
    u_int32_t       flags;
    u_int32_t       pad;
+   aligned_u64     quota;

    /* Used internally by the kernel */
-   aligned_u64     quota;
    struct xt_quota_priv    *master;
 };

diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
index 304b1fda1a0d..70eb2b4984dd 100644
--- a/net/netfilter/xt_quota.c
+++ b/net/netfilter/xt_quota.c
@@ -36,8 +36,6 @@ quota_mt(const struct sk_buff *skb, struct xt_action_param *par)
        /* we do not allow even small packets from now on */
        priv->quota = 0;
    }
-   /* Copy quota back to matchinfo so that iptables can display it */
-   q->quota = priv->quota;
    spin_unlock_bh(&priv->lock);

    return ret;

The commit for this change in Linux stable tree is 49daf6a (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *