Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max cir 4290000000 and not more? #25

Open
walertos86 opened this issue Jan 14, 2023 · 2 comments
Open

max cir 4290000000 and not more? #25

walertos86 opened this issue Jan 14, 2023 · 2 comments

Comments

@walertos86
Copy link

Если ставлю значение более 4290000000 начинаются сплошные дропы, подскажите, что по коду поправить, что бы убрать максимальноре ограничение и можно было использовать шейпер, например 6 Гигабит.

@aabc
Copy link
Owner

aabc commented Jan 14, 2023

По коду надо исправить вычисления с 32-бит на 64-битные.

@manchelsi
Copy link

manchelsi commented Mar 25, 2023

It's enough?

diff --git a/xt_ratelimit.c b/xt_ratelimit.c
index b46076b..5cb66dd 100644
--- a/xt_ratelimit.c
+++ b/xt_ratelimit.c
@@ -85,9 +85,9 @@ struct ratelimit_car {
 	u32 tc;				/* committed token bucket counter */
 	u32 te;				/* exceeded token bucket counter */
 
-	u32 cbs;			/* committed burst size (bytes) */
-	u32 ebs;			/* extended burst size (bytes) */
-	u32 cir;			/* committed information rate (bits/s) / (HZ * 8) */
+	u64 cbs;			/* committed burst size (bytes) */
+	u64 ebs;			/* extended burst size (bytes) */
+	u64 cir;			/* committed information rate (bits/s) / (HZ * 8) */
 };
 
 /* stat not related to policing */
@@ -215,7 +215,7 @@ static int ratelimit_seq_ent_show(struct ratelimit_match *mt,
 				seq_printf(s, "/%d", mti->prefix);
 		}
 	}
-	seq_printf(s, " cir %u cbs %u ebs %u;",
+	seq_printf(s, " cir %llu cbs %llu ebs %llu;",
 	    ent->car.cir * (HZ * BITS_PER_BYTE), ent->car.cbs, ent->car.ebs);
 
 	seq_printf(s, " tc %u te %u last", ent->car.tc, ent->car.te);
@@ -506,7 +506,7 @@ static int parse_rule(struct xt_ratelimit_htable *ht, char *str, size_t size)
 	if (add) /* unindented */
 	for (i = 0; p < endp && *p; ++i) {
 		const char *v;
-		unsigned int val;
+		long long int val;
 
 		while (p < endp && *p == ' ')
 			++p;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants