From: Sam Liddicott Date: Tue, 7 Jan 2014 17:11:07 +0000 (-0800) Subject: xt_quota2: fix 2 bugs when not in grow mode X-Git-Tag: v2.4~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6c70ab30bd97dd680f3bdd297a14ff426fd0729;p=thirdparty%2Fxtables-addons.git xt_quota2: fix 2 bugs when not in grow mode 1. XT_QUOTA_NO_CHANGE should not alter quota to zero ever 2. XT_QUOTA_PACKET should not be set to zero based on skb->len Signed-off-by: Sam Liddicott --- diff --git a/extensions/xt_quota2.c b/extensions/xt_quota2.c index ff91fcb..aa00207 100644 --- a/extensions/xt_quota2.c +++ b/extensions/xt_quota2.c @@ -219,13 +219,14 @@ quota_mt2(const struct sk_buff *skb, struct xt_action_param *par) } ret = true; } else { - if (e->quota >= skb->len) { + if (e->quota >= ((q->flags & XT_QUOTA_PACKET) ? 1 : skb->len)) { if (!(q->flags & XT_QUOTA_NO_CHANGE)) e->quota -= (q->flags & XT_QUOTA_PACKET) ? 1 : skb->len; ret = !ret; } else { /* we do not allow even small packets from now on */ - e->quota = 0; + if (!(q->flags & XT_QUOTA_NO_CHANGE)) + e->quota = 0; } q->quota = e->quota; }