Skip to content

Commit 8f840e4

Browse files
lxindavem330
authored andcommitted
sctp: add the sctp_diag.c file
This one will implement all the interface of inet_diag, inet_diag_handler. which includes sctp_diag_dump, sctp_diag_dump_one and sctp_diag_get_info. It will work as a module, and register inet_diag_handler when loading. v2->v3: - fix the mistake in inet_assoc_attr_size(). - change inet_diag_msg_laddrs_fill() name to inet_diag_msg_sctpladdrs_fill. - change inet_diag_msg_paddrs_fill() name to inet_diag_msg_sctpaddrs_fill. - add inet_diag_msg_sctpinfo_fill() to make asoc/ep fill code clearer. - add inet_diag_msg_sctpasoc_fill() to make asoc fill code clearer. - merge inet_asoc_diag_fill() and inet_ep_diag_fill() to inet_sctp_diag_fill(). - call sctp_diag_get_info() directly, instead by handler, cause the caller is in the same file with it. - call lock_sock in sctp_tsp_dump_one() to make sure we call get sctp info safely. - after lock_sock(sk), we should check sk != assoc->base.sk. - change mem[SK_MEMINFO_WMEM_ALLOC] to asoc->sndbuf_used for asoc dump when asoc->ep->sndbuf_policy is set. don't use INET_DIAG_MEMINFO attr any more. Signed-off-by: Xin Long <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cb2050a commit 8f840e4

File tree

4 files changed

+504
-0
lines changed

4 files changed

+504
-0
lines changed

include/uapi/linux/inet_diag.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ enum {
113113
INET_DIAG_DCTCPINFO,
114114
INET_DIAG_PROTOCOL, /* response attribute only */
115115
INET_DIAG_SKV6ONLY,
116+
INET_DIAG_LOCALS,
117+
INET_DIAG_PEERS,
116118
};
117119

118120
#define INET_DIAG_MAX INET_DIAG_SKV6ONLY

net/sctp/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,9 @@ config SCTP_COOKIE_HMAC_SHA1
9999
select CRYPTO_HMAC if SCTP_COOKIE_HMAC_SHA1
100100
select CRYPTO_SHA1 if SCTP_COOKIE_HMAC_SHA1
101101

102+
config INET_SCTP_DIAG
103+
depends on INET_DIAG
104+
def_tristate INET_DIAG
105+
102106

103107
endif # IP_SCTP

net/sctp/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
obj-$(CONFIG_IP_SCTP) += sctp.o
66
obj-$(CONFIG_NET_SCTPPROBE) += sctp_probe.o
7+
obj-$(CONFIG_INET_SCTP_DIAG) += sctp_diag.o
78

89
sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \
910
protocol.o endpointola.o associola.o \

0 commit comments

Comments
 (0)