Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a reference in the linux source code or something like that that determines this size?
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.
On my system:
sizeof(struct tcp_info) = 104
I think the problem is our TCPInfo struct, not this constant.
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.
IMO, even we got 104 bytes from system, this still breaks the Unmarshal as we have a larger size of TCPInfo struct.
According to kernel (https://github.com/torvalds/linux/blob/master/net/ipv4/tcp.c#L3431), and ss (https://github.com/sivasankariit/iproute2/blob/master/misc/ss.c#L1378), it seems that we shall have a similar workaround.
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 believe that 104 bytes is the new larger size and that
struct tcp_info
was previously smaller. It would appear that the problem is that our TCPInfo struct has a bunch of extra fields.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.
Nevermind. It looks like the struct was correct at a time and that the newest one is even larger still. What really confuses me is that version in my glibc seems to have fields missing from the middle as well. It appears that they added an extra field based on the assumption that it wouldn't change the size due to the space previously having been there as padding.
The code change looks good to me.
Could you please also:
Add a test which verifies that this constant contains the correct value.
Add a comment that this struct grew before this snapshot of it was take and has grown since.
Add a comment that this snapshot of the struct is from Linux 4.18.
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 effectively merged this in 691c2f8
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.
Would you mind adding the comments as suggested by Ian (see above)?
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.
Done. 6cfc767