Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
1ce50eb4
Commit
1ce50eb4
authored
Nov 03, 2003
by
Tom Marshall
Committed by
David S. Miller
Nov 03, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EBTABLES]: Fix ebt_limit for HZ=1000
parent
b4a427fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
net/bridge/netfilter/ebt_limit.c
net/bridge/netfilter/ebt_limit.c
+11
-2
No files found.
net/bridge/netfilter/ebt_limit.c
View file @
1ce50eb4
...
@@ -20,7 +20,16 @@
...
@@ -20,7 +20,16 @@
static
spinlock_t
limit_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
limit_lock
=
SPIN_LOCK_UNLOCKED
;
#define CREDITS_PER_JIFFY 128
#define MAX_CPJ (0xFFFFFFFF / (HZ*60*60*24))
#define _POW2_BELOW2(x) ((x)|((x)>>1))
#define _POW2_BELOW4(x) (_POW2_BELOW2(x)|_POW2_BELOW2((x)>>2))
#define _POW2_BELOW8(x) (_POW2_BELOW4(x)|_POW2_BELOW4((x)>>4))
#define _POW2_BELOW16(x) (_POW2_BELOW8(x)|_POW2_BELOW8((x)>>8))
#define _POW2_BELOW32(x) (_POW2_BELOW16(x)|_POW2_BELOW16((x)>>16))
#define POW2_BELOW32(x) ((_POW2_BELOW32(x)>>1) + 1)
#define CREDITS_PER_JIFFY POW2_BELOW32(MAX_CPJ)
static
int
ebt_limit_match
(
const
struct
sk_buff
*
skb
,
static
int
ebt_limit_match
(
const
struct
sk_buff
*
skb
,
const
struct
net_device
*
in
,
const
struct
net_device
*
out
,
const
struct
net_device
*
in
,
const
struct
net_device
*
out
,
...
@@ -68,7 +77,7 @@ static int ebt_limit_check(const char *tablename, unsigned int hookmask,
...
@@ -68,7 +77,7 @@ static int ebt_limit_check(const char *tablename, unsigned int hookmask,
/* Check for overflow. */
/* Check for overflow. */
if
(
info
->
burst
==
0
||
if
(
info
->
burst
==
0
||
user2credits
(
info
->
avg
*
info
->
burst
)
<
user2credits
(
info
->
avg
))
{
user2credits
(
info
->
avg
*
info
->
burst
)
<
user2credits
(
info
->
avg
))
{
printk
(
"Overflow in ebt_limit: %u/%u
\n
"
,
printk
(
"Overflow in ebt_limit
, try lower
: %u/%u
\n
"
,
info
->
avg
,
info
->
burst
);
info
->
avg
,
info
->
burst
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment