-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add the tcpstates tool #1639
add the tcpstates tool #1639
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on ipv4 box and works fine. On ipv6 box, the data structure needs a fix. After that, the tools works fine as well.
tools/tcpstates.py
Outdated
|
|
||
| // separate data structs for ipv4 and ipv6 | ||
| struct ipv4_data_t { | ||
| // XXX: switch some to u32's when supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to give a try to use proper types instead of uniformly u64?
bcc/ctype support u64 and lower-width type pretty well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but it still doesn't work. I submitted #1642 as a simple test case. Maybe I'm doing it wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well... I know what works now: "c_uint" instead of "c_ulong". I've submitted the fix.
tools/tcpstates.py
Outdated
| u64 ts_us; | ||
| u64 skaddr; | ||
| u64 pid; | ||
| unsigned __int128 saddr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work. __int128 will requires an alignment 128bit and the whole structure will have an alignment of 128bit as well. So there will be a padding between pid and saddr.
For python, unsigned __int128 becomes u64[2] which has an an alignment of u64. So no padding in python side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks, pushing the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested on both ipv4/ipv6 box. LGTM. Thanks!
making use of the new sock:inet_sock_set_state tracepoint in 4.16.