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
54044d51
Commit
54044d51
authored
Jan 10, 2019
by
detailyang
Committed by
yonghong-song
Jan 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: allow tcpaccept filter via PID (#2117)
add missing FILTER in the bpf program.
parent
9f851e2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
tools/tcpaccept.py
tools/tcpaccept.py
+7
-2
No files found.
tools/tcpaccept.py
View file @
54044d51
...
...
@@ -84,6 +84,8 @@ int kretprobe__inet_csk_accept(struct pt_regs *ctx)
struct sock *newsk = (struct sock *)PT_REGS_RC(ctx);
u32 pid = bpf_get_current_pid_tgid();
##FILTER_PID##
if (newsk == NULL)
return 0;
...
...
@@ -161,6 +163,9 @@ TRACEPOINT_PROBE(sock, inet_sock_set_state)
if (args->protocol != IPPROTO_TCP)
return 0;
u32 pid = bpf_get_current_pid_tgid();
##FILTER_PID##
// pull in details
u16 family = 0, lport = 0;
family = args->family;
...
...
@@ -197,10 +202,10 @@ else:
# code substitutions
if
args
.
pid
:
bpf_text
=
bpf_text
.
replace
(
'
FILTER
'
,
bpf_text
=
bpf_text
.
replace
(
'
##FILTER_PID##
'
,
'if (pid != %s) { return 0; }'
%
args
.
pid
)
else
:
bpf_text
=
bpf_text
.
replace
(
'
FILTER
'
,
''
)
bpf_text
=
bpf_text
.
replace
(
'
##FILTER_PID##
'
,
''
)
if
debug
or
args
.
ebpf
:
print
(
bpf_text
)
if
args
.
ebpf
:
...
...
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