Page MenuHomeFreeBSD

counter(9): rate limit periods may be more than 1 second
ClosedPublic

Authored by kp on Wed, Jun 11, 7:40 PM.
Tags
None
Referenced Files
F121812152: D50796.id157302.diff
Sun, Jun 29, 2:31 PM
Unknown Object (File)
Wed, Jun 25, 6:58 PM
Unknown Object (File)
Tue, Jun 24, 3:33 PM
Unknown Object (File)
Mon, Jun 23, 12:52 PM
Unknown Object (File)
Sun, Jun 22, 5:42 PM
Unknown Object (File)
Sun, Jun 22, 1:26 AM
Unknown Object (File)
Sun, Jun 22, 1:00 AM
Unknown Object (File)
Wed, Jun 18, 3:55 PM

Details

Summary

Teach counter_rate() to deal with periods of more than 1 second, so we can
express 'at most 100 in 10 seconds', which is different from 'at most 10 in
1 second'.
While here move the struct counter_rate definition into subr_counter.c so users
cannot mess with its internals. Add allocation and free functions.

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 64976
Build 61859: arc lint + arc unit

Event Timeline

kp requested review of this revision.Wed, Jun 11, 7:40 PM

May I ask to wait for my review until next week?

May I ask to wait for my review until next week?

Sure. This isn't particularly urgent. It's a preparatory commit for the max-pkt-rate feature in pf.

I totally agree with the period feature. Thanks!

I'm not sure about making the structure opaque and thus only dynamically allocated. In general I prefer hiding internals, but for some reason when we did this, we decided to make it exposed. There definitely was some reason for that, otherwise I would make it opaque. Adding Jonathan, maybe he can recall.

Manual page counter.9 also needs to be updated.

I'm not sure about making the structure opaque and thus only dynamically allocated. In general I prefer hiding internals, but for some reason when we did this, we decided to make it exposed. There definitely was some reason for that, otherwise I would make it opaque. Adding Jonathan, maybe he can recall.

Given that we already had to counter_u64_alloc() I don't think this actually makes a difference.

Unless Jonathan remembers something I'd like to go with this version.

In D50796#1162649, @kp wrote:

Unless Jonathan remembers something I'd like to go with this version.

I intend to commit this tomorrow.

I have no plans to MFC this, so if it does turn out to cause issues (presumably we'd discover this on your next merge?) we can still change it later.

No objection from me. Thanks for the change and sorry for the delay. But please wait for the stabweek closure.

This revision is now accepted and ready to land.Mon, Jun 23, 6:59 PM