Commit 7c130672 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: diag: support v4mapped sockets in inet_diag_find_one_icsk()

Lorenzo reported that we could not properly find v4mapped sockets
in inet_diag_find_one_icsk(). This patch fixes the issue.
Reported-by: default avatarLorenzo Colitti <lorenzo@google.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarLorenzo Colitti <lorenzo@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce87fc6c
...@@ -361,13 +361,20 @@ struct sock *inet_diag_find_one_icsk(struct net *net, ...@@ -361,13 +361,20 @@ struct sock *inet_diag_find_one_icsk(struct net *net,
req->id.idiag_dport, req->id.idiag_src[0], req->id.idiag_dport, req->id.idiag_src[0],
req->id.idiag_sport, req->id.idiag_if); req->id.idiag_sport, req->id.idiag_if);
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
else if (req->sdiag_family == AF_INET6) else if (req->sdiag_family == AF_INET6) {
sk = inet6_lookup(net, hashinfo, if (ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_dst) &&
(struct in6_addr *)req->id.idiag_dst, ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_src))
req->id.idiag_dport, sk = inet_lookup(net, hashinfo, req->id.idiag_dst[3],
(struct in6_addr *)req->id.idiag_src, req->id.idiag_dport, req->id.idiag_src[3],
req->id.idiag_sport, req->id.idiag_sport, req->id.idiag_if);
req->id.idiag_if); else
sk = inet6_lookup(net, hashinfo,
(struct in6_addr *)req->id.idiag_dst,
req->id.idiag_dport,
(struct in6_addr *)req->id.idiag_src,
req->id.idiag_sport,
req->id.idiag_if);
}
#endif #endif
else else
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
......
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