linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ipv4-mapped ipv4 connect() for UDP broken in test10
@ 2003-11-26  8:17 Felix von Leitner
  2003-11-26 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 4+ messages in thread
From: Felix von Leitner @ 2003-11-26  8:17 UTC (permalink / raw)
  To: linux-kernel

My IPv6 port for djbdns' dnscache does not work with -test10.

The symptom is that all queries time out.

Some digging reveals that djbdns does this (with scope_id 0):

  socket(PF_INET6,...)
  bind socket to ::
  connect() socket to IP of peer (in this case, 210.81.13.179)
  send() dns query

at this point, the query is not sent over ppp0 as it should, but it is
sent to lo.  Not only that, but the queries are _received_ by the same
djbdns (with servfail), although the destination IP is as said above
210.81.13.179 and none of my local IPs: 10.0.0.6, 127.0.0.1, or
217.88.123.45.

Any ideas?  Please do not ship 2.6.0-final with a bug like this in it!

Felix

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ipv4-mapped ipv4 connect() for UDP broken in test10
  2003-11-26  8:17 ipv4-mapped ipv4 connect() for UDP broken in test10 Felix von Leitner
@ 2003-11-26 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
  2003-11-27 12:11   ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 4+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-11-26 10:04 UTC (permalink / raw)
  To: felix-kernel; +Cc: netdev, linux-kernel, yoshfuji, davem

In article <20031126081745.GA31415@codeblau.de> (at Wed, 26 Nov 2003 09:17:45 +0100), Felix von Leitner <felix-kernel@fefe.de> says:

> Some digging reveals that djbdns does this (with scope_id 0):
> 
>   socket(PF_INET6,...)
>   bind socket to ::
>   connect() socket to IP of peer (in this case, 210.81.13.179)
>   send() dns query
> 
> at this point, the query is not sent over ppp0 as it should, but it is
> sent to lo.  Not only that, but the queries are _received_ by the same
> djbdns (with servfail), although the destination IP is as said above
> 210.81.13.179 and none of my local IPs: 10.0.0.6, 127.0.0.1, or
> 217.88.123.45.

Please apply this patch.
(But I'm not sure this fix your problem...)

===== net/ipv6/udp.c 1.54 vs edited =====
--- 1.54/net/ipv6/udp.c	Tue Nov 18 11:41:56 2003
+++ edited/net/ipv6/udp.c	Wed Nov 26 19:01:15 2003
@@ -825,7 +825,7 @@
 			struct sockaddr_in sin;
 			sin.sin_family = AF_INET;
 			sin.sin_port = sin6 ? sin6->sin6_port : inet->dport;
-			sin.sin_addr.s_addr = daddr->s6_addr[3];
+			sin.sin_addr.s_addr = daddr->s6_addr32[3];
 			msg->msg_name = &sin;
 			msg->msg_namelen = sizeof(sin);
 do_udp_sendmsg:

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ipv4-mapped ipv4 connect() for UDP broken in test10
  2003-11-26 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2003-11-27 12:11   ` YOSHIFUJI Hideaki / 吉藤英明
  2003-11-28  1:03     ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-11-27 12:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, yoshfuji, felix-kernel

In article <20031126.190407.102714104.yoshfuji@linux-ipv6.org> (at Wed, 26 Nov 2003 19:04:07 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:

> (But I'm not sure this fix your problem...)

Well, let me clarify:

I'm sure the original code has a bug.
I do think that it is related to your report 
(but I don't have time to confirm it.)

s6_addr[3] should be s6_addr32[3] because the code is intended to extract 
IPv4 address from the IPv4-mapped address (::ffff:0.0.0.0/96)
to convert sockaddr_in6{} to sockaddr_in{}.

My analysis against the report is as follows:

Because the address is IPv4-mapped address (::ffff:0.0.0.0/96) at the point,
s6_addr[3] is always 0. The socket will be always connected to 0.0.0.0,
which means 127.0.0.1.

The patch is definitely logically correct.
Please apply this.  Thanks.

===== net/ipv6/udp.c 1.54 vs edited =====
--- 1.54/net/ipv6/udp.c	Tue Nov 18 11:41:56 2003
+++ edited/net/ipv6/udp.c	Wed Nov 26 19:01:15 2003
@@ -825,7 +825,7 @@
 			struct sockaddr_in sin;
 			sin.sin_family = AF_INET;
 			sin.sin_port = sin6 ? sin6->sin6_port : inet->dport;
-			sin.sin_addr.s_addr = daddr->s6_addr[3];
+			sin.sin_addr.s_addr = daddr->s6_addr32[3];
 			msg->msg_name = &sin;
 			msg->msg_namelen = sizeof(sin);
 do_udp_sendmsg:

--yoshfuji

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ipv4-mapped ipv4 connect() for UDP broken in test10
  2003-11-27 12:11   ` YOSHIFUJI Hideaki / 吉藤英明
@ 2003-11-28  1:03     ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2003-11-28  1:03 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / _$B5HF#1QL@
  Cc: netdev, linux-kernel, yoshfuji, felix-kernel

On Thu, 27 Nov 2003 21:11:35 +0900 (JST)
YOSHIFUJI Hideaki / _$B5HF#1QL@ <yoshfuji@linux-ipv6.org> wrote:

> In article <20031126.190407.102714104.yoshfuji@linux-ipv6.org> (at Wed, 26 Nov 2003 19:04:07 +0900 (JST)), YOSHIFUJI Hideaki / _$B5HF#1QL@ <yoshfuji@linux-ipv6.org> says:
> 
> I'm sure the original code has a bug.
> I do think that it is related to your report 
> (but I don't have time to confirm it.)
> 
> s6_addr[3] should be s6_addr32[3] because the code is intended to extract 
> IPv4 address from the IPv4-mapped address (::ffff:0.0.0.0/96)
> to convert sockaddr_in6{} to sockaddr_in{}.

I know, I know.

I did apply your patch already, sorry for not telling you this.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-11-28  1:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-26  8:17 ipv4-mapped ipv4 connect() for UDP broken in test10 Felix von Leitner
2003-11-26 10:04 ` YOSHIFUJI Hideaki / 吉藤英明
2003-11-27 12:11   ` YOSHIFUJI Hideaki / 吉藤英明
2003-11-28  1:03     ` David S. 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).