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
b2b98712
Commit
b2b98712
authored
Jun 01, 2018
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure ipv6_data_t alignment
parent
4f13d880
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
tools/tcpdrop.py
tools/tcpdrop.py
+8
-8
No files found.
tools/tcpdrop.py
View file @
b2b98712
...
@@ -53,7 +53,6 @@ BPF_STACK_TRACE(stack_traces, 1024);
...
@@ -53,7 +53,6 @@ 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
// XXX: switch some to u32's when supported
u64 stack_id;
u64 pid;
u64 pid;
u64 ip;
u64 ip;
u64 saddr;
u64 saddr;
...
@@ -62,11 +61,11 @@ struct ipv4_data_t {
...
@@ -62,11 +61,11 @@ struct ipv4_data_t {
u64 dport;
u64 dport;
u64 state;
u64 state;
u64 tcpflags;
u64 tcpflags;
u64 stack_id;
};
};
BPF_PERF_OUTPUT(ipv4_events);
BPF_PERF_OUTPUT(ipv4_events);
struct ipv6_data_t {
struct ipv6_data_t {
u64 stack_id;
u64 pid;
u64 pid;
u64 ip;
u64 ip;
unsigned __int128 saddr;
unsigned __int128 saddr;
...
@@ -75,6 +74,7 @@ struct ipv6_data_t {
...
@@ -75,6 +74,7 @@ struct ipv6_data_t {
u64 dport;
u64 dport;
u64 state;
u64 state;
u64 tcpflags;
u64 tcpflags;
u64 stack_id;
};
};
BPF_PERF_OUTPUT(ipv6_events);
BPF_PERF_OUTPUT(ipv6_events);
...
@@ -120,8 +120,8 @@ int trace_tcp_drop(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb)
...
@@ -120,8 +120,8 @@ int trace_tcp_drop(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb)
bpf_probe_read(&data4.daddr, sizeof(u32), &ip->daddr);
bpf_probe_read(&data4.daddr, sizeof(u32), &ip->daddr);
data4.dport = dport;
data4.dport = dport;
data4.sport = sport;
data4.sport = sport;
data4.tcpflags = tcpflags;
data4.state = state;
data4.state = state;
data4.tcpflags = tcpflags;
data4.stack_id = stack_traces.get_stackid(ctx, 0);
data4.stack_id = stack_traces.get_stackid(ctx, 0);
ipv4_events.perf_submit(ctx, &data4, sizeof(data4));
ipv4_events.perf_submit(ctx, &data4, sizeof(data4));
...
@@ -133,8 +133,8 @@ int trace_tcp_drop(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb)
...
@@ -133,8 +133,8 @@ int trace_tcp_drop(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb)
sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32);
sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32);
data6.dport = dport;
data6.dport = dport;
data6.sport = sport;
data6.sport = sport;
data6.tcpflags = tcpflags;
data6.state = state;
data6.state = state;
data6.tcpflags = tcpflags;
data6.stack_id = stack_traces.get_stackid(ctx, 0);
data6.stack_id = stack_traces.get_stackid(ctx, 0);
ipv6_events.perf_submit(ctx, &data6, sizeof(data6));
ipv6_events.perf_submit(ctx, &data6, sizeof(data6));
}
}
...
@@ -152,7 +152,6 @@ if debug or args.ebpf:
...
@@ -152,7 +152,6 @@ if debug or args.ebpf:
# event data
# event data
class
Data_ipv4
(
ct
.
Structure
):
class
Data_ipv4
(
ct
.
Structure
):
_fields_
=
[
_fields_
=
[
(
"stack_id"
,
ct
.
c_ulonglong
),
(
"pid"
,
ct
.
c_ulonglong
),
(
"pid"
,
ct
.
c_ulonglong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"saddr"
,
ct
.
c_ulonglong
),
(
"saddr"
,
ct
.
c_ulonglong
),
...
@@ -160,12 +159,12 @@ class Data_ipv4(ct.Structure):
...
@@ -160,12 +159,12 @@ class Data_ipv4(ct.Structure):
(
"sport"
,
ct
.
c_ulonglong
),
(
"sport"
,
ct
.
c_ulonglong
),
(
"dport"
,
ct
.
c_ulonglong
),
(
"dport"
,
ct
.
c_ulonglong
),
(
"state"
,
ct
.
c_ulonglong
),
(
"state"
,
ct
.
c_ulonglong
),
(
"tcpflags"
,
ct
.
c_ulonglong
)
(
"tcpflags"
,
ct
.
c_ulonglong
),
(
"stack_id"
,
ct
.
c_ulonglong
)
]
]
class
Data_ipv6
(
ct
.
Structure
):
class
Data_ipv6
(
ct
.
Structure
):
_fields_
=
[
_fields_
=
[
(
"stack_id"
,
ct
.
c_ulonglong
),
(
"pid"
,
ct
.
c_ulonglong
),
(
"pid"
,
ct
.
c_ulonglong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"ip"
,
ct
.
c_ulonglong
),
(
"saddr"
,
(
ct
.
c_ulonglong
*
2
)),
(
"saddr"
,
(
ct
.
c_ulonglong
*
2
)),
...
@@ -173,7 +172,8 @@ class Data_ipv6(ct.Structure):
...
@@ -173,7 +172,8 @@ class Data_ipv6(ct.Structure):
(
"sport"
,
ct
.
c_ulonglong
),
(
"sport"
,
ct
.
c_ulonglong
),
(
"dport"
,
ct
.
c_ulonglong
),
(
"dport"
,
ct
.
c_ulonglong
),
(
"state"
,
ct
.
c_ulonglong
),
(
"state"
,
ct
.
c_ulonglong
),
(
"tcpflags"
,
ct
.
c_ulonglong
)
(
"tcpflags"
,
ct
.
c_ulonglong
),
(
"stack_id"
,
ct
.
c_ulonglong
)
]
]
# 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