Skip to content

sctp: support sctp_diag in kernel

Xin Long linux-sctp netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 5 repliesIn review
  2. v26 patches 15 repliesSuperseded
  3. v17 patches 6 repliesSuperseded

Changes in v3 from the cover letter

do some improvements and fixes in patch 1-4, see the details in each patch's comment.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6sctp: add sctp_info dump api for sctp_diaginclude/linux/sctp.h include/net/sctp/sctp.h net/sctp/socket.c+156 -03 replies
2/6sctp: export some apis or variables for sctp_diag and reuse some for procinclude/net/sctp/sctp.h net/sctp/proc.c net/sctp/socket.c+156 -630 replies
3/6sctp: export some functions for sctp_diag in inet_diagnet/ipv4/inet_diag.c+41 -260 replies
4/6sctp: add the sctp_diag.c fileinclude/uapi/linux/inet_diag.h net/sctp/Kconfig net/sctp/Makefile +1 more+504 -01 reply
5/6sctp: merge the seq_start/next/exits in remaddrs and assocsnet/sctp/proc.c+9 -360 replies
6/6sctp: fix some rhashtable functions using in sctp proc/diagnet/sctp/proc.c net/sctp/socket.c+16 -60 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCHv3 net-next 0/6] sctp: support sctp_diag in kernel

This patchset will add sctp_diag module to implement diag interface on sctp in kernel.

For a listening sctp endpoint, we will just dump it's ep info. For a sctp connection, we will the assoc info and it's ep info.

The ss dump will looks like:

[iproute2]# ./misc/ss --sctp -n -l

State      Recv-Q Send-Q   Local Address:Port       Peer Address:Port
LISTEN     0      128      172.16.254.254:8888      *:*
LISTEN     0      5        127.0.0.1:1234           *:*
LISTEN     0      5        127.0.0.1:1234           *:*
  - ESTAB  0      0        127.0.0.1%lo:1234        127.0.0.1:4321
LISTEN     0      128      172.16.254.254:8888      *:*
  - ESTAB  0      0        172.16.254.254%eth1:8888 172.16.253.253:8888
  - ESTAB  0      0        172.16.254.254%eth1:8888 172.16.1.1:8888
  - ESTAB  0      0        172.16.254.254%eth1:8888 172.16.1.2:8888
  - ESTAB  0      0        172.16.254.254%eth1:8888 172.16.2.1:8888
  - ESTAB  0      0        172.16.254.254%eth1:8888 172.16.2.2:8888
  - ESTAB  0      0        172.16.254.254%eth1:8888 172.16.3.1:8888
  - ESTAB  0      0        172.16.254.254%eth1:8888 172.16.3.2:8888
LISTEN     0      0        127.0.0.1:4321           *:*
  - ESTAB  0      0        127.0.0.1%lo:4321        127.0.0.1:1234

The entries with '- ESTAB' are the assocs, some of them may belong to the same endpoint. So we will dump the parent endpoint first, like the entry with 'LISTEN'. then dump the assocs. ep and assocs entries will be dumped in right order so that ss can show them in tree format easily.

Besides, this patchset also simplifies sctp proc codes, cause it has some similar codes with sctp diag in sctp transport traversal.

v1->v2:
1. inet_diag_get_handler needs to return it as const.
2. merge 5/7 into 2/7 of v1.

v2->v3:
do some improvements and fixes in patch 1-4, see the details in each patch's comment.

Xin Long (6):
sctp: add sctp_info dump api for sctp_diag
sctp: export some apis or variables for sctp_diag and reuse some for
proc
sctp: export some functions for sctp_diag in inet_diag
sctp: add the sctp_diag.c file
sctp: merge the seq_start/next/exits in remaddrs and assocs
sctp: fix some rhashtable functions using in sctp proc/diag

 include/linux/sctp.h           |  67 ++++++
 include/net/sctp/sctp.h        |  16 ++
 include/uapi/linux/inet_diag.h |   2 +
 net/ipv4/inet_diag.c           |  67 +++---
 net/sctp/Kconfig               |   4 +
 net/sctp/Makefile              |   1 +
 net/sctp/proc.c                | 105 ++-------
 net/sctp/sctp_diag.c           | 497 +++++++++++++++++++++++++++++++++++++++++
 net/sctp/socket.c              | 216 ++++++++++++++++++
 9 files changed, 863 insertions(+), 112 deletions(-)
 create mode 100644 net/sctp/sctp_diag.c
Signature · 1 line
2.1.0