summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi/linux/socket.go
diff options
context:
space:
mode:
authorRahat Mahmood <rahat@google.com>2019-06-06 15:03:44 -0700
committerShentubot <shentubot@google.com>2019-06-06 15:04:47 -0700
commit2d2831e3541c8ae3c84f17cfd1bf0a26f2027044 (patch)
tree73511b008d7be602ba39947c17bdf71ced981778 /pkg/abi/linux/socket.go
parentbf0b1b9d767736e632fa56b90d904fee968d8d3d (diff)
Track and export socket state.
This is necessary for implementing network diagnostic interfaces like /proc/net/{tcp,udp,unix} and sock_diag(7). For pass-through endpoints such as hostinet, we obtain the socket state from the backend. For netstack, we add explicit tracking of TCP states. PiperOrigin-RevId: 251934850
Diffstat (limited to 'pkg/abi/linux/socket.go')
-rw-r--r--pkg/abi/linux/socket.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/abi/linux/socket.go b/pkg/abi/linux/socket.go
index 417840731..44bd69df6 100644
--- a/pkg/abi/linux/socket.go
+++ b/pkg/abi/linux/socket.go
@@ -200,6 +200,22 @@ const (
SS_DISCONNECTING = 4 // In process of disconnecting.
)
+// TCP protocol states, from include/net/tcp_states.h.
+const (
+ TCP_ESTABLISHED uint32 = iota + 1
+ TCP_SYN_SENT
+ TCP_SYN_RECV
+ TCP_FIN_WAIT1
+ TCP_FIN_WAIT2
+ TCP_TIME_WAIT
+ TCP_CLOSE
+ TCP_CLOSE_WAIT
+ TCP_LAST_ACK
+ TCP_LISTEN
+ TCP_CLOSING
+ TCP_NEW_SYN_RECV
+)
+
// SockAddrMax is the maximum size of a struct sockaddr, from
// uapi/linux/socket.h.
const SockAddrMax = 128