netlink: Diag core and basic socket info dumping (v2)
The netlink_diag can be built as a module, just like it's done in unix sockets. The core dumping message carries the basic info about netlink sockets: family, type and protocol, portis, dst_group, dst_portid, state. Groups can be received as an optional parameter NETLINK_DIAG_GROUPS. Netlink sockets cab be filtered by protocols. The socket inode number and cookie is reserved for future per-socket info retrieving. The per-protocol filtering is also reserved for future by requiring the sdiag_protocol to be zero. The file /proc/net/netlink doesn't provide enough information for dumping netlink sockets. It doesn't provide dst_group, dst_portid, groups above 32. v2: fix NETLINK_DIAG_MAX. Now it's equal to the last constant. Acked-by: Pavel Emelyanov <xemul@parallels.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Pablo Neira Ayuso <pablo@netfilter.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Gao feng <gaofeng@cn.fujitsu.com> Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
0f29c76864
commit
eaaa313926
42
include/uapi/linux/netlink_diag.h
Normal file
42
include/uapi/linux/netlink_diag.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef __NETLINK_DIAG_H__
|
||||
#define __NETLINK_DIAG_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct netlink_diag_req {
|
||||
__u8 sdiag_family;
|
||||
__u8 sdiag_protocol;
|
||||
__u16 pad;
|
||||
__u32 ndiag_ino;
|
||||
__u32 ndiag_show;
|
||||
__u32 ndiag_cookie[2];
|
||||
};
|
||||
|
||||
struct netlink_diag_msg {
|
||||
__u8 ndiag_family;
|
||||
__u8 ndiag_type;
|
||||
__u8 ndiag_protocol;
|
||||
__u8 ndiag_state;
|
||||
|
||||
__u32 ndiag_portid;
|
||||
__u32 ndiag_dst_portid;
|
||||
__u32 ndiag_dst_group;
|
||||
__u32 ndiag_ino;
|
||||
__u32 ndiag_cookie[2];
|
||||
};
|
||||
|
||||
enum {
|
||||
NETLINK_DIAG_MEMINFO,
|
||||
NETLINK_DIAG_GROUPS,
|
||||
|
||||
__NETLINK_DIAG_MAX,
|
||||
};
|
||||
|
||||
#define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1)
|
||||
|
||||
#define NDIAG_PROTO_ALL ((__u8) ~0)
|
||||
|
||||
#define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */
|
||||
#define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user