aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/inet_diag.h1
-rw-r--r--net/ipv4/inet_diag.c17
2 files changed, 16 insertions, 2 deletions
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index abf5028db98..f7baaf63742 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -6,6 +6,7 @@
6/* Just some random number */ 6/* Just some random number */
7#define TCPDIAG_GETSOCK 18 7#define TCPDIAG_GETSOCK 18
8#define DCCPDIAG_GETSOCK 19 8#define DCCPDIAG_GETSOCK 19
9#define SOCK_DIAG_BY_FAMILY 20
9 10
10#define INET_DIAG_GETSOCK_MAX 24 11#define INET_DIAG_GETSOCK_MAX 24
11 12
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index a5f3c40ac3c..eb6bdfa9480 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -850,7 +850,7 @@ unlock:
850 return skb->len; 850 return skb->len;
851} 851}
852 852
853static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 853static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh)
854{ 854{
855 int hdrlen = sizeof(struct inet_diag_req); 855 int hdrlen = sizeof(struct inet_diag_req);
856 856
@@ -877,9 +877,22 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
877 return inet_diag_get_exact(skb, nlh); 877 return inet_diag_get_exact(skb, nlh);
878} 878}
879 879
880static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
881{
882 return -EOPNOTSUPP;
883}
884
880static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 885static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
881{ 886{
882 return inet_diag_rcv_msg(skb, nlh); 887 switch (nlh->nlmsg_type) {
888 case TCPDIAG_GETSOCK:
889 case DCCPDIAG_GETSOCK:
890 return inet_diag_rcv_msg_compat(skb, nlh);
891 case SOCK_DIAG_BY_FAMILY:
892 return __sock_diag_rcv_msg(skb, nlh);
893 default:
894 return -EINVAL;
895 }
883} 896}
884 897
885static DEFINE_MUTEX(sock_diag_mutex); 898static DEFINE_MUTEX(sock_diag_mutex);