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: Lorenzo Colitti <lorenzo@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Lorenzo Colitti <lorenzo@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ce87fc6ce3
commit
7c1306723e
|
@ -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_sport, req->id.idiag_if);
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
else if (req->sdiag_family == AF_INET6)
|
||||
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);
|
||||
else if (req->sdiag_family == AF_INET6) {
|
||||
if (ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_dst) &&
|
||||
ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_src))
|
||||
sk = inet_lookup(net, hashinfo, req->id.idiag_dst[3],
|
||||
req->id.idiag_dport, req->id.idiag_src[3],
|
||||
req->id.idiag_sport, 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
|
||||
else
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
|
Loading…
Reference in New Issue