mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
tipc: implement socket diagnostics for AF_TIPC
This commit adds socket diagnostics capability for AF_TIPC in netlink family NETLINK_SOCK_DIAG in a new kernel module (diag.ko). The following are key design considerations: - config TIPC_DIAG has default y, like INET_DIAG. - only requests with flag NLM_F_DUMP is supported (dump all). - tipc_sock_diag_req message is introduced to send filter parameters. - the response attributes are of TLV, some nested. To avoid exposing data structures between diag and tipc modules and avoid code duplication, the following additions are required: - export tipc_nl_sk_walk function to reuse socket iterator. - export tipc_sk_fill_sock_diag to fill the tipc diag attributes. - create a sock_diag response message in __tipc_add_sock_diag defined in diag.c and use the above exported tipc_sk_fill_sock_diag to fill response. Acked-by: Jon Maloy <jon.maloy@ericsson.com> Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com> Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
dfde331e75
commit
c30b70deb5
7 changed files with 238 additions and 6 deletions
|
|
@ -114,6 +114,13 @@ enum {
|
|||
TIPC_NLA_SOCK_REF, /* u32 */
|
||||
TIPC_NLA_SOCK_CON, /* nest */
|
||||
TIPC_NLA_SOCK_HAS_PUBL, /* flag */
|
||||
TIPC_NLA_SOCK_STAT, /* nest */
|
||||
TIPC_NLA_SOCK_TYPE, /* u32 */
|
||||
TIPC_NLA_SOCK_INO, /* u32 */
|
||||
TIPC_NLA_SOCK_UID, /* u32 */
|
||||
TIPC_NLA_SOCK_TIPC_STATE, /* u32 */
|
||||
TIPC_NLA_SOCK_COOKIE, /* u64 */
|
||||
TIPC_NLA_SOCK_PAD, /* flag */
|
||||
|
||||
__TIPC_NLA_SOCK_MAX,
|
||||
TIPC_NLA_SOCK_MAX = __TIPC_NLA_SOCK_MAX - 1
|
||||
|
|
@ -238,6 +245,17 @@ enum {
|
|||
TIPC_NLA_CON_MAX = __TIPC_NLA_CON_MAX - 1
|
||||
};
|
||||
|
||||
/* Nest, socket statistics info */
|
||||
enum {
|
||||
TIPC_NLA_SOCK_STAT_RCVQ, /* u32 */
|
||||
TIPC_NLA_SOCK_STAT_SENDQ, /* u32 */
|
||||
TIPC_NLA_SOCK_STAT_LINK_CONG, /* flag */
|
||||
TIPC_NLA_SOCK_STAT_CONN_CONG, /* flag */
|
||||
|
||||
__TIPC_NLA_SOCK_STAT_MAX,
|
||||
TIPC_NLA_SOCK_STAT_MAX = __TIPC_NLA_SOCK_STAT_MAX - 1
|
||||
};
|
||||
|
||||
/* Nest, link propreties. Valid for link, media and bearer */
|
||||
enum {
|
||||
TIPC_NLA_PROP_UNSPEC,
|
||||
|
|
|
|||
17
include/uapi/linux/tipc_sockets_diag.h
Normal file
17
include/uapi/linux/tipc_sockets_diag.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/* AF_TIPC sock_diag interface for querying open sockets */
|
||||
|
||||
#ifndef _UAPI__TIPC_SOCKETS_DIAG_H__
|
||||
#define _UAPI__TIPC_SOCKETS_DIAG_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/sock_diag.h>
|
||||
|
||||
/* Request */
|
||||
struct tipc_sock_diag_req {
|
||||
__u8 sdiag_family; /* must be AF_TIPC */
|
||||
__u8 sdiag_protocol; /* must be 0 */
|
||||
__u16 pad; /* must be 0 */
|
||||
__u32 tidiag_states; /* query*/
|
||||
};
|
||||
#endif /* _UAPI__TIPC_SOCKETS_DIAG_H__ */
|
||||
Loading…
Reference in a new issue