* [PATCH net] net: diag: support v4mapped sockets in inet_diag_find_one_icsk()
@ 2016-01-21 0:25 Eric Dumazet
2016-01-21 2:37 ` Lorenzo Colitti
2016-01-21 2:51 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2016-01-21 0:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Lorenzo Colitti
From: Eric Dumazet <edumazet@google.com>
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>
---
net/ipv4/inet_diag.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 8bb8e7ad8548..6029157a19ed 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: diag: support v4mapped sockets in inet_diag_find_one_icsk()
2016-01-21 0:25 [PATCH net] net: diag: support v4mapped sockets in inet_diag_find_one_icsk() Eric Dumazet
@ 2016-01-21 2:37 ` Lorenzo Colitti
2016-01-21 2:51 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Colitti @ 2016-01-21 2:37 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
On Wed, Jan 20, 2016 at 4:25 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 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>
This fixes the problem for me. I tested that SOCK_DESTROY (which uses
inet_diag_find_one_icsk) can successfully find/close the following
AF_INET6 sockets:
- Listen sockets bound to either :: or ::ffff:0.0.0.0
- Accepted IPv4 connections on sockets bound to either :: or ::ffff:0.0.0.0
- Active IPv4 connections
Acked-by: Lorenzo Colitti <lorenzo@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: diag: support v4mapped sockets in inet_diag_find_one_icsk()
2016-01-21 0:25 [PATCH net] net: diag: support v4mapped sockets in inet_diag_find_one_icsk() Eric Dumazet
2016-01-21 2:37 ` Lorenzo Colitti
@ 2016-01-21 2:51 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-01-21 2:51 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, lorenzo
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 20 Jan 2016 16:25:01 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> 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>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-21 2:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 0:25 [PATCH net] net: diag: support v4mapped sockets in inet_diag_find_one_icsk() Eric Dumazet
2016-01-21 2:37 ` Lorenzo Colitti
2016-01-21 2:51 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).