diff options
-rw-r--r-- | net/ipv4/inet_diag.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 57a1bd97ea35..2642f317af8f 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -743,6 +743,10 @@ static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, | |||
743 | continue; | 743 | continue; |
744 | } | 744 | } |
745 | 745 | ||
746 | if (r->sdiag_family != AF_UNSPEC && | ||
747 | sk->sk_family != r->sdiag_family) | ||
748 | goto next_listen; | ||
749 | |||
746 | if (r->id.idiag_sport != inet->inet_sport && | 750 | if (r->id.idiag_sport != inet->inet_sport && |
747 | r->id.idiag_sport) | 751 | r->id.idiag_sport) |
748 | goto next_listen; | 752 | goto next_listen; |
@@ -808,6 +812,9 @@ skip_listen_ht: | |||
808 | goto next_normal; | 812 | goto next_normal; |
809 | if (!(r->idiag_states & (1 << sk->sk_state))) | 813 | if (!(r->idiag_states & (1 << sk->sk_state))) |
810 | goto next_normal; | 814 | goto next_normal; |
815 | if (r->sdiag_family != AF_UNSPEC && | ||
816 | sk->sk_family != r->sdiag_family) | ||
817 | goto next_normal; | ||
811 | if (r->id.idiag_sport != inet->inet_sport && | 818 | if (r->id.idiag_sport != inet->inet_sport && |
812 | r->id.idiag_sport) | 819 | r->id.idiag_sport) |
813 | goto next_normal; | 820 | goto next_normal; |
@@ -830,6 +837,9 @@ next_normal: | |||
830 | 837 | ||
831 | if (num < s_num) | 838 | if (num < s_num) |
832 | goto next_dying; | 839 | goto next_dying; |
840 | if (r->sdiag_family != AF_UNSPEC && | ||
841 | tw->tw_family != r->sdiag_family) | ||
842 | goto next_dying; | ||
833 | if (r->id.idiag_sport != tw->tw_sport && | 843 | if (r->id.idiag_sport != tw->tw_sport && |
834 | r->id.idiag_sport) | 844 | r->id.idiag_sport) |
835 | goto next_dying; | 845 | goto next_dying; |
@@ -873,7 +883,7 @@ static int inet_diag_dump_compat(struct sk_buff *skb, struct netlink_callback *c | |||
873 | struct nlattr *bc = NULL; | 883 | struct nlattr *bc = NULL; |
874 | int hdrlen = sizeof(struct inet_diag_req_compat); | 884 | int hdrlen = sizeof(struct inet_diag_req_compat); |
875 | 885 | ||
876 | req.sdiag_family = rc->idiag_family; | 886 | req.sdiag_family = AF_UNSPEC; /* compatibility */ |
877 | req.sdiag_protocol = inet_diag_type2proto(cb->nlh->nlmsg_type); | 887 | req.sdiag_protocol = inet_diag_type2proto(cb->nlh->nlmsg_type); |
878 | req.idiag_ext = rc->idiag_ext; | 888 | req.idiag_ext = rc->idiag_ext; |
879 | req.idiag_states = rc->idiag_states; | 889 | req.idiag_states = rc->idiag_states; |