Page MenuHomeFreeBSD

LinuxKPI: add net_ratelimit()
ClosedPublic

Authored by bz on Tue, Mar 23, 5:13 PM.

Details

Summary

Add a net_ratelimit() compat implementation based on ppsratecheck().
Add a sysctl to allow tuning of the number of messages.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: ...
Differential Revision:

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bz requested review of this revision.Tue, Mar 23, 5:13 PM
hselasky added inline comments.
sys/compat/linuxkpi/common/include/linux/net.h
78

Please don't declare static variables in header files.
Make them global and possibly into SYSCTLs.

Migrate function and static variables into the implementation file
and add a SYSCTl to allow tuning the number of messages as suggested
by @hselasky.

bz marked an inline comment as done.
sys/compat/linuxkpi/common/src/linux_compat.c
104

Does Linux default to 99 for its equivalent, or is this just a convenient number?

bz marked an inline comment as done.Wed, Mar 24, 7:19 PM
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_compat.c
104

I cannot tell you what Linux defaults to as that would require me reading (likely) GPL code. It is a convenience number as I figure I can survive with 99 log messages / s on a serial console these days if worse comes to worse.

This revision is now accepted and ready to land.Wed, Mar 24, 7:32 PM
sys/compat/linuxkpi/common/src/linux_compat.c
105

Use CTLFLAG_RWTUN .

sys/compat/linuxkpi/common/src/linux_compat.c
104

Ok - mainly was just curious, but either way it doesn't matter much, we can change the default based on feedback if it proves necessary.

bz marked an inline comment as done.Wed, Mar 24, 9:31 PM
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_compat.c
105

Is there a specific reason we need this to be a tunable so it's available before /etc/rc.d/sysctl runs?

bz marked an inline comment as done.Fri, Mar 26, 12:16 PM
This revision was automatically updated to reflect the committed changes.