Skip to content

VSOCK: add sock_diag interface

Stefan Hajnoczi netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 1 replyIn review
  2. v25 patches 1 replySuperseded
  3. v15 patches 6 repliesSuperseded

Changes in v3 from the cover letter

* Rebased onto net-next/master and resolved Hyper-V transport conflict

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5VSOCK: export socket tables for sock_diag interfaceinclude/net/af_vsock.h net/vmw_vsock/af_vsock.c+11 -40 replies
2/5VSOCK: move __vsock_in_bound/connected_table() to af_vsock.hinclude/net/af_vsock.h net/vmw_vsock/af_vsock.c+12 -100 replies
3/5VSOCK: use TCP state constants for sk_stateinclude/net/af_vsock.h net/vmw_vsock/af_vsock.c net/vmw_vsock/hyperv_transport.c +5 more+64 -590 replies
4/5VSOCK: add sock_diag interfaceMAINTAINERS include/uapi/linux/vm_sockets_diag.h net/vmw_vsock/Kconfig +2 more+234 -00 replies
5/5VSOCK: add tools/testing/vsock/vsock_diag_testMAINTAINERS tools/testing/vsock/.gitignore tools/testing/vsock/Makefile +6 more+1039 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/5] VSOCK: add sock_diag interface

v3:
* Rebased onto net-next/master and resolved Hyper-V transport conflict

v2:
* Moved tests to tools/testing/vsock/. I was unable to put them in selftests/ because they require manual setup of a VMware/KVM guest.
* Moved to __vsock_in_bound/connected_table() to af_vsock.h
* Fixed local variable ordering in Patch 4

There is currently no way for userspace to query open AF_VSOCK sockets. This means ss(8), netstat(8), and other utilities cannot display AF_VSOCK sockets.

This patch series adds the netlink sock_diag interface for AF_VSOCK. Userspace programs sent a DUMP request including an sk_state bitmap to filter sockets based on their state (connected, listening, etc). The vsock_diag.ko module replies with information about matching sockets. This userspace ABI is defined in <linux/vm_sockets_diag.h>.

The final patch adds a test suite that exercises the basic cases.

Jorgen and Dexuan: I have only tested the virtio transport but this should also work for VMCI and Hyper-V. Please give it a shot if you have time.

Stefan Hajnoczi (5):
VSOCK: export socket tables for sock_diag interface
VSOCK: move __vsock_in_bound/connected_table() to af_vsock.h
VSOCK: use TCP state constants for sk_state
VSOCK: add sock_diag interface
VSOCK: add tools/testing/vsock/vsock_diag_test

 MAINTAINERS                                  |   3 +
 net/vmw_vsock/Makefile                       |   3 +
 tools/testing/vsock/Makefile                 |   9 +
 include/net/af_vsock.h                       |  20 +-
 include/uapi/linux/vm_sockets_diag.h         |  33 ++
 tools/testing/vsock/control.h                |  13 +
 tools/testing/vsock/timeout.h                |  14 +
 net/vmw_vsock/af_vsock.c                     |  66 +--
 net/vmw_vsock/diag.c                         | 186 ++++++++
 net/vmw_vsock/hyperv_transport.c             |  12 +-
 net/vmw_vsock/virtio_transport.c             |   2 +-
 net/vmw_vsock/virtio_transport_common.c      |  22 +-
 net/vmw_vsock/vmci_transport.c               |  34 +-
 net/vmw_vsock/vmci_transport_notify.c        |   2 +-
 net/vmw_vsock/vmci_transport_notify_qstate.c |   2 +-
 tools/testing/vsock/control.c                | 219 +++++++++
 tools/testing/vsock/timeout.c                |  64 +++
 tools/testing/vsock/vsock_diag_test.c        | 681 +++++++++++++++++++++++++++
 net/vmw_vsock/Kconfig                        |  10 +
 tools/testing/vsock/.gitignore               |   2 +
 tools/testing/vsock/README                   |  36 ++
 21 files changed, 1360 insertions(+), 73 deletions(-)
 create mode 100644 tools/testing/vsock/Makefile
 create mode 100644 include/uapi/linux/vm_sockets_diag.h
 create mode 100644 tools/testing/vsock/control.h
 create mode 100644 tools/testing/vsock/timeout.h
 create mode 100644 net/vmw_vsock/diag.c
 create mode 100644 tools/testing/vsock/control.c
 create mode 100644 tools/testing/vsock/timeout.c
 create mode 100644 tools/testing/vsock/vsock_diag_test.c
 create mode 100644 tools/testing/vsock/.gitignore
 create mode 100644 tools/testing/vsock/README
Signature · 1 line
2.13.6