Commit 8d34172d authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

sock_diag: Introduce new message type

This type will run the family+protocol based socket dumping.
Also prepare the stub function for it.
Signed-off-by: default avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7f1fb60c
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
/* Just some random number */ /* Just some random number */
#define TCPDIAG_GETSOCK 18 #define TCPDIAG_GETSOCK 18
#define DCCPDIAG_GETSOCK 19 #define DCCPDIAG_GETSOCK 19
#define SOCK_DIAG_BY_FAMILY 20
#define INET_DIAG_GETSOCK_MAX 24 #define INET_DIAG_GETSOCK_MAX 24
......
...@@ -850,7 +850,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -850,7 +850,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
return skb->len; return skb->len;
} }
static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh)
{ {
int hdrlen = sizeof(struct inet_diag_req); int hdrlen = sizeof(struct inet_diag_req);
...@@ -877,9 +877,22 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -877,9 +877,22 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
return inet_diag_get_exact(skb, nlh); return inet_diag_get_exact(skb, nlh);
} }
static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{
return -EOPNOTSUPP;
}
static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{ {
return inet_diag_rcv_msg(skb, nlh); switch (nlh->nlmsg_type) {
case TCPDIAG_GETSOCK:
case DCCPDIAG_GETSOCK:
return inet_diag_rcv_msg_compat(skb, nlh);
case SOCK_DIAG_BY_FAMILY:
return __sock_diag_rcv_msg(skb, nlh);
default:
return -EINVAL;
}
} }
static DEFINE_MUTEX(sock_diag_mutex); static DEFINE_MUTEX(sock_diag_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment