mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 21:25:12 +02:00
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 <sam@liddicott.com>
This commit is contained in:

committed by
Jan Engelhardt

parent
a0a8fbc091
commit
c6c70ab30b
@@ -219,13 +219,14 @@ quota_mt2(const struct sk_buff *skb, struct xt_action_param *par)
|
|||||||
}
|
}
|
||||||
ret = true;
|
ret = true;
|
||||||
} else {
|
} else {
|
||||||
if (e->quota >= skb->len) {
|
if (e->quota >= ((q->flags & XT_QUOTA_PACKET) ? 1 : skb->len)) {
|
||||||
if (!(q->flags & XT_QUOTA_NO_CHANGE))
|
if (!(q->flags & XT_QUOTA_NO_CHANGE))
|
||||||
e->quota -= (q->flags & XT_QUOTA_PACKET) ? 1 : skb->len;
|
e->quota -= (q->flags & XT_QUOTA_PACKET) ? 1 : skb->len;
|
||||||
ret = !ret;
|
ret = !ret;
|
||||||
} else {
|
} else {
|
||||||
/* we do not allow even small packets from now on */
|
/* 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;
|
q->quota = e->quota;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user