summaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_diag.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2011-12-06 08:57:06 +0100
committerDavid S. Miller <davem@davemloft.net>2011-12-06 19:58:01 +0100
commit8d34172dfdb762a306cdf58b547aa10d798622ec (patch)
tree5ad5bbd9117ea444eb06b0519c61f77576818d79 /net/ipv4/inet_diag.c
parentinet_diag: Partly rename inet_ to sock_ (diff)
downloadlinux-8d34172dfdb762a306cdf58b547aa10d798622ec.tar.xz
linux-8d34172dfdb762a306cdf58b547aa10d798622ec.zip
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: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r--net/ipv4/inet_diag.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index a5f3c40ac3c5..eb6bdfa9480c 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -850,7 +850,7 @@ unlock:
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);
@@ -877,9 +877,22 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *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)
{
- 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);