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
nexedi
linux
Commits
500ae766
Commit
500ae766
authored
Oct 27, 2002
by
Bart De Schuymer
Committed by
David S. Miller
Oct 27, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EBTABLES]: Add byte counter support, plus header cleanup.
parent
524c4554
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
19 deletions
+25
-19
include/linux/netfilter_bridge/ebtables.h
include/linux/netfilter_bridge/ebtables.h
+18
-17
net/bridge/netfilter/ebtables.c
net/bridge/netfilter/ebtables.c
+7
-2
No files found.
include/linux/netfilter_bridge/ebtables.h
View file @
500ae766
...
...
@@ -20,19 +20,6 @@
#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
#define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN
// [gs]etsockopt numbers
#define EBT_BASE_CTL 128
#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL)
#define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1)
#define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1)
#define EBT_SO_GET_INFO (EBT_BASE_CTL)
#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1)
#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1)
#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1)
#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1)
// verdicts >0 are "branches"
#define EBT_ACCEPT -1
#define EBT_DROP -2
...
...
@@ -40,13 +27,10 @@
#define EBT_RETURN -4
#define NUM_STANDARD_TARGETS 4
// return values for match() functions
#define EBT_MATCH 0
#define EBT_NOMATCH 1
struct
ebt_counter
{
uint64_t
pcnt
;
uint64_t
bcnt
;
};
struct
ebt_entries
{
...
...
@@ -178,8 +162,25 @@ struct ebt_replace
char
*
entries
;
};
// [gs]etsockopt numbers
#define EBT_BASE_CTL 128
#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL)
#define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1)
#define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1)
#define EBT_SO_GET_INFO (EBT_BASE_CTL)
#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1)
#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1)
#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1)
#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1)
#ifdef __KERNEL__
// return values for match() functions
#define EBT_MATCH 0
#define EBT_NOMATCH 1
struct
ebt_match
{
struct
list_head
list
;
...
...
net/bridge/netfilter/ebtables.c
View file @
500ae766
...
...
@@ -194,6 +194,7 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff **pskb,
// increase counter
(
*
(
counter_base
+
i
)).
pcnt
++
;
(
*
(
counter_base
+
i
)).
bcnt
+=
(
**
pskb
).
len
;
// these should only watch: not modify, nor tell us
// what to do with the packet
...
...
@@ -885,8 +886,10 @@ static void get_counters(struct ebt_counter *oldcounters,
// add other counters to those of cpu 0
for
(
cpu
=
1
;
cpu
<
NR_CPUS
;
cpu
++
)
{
counter_base
=
COUNTER_BASE
(
oldcounters
,
nentries
,
cpu
);
for
(
i
=
0
;
i
<
nentries
;
i
++
)
for
(
i
=
0
;
i
<
nentries
;
i
++
)
{
counters
[
i
].
pcnt
+=
counter_base
[
i
].
pcnt
;
counters
[
i
].
bcnt
+=
counter_base
[
i
].
bcnt
;
}
}
}
...
...
@@ -1245,8 +1248,10 @@ static int update_counters(void *user, unsigned int len)
write_lock_bh
(
&
t
->
lock
);
// we add to the counters of the first cpu
for
(
i
=
0
;
i
<
hlp
.
num_counters
;
i
++
)
for
(
i
=
0
;
i
<
hlp
.
num_counters
;
i
++
)
{
t
->
private
->
counters
[
i
].
pcnt
+=
tmp
[
i
].
pcnt
;
t
->
private
->
counters
[
i
].
bcnt
+=
tmp
[
i
].
bcnt
;
}
write_unlock_bh
(
&
t
->
lock
);
ret
=
0
;
...
...
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