Skip to content

Conversation

@saminiir
Copy link
Owner

This PR introduces support for Netlink AF_INET/IPPROTO_TCP socket information gathering. See man sock_diag.

Useful with the ss tool (from iproute2):

$ ./tools/level-ip ss -n4t
State                             Recv-Q                          Send-Q                                                    Local Address:Port                                                      Peer Address:Port
TIME-WAIT                         0                               0                                                              10.0.0.4:43241                                                   216.58.211.142:80
TIME-WAIT                         0                               0                                                              10.0.0.4:42332                                                   216.58.211.142:80

saminiir added 30 commits March 8, 2019 19:52
This is enforced by e.g. the `ss` tool.
This is an error with clang, so avoid it.
This is the order Linux header uses, so let's switch to it.
This is more accurate than protocol, since e.g. SOCK_STREAM implies TCP
This change is introduced because suddenly CAP_NET_ADMIN
stopped working for my Arch Linux. In essence, doing

$ sudo setcap cap_net_admin=ep $(which ip)

Has no effect anymore:

$ ip link set dev tap0 up
RTNETLINK answers: Operation not permitted

Searching the Internet, one error case is if the directory is mounted
with `nosuid`, but this does not seem to be the case in my Linux.
Since iproute2 changed its capability handling, seems like it is
simpler to just guide the user to create the tap device itself.

This is also what Google's Netstack does.

iproute2/iproute2@9b13cc9
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.

3 participants