Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
bcc
Commits
1a5090a5
Commit
1a5090a5
authored
Jun 08, 2018
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tcpdrop: reduce data struct size
parent
b2b98712
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
25 deletions
+24
-25
tools/tcpdrop.py
tools/tcpdrop.py
+24
-25
No files found.
tools/tcpdrop.py
View file @
1a5090a5
...
@@ -52,29 +52,28 @@ BPF_STACK_TRACE(stack_traces, 1024);
...
@@ -52,29 +52,28 @@ BPF_STACK_TRACE(stack_traces, 1024);
// separate data structs for ipv4 and ipv6
// separate data structs for ipv4 and ipv6
struct ipv4_data_t {
struct ipv4_data_t {
// XXX: switch some to u32's when supported
u32 pid;
u64 pid;
u64 ip;
u64 ip;
u64 saddr;
u64 saddr;
u64 daddr;
u64 daddr;
u
64
sport;
u
16
sport;
u
64
dport;
u
16
dport;
u
64
state;
u
8
state;
u
64
tcpflags;
u
8
tcpflags;
u
64
stack_id;
u
32
stack_id;
};
};
BPF_PERF_OUTPUT(ipv4_events);
BPF_PERF_OUTPUT(ipv4_events);
struct ipv6_data_t {
struct ipv6_data_t {
u
64
pid;
u
32
pid;
u64 ip;
u64 ip;
unsigned __int128 saddr;
unsigned __int128 saddr;
unsigned __int128 daddr;
unsigned __int128 daddr;
u
64
sport;
u
16
sport;
u
64
dport;
u
16
dport;
u
64
state;
u
8
state;
u
64
tcpflags;
u
8
tcpflags;
u
64
stack_id;
u
32
stack_id;
};
};
BPF_PERF_OUTPUT(ipv6_events);
BPF_PERF_OUTPUT(ipv6_events);
...
@@ -152,28 +151,28 @@ if debug or args.ebpf:
...
@@ -152,28 +151,28 @@ if debug or args.ebpf:
# event data
# event data
class
Data_ipv4
(
ct
.
Structure
):
class
Data_ipv4
(
ct
.
Structure
):
_fields_
=
[
_fields_
=
[
(
"pid"
,
ct
.
c_ulong
long
),
(
"pid"
,
ct
.
c_ulong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"saddr"
,
ct
.
c_ulonglong
),
(
"saddr"
,
ct
.
c_ulonglong
),
(
"daddr"
,
ct
.
c_ulonglong
),
(
"daddr"
,
ct
.
c_ulonglong
),
(
"sport"
,
ct
.
c_u
longlong
),
(
"sport"
,
ct
.
c_u
short
),
(
"dport"
,
ct
.
c_u
longlong
),
(
"dport"
,
ct
.
c_u
short
),
(
"state"
,
ct
.
c_u
longlong
),
(
"state"
,
ct
.
c_u
byte
),
(
"tcpflags"
,
ct
.
c_u
longlong
),
(
"tcpflags"
,
ct
.
c_u
byte
),
(
"stack_id"
,
ct
.
c_ulong
long
)
(
"stack_id"
,
ct
.
c_ulong
)
]
]
class
Data_ipv6
(
ct
.
Structure
):
class
Data_ipv6
(
ct
.
Structure
):
_fields_
=
[
_fields_
=
[
(
"pid"
,
ct
.
c_ulong
long
),
(
"pid"
,
ct
.
c_ulong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"saddr"
,
(
ct
.
c_ulonglong
*
2
)),
(
"saddr"
,
(
ct
.
c_ulonglong
*
2
)),
(
"daddr"
,
(
ct
.
c_ulonglong
*
2
)),
(
"daddr"
,
(
ct
.
c_ulonglong
*
2
)),
(
"sport"
,
ct
.
c_u
longlong
),
(
"sport"
,
ct
.
c_u
short
),
(
"dport"
,
ct
.
c_u
longlong
),
(
"dport"
,
ct
.
c_u
short
),
(
"state"
,
ct
.
c_u
longlong
),
(
"state"
,
ct
.
c_u
byte
),
(
"tcpflags"
,
ct
.
c_u
longlong
),
(
"tcpflags"
,
ct
.
c_u
byte
),
(
"stack_id"
,
ct
.
c_ulong
long
)
(
"stack_id"
,
ct
.
c_ulong
)
]
]
# process event
# process event
...
...
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