Skip to content
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

Merged
merged 3 commits into from
Mar 22, 2018
Merged

add the tcpstates tool #1639

merged 3 commits into from
Mar 22, 2018

Conversation

brendangregg
Copy link
Member

making use of the new sock:inet_sock_set_state tracepoint in 4.16.

Copy link
Collaborator

@yonghong-song yonghong-song left a 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.


// separate data structs for ipv4 and ipv6
struct ipv4_data_t {
// XXX: switch some to u32's when supported
Copy link
Collaborator

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.

Copy link
Member Author

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?

Copy link
Member Author

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.

u64 ts_us;
u64 skaddr;
u64 pid;
unsigned __int128 saddr;
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

@yonghong-song yonghong-song left a 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!

@yonghong-song yonghong-song merged commit 57bbd87 into iovisor:master Mar 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants