netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [Bugme-new] [Bug 10437] New: MSG_ERRQUEUE messages do not pass to connected raw sockets
       [not found] <bug-10437-10286@http.bugzilla.kernel.org/>
@ 2008-04-10 17:34 ` Andrew Morton
  2008-04-11 11:02   ` [PATCH] [IPV6]: bug 10437: " Dmitry Butskoy
  2008-04-14  6:15   ` [Bugme-new] [Bug 10437] New: " David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2008-04-10 17:34 UTC (permalink / raw)
  To: dmitry; +Cc: bugme-daemon, netdev

(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Thu, 10 Apr 2008 05:53:39 -0700 (PDT) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=10437
> 
>            Summary: MSG_ERRQUEUE messages do not pass to connected raw
>                     sockets
>            Product: Networking
>            Version: 2.5
>      KernelVersion: 2.6.24
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: high
>           Priority: P1
>          Component: IPV6
>         AssignedTo: yoshfuji@linux-ipv6.org
>         ReportedBy: dmitry@butskoy.name
> 
> 
> There was a similar bug #8747 , but the fix is not somplete.
> 
> Problem Description:
> 
> It is related to the possibility to obtain MSG_ERRQUEUE messages from the udp
> and raw sockets, both connected and unconnected.
> 
> There is a bug in net/ipv6/icmp.c code, which prevents such messages to
> be delivered to the errqueue of the correspond raw socket, when the socket is
> CONNECTED. The bug is related to wrong obtaining of the saddr/daddr pair, used
> to find the raw socket.
> 
> Consider __raw_v6_lookup() function from net/ipv6/raw.c. When a raw socket is
> looked up usual way, it is something like:
> 
> sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr, IP6CB(skb)->iif);
> 
> where "daddr" is a destination address of the incoming packet (IOW our local
> address), "saddr" is a source address of the incoming packet (the remote end).
> 
> But when the raw socket is looked up for some icmp error report, in
> net/ipv6/icmp.c:icmpv6_notify() , daddr/saddr must be obtained from the echoed
> fragment of the "bad" packet, not from the ipv6 header of the icmp packet
> itself.
> 
> Consider:
> 
> ipv6_header -- icmp_header -- echoed_ipv6_header -- at_least_8_bytes ...
> 
> Now saddr/daddr, used for __raw_v6_lookup, are from the first "ipv6_header",
> but must be from the "echoed_ipv6_header" .
> 
> 
> In the previous bug #8747, I assumed that the issue is just a typo, by
> switching saddr/daddr in agrument list. Unfortunately, it appears that the pair
> is even obtained from the wrong place...
> 
> 
> Steps to reproduce:
> 
> Create some raw socket, connect it to an address, and cause some error
> situation: f.e. set ttl=1 where the remote address is more than 1 hop to reach.
> Set IPV6_RECVERR .
> Then send something and wait for the error (f.e. poll() with POLLERR|POLLIN).
> You should receive "time exceeded" icmp message (because of "ttl=1"), but the
> socket do not receive it.
> 
> If you do not connect your raw socket, you will receive MSG_ERRQUEUE 
> successfully. (The reason is that for unconnected socket there are no actual
> checks for local/remote addresses).
> 

(There's more info, and a patch at the above link).

Dmitry, I'd suggest that you send the patch via email to
netdev@vger.kernel.org and to YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>.

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

* [PATCH] [IPV6]: bug 10437:  MSG_ERRQUEUE messages do not pass to connected raw sockets
  2008-04-10 17:34 ` [Bugme-new] [Bug 10437] New: MSG_ERRQUEUE messages do not pass to connected raw sockets Andrew Morton
@ 2008-04-11 11:02   ` Dmitry Butskoy
  2008-04-11 11:12     ` YOSHIFUJI Hideaki / 吉藤英明
  2008-04-14  6:15   ` [Bugme-new] [Bug 10437] New: " David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Butskoy @ 2008-04-11 11:02 UTC (permalink / raw)
  Cc: netdev

Andrew Morton wrote:
> Dmitry, I'd suggest that you send the patch via email to
> netdev@vger.kernel.org 

OK, resend

> and to YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>.
>   
It seems that I cannot reach this e-mail address from my country :( (some terrible antispam?)



The small patch to fix bug #10437 .

See description of the bug at 
http://bugzilla.kernel.org/show_bug.cgi?id=10437


Dmitry Butskoy
http://www.fedoraproject.org/wiki/DmitryButskoy

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

* Re: [PATCH] [IPV6]: bug 10437: MSG_ERRQUEUE messages do not pass to connected raw sockets
  2008-04-11 11:02   ` [PATCH] [IPV6]: bug 10437: " Dmitry Butskoy
@ 2008-04-11 11:12     ` YOSHIFUJI Hideaki / 吉藤英明
  2008-04-11 11:39       ` Dmitry Butskoy
  0 siblings, 1 reply; 5+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-04-11 11:12 UTC (permalink / raw)
  To: buc; +Cc: netdev, yoshfuji

In article <47FF455C.2070205@odu.neva.ru> (at Fri, 11 Apr 2008 15:02:52 +0400), Dmitry Butskoy <buc@odusz.so-cdu.ru> says:

> Andrew Morton wrote:
> > Dmitry, I'd suggest that you send the patch via email to
> > netdev@vger.kernel.org 
> 
> OK, resend
> 
> > and to YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>.
> >   
> It seems that I cannot reach this e-mail address from my country :( (some terrible antispam?)
> 
> 
> 
> The small patch to fix bug #10437 .
> 
> See description of the bug at 
> http://bugzilla.kernel.org/show_bug.cgi?id=10437

I'm going to agree.

Your patch is for 2.6.24-stable
Can you provide patches for linux-2.6.25-rc, please?

Thanks.

--yoshfuji

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

* Re: [PATCH] [IPV6]: bug 10437: MSG_ERRQUEUE messages do not pass to connected raw sockets
  2008-04-11 11:12     ` YOSHIFUJI Hideaki / 吉藤英明
@ 2008-04-11 11:39       ` Dmitry Butskoy
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Butskoy @ 2008-04-11 11:39 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 936 bytes --]

YOSHIFUJI Hideaki / 吉藤英明 wrote:
> In article <47FF455C.2070205@odu.neva.ru> (at Fri, 11 Apr 2008 15:02:52 +0400), Dmitry Butskoy <buc@odusz.so-cdu.ru> says:
>
>   
>> Andrew Morton wrote:
>>     
>>> Dmitry, I'd suggest that you send the patch via email to
>>> netdev@vger.kernel.org 
>>>       
>> OK, resend
>>
>>     
>>> and to YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>.
>>>   
>>>       
>> It seems that I cannot reach this e-mail address from my country :( (some terrible antispam?)
>>
>>
>>
>> The small patch to fix bug #10437 .
>>
>> See description of the bug at 
>> http://bugzilla.kernel.org/show_bug.cgi?id=10437
>>     
>
> I'm going to agree.
>
> Your patch is for 2.6.24-stable
> Can you provide patches for linux-2.6.25-rc, please?
>   

Attached.

Could it be fixed for, say 2.6.24.5, as well?

If it is possible, please, report me at what next stable kernel version 
it will appear to be fixed...


~buc



[-- Attachment #2: ipv6-2.6.25-raw_socket_msg_errqueue.patch --]
[-- Type: text/x-diff, Size: 521 bytes --]

diff -Nrbu ipv6/raw.c ipv6.OK/raw.c
--- ipv6/raw.c	2008-04-01 23:44:26.000000000 +0400
+++ ipv6.OK/raw.c	2008-04-11 15:33:30.000000000 +0400
@@ -372,8 +372,8 @@
 	read_lock(&raw_v6_hashinfo.lock);
 	sk = sk_head(&raw_v6_hashinfo.ht[hash]);
 	if (sk != NULL) {
-		saddr = &ipv6_hdr(skb)->saddr;
-		daddr = &ipv6_hdr(skb)->daddr;
+		saddr = &((struct ipv6hdr *)skb->data)->saddr;
+		daddr = &((struct ipv6hdr *)skb->data)->daddr;
 		net = skb->dev->nd_net;
 
 		while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr,

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

* Re: [Bugme-new] [Bug 10437] New: MSG_ERRQUEUE messages do not pass to connected raw sockets
  2008-04-10 17:34 ` [Bugme-new] [Bug 10437] New: MSG_ERRQUEUE messages do not pass to connected raw sockets Andrew Morton
  2008-04-11 11:02   ` [PATCH] [IPV6]: bug 10437: " Dmitry Butskoy
@ 2008-04-14  6:15   ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2008-04-14  6:15 UTC (permalink / raw)
  To: akpm; +Cc: dmitry, bugme-daemon, netdev

From: Andrew Morton <akpm@linux-foundation.org>
Date: Thu, 10 Apr 2008 10:34:44 -0700

> Dmitry, I'd suggest that you send the patch via email to
> netdev@vger.kernel.org and to YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>.

This person is having trouble emailing things to the lists and elsewhere,
for whatever reason, and he states this in the bugzilla entry so asking
him to email a patch somewhere isn't going to help.

The code in this area has changed a bit, here is the patch I just checked
into net-2.6 and which I'll push to Linus for 2.6.25 and will also submit
for the 2.6.24-stable branch.

commit b45e9189c058bfa495073951ff461ee0eea968be
Author: David S. Miller <davem@davemloft.net>
Date:   Sun Apr 13 23:14:15 2008 -0700

    [IPV6]: Fix ipv6 address fetching in raw6_icmp_error().
    
    Fixes kernel bugzilla 10437
    
    Based almost entirely upon a patch by Dmitry Butskoy.
    
    When deciding what raw sockets to deliver the ICMPv6
    to, we should use the addresses in the ICMPv6 quoted
    IPV6 header, not the top-level one.
    
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 8897ccf..0a6fbc1 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -372,8 +372,10 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
 	read_lock(&raw_v6_hashinfo.lock);
 	sk = sk_head(&raw_v6_hashinfo.ht[hash]);
 	if (sk != NULL) {
-		saddr = &ipv6_hdr(skb)->saddr;
-		daddr = &ipv6_hdr(skb)->daddr;
+		struct ipv6hdr *hdr = (struct ipv6hdr *) skb->data;
+
+		saddr = &hdr->saddr;
+		daddr = &hdr->daddr;
 		net = skb->dev->nd_net;
 
 		while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr,

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

end of thread, other threads:[~2008-04-14  6:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <bug-10437-10286@http.bugzilla.kernel.org/>
2008-04-10 17:34 ` [Bugme-new] [Bug 10437] New: MSG_ERRQUEUE messages do not pass to connected raw sockets Andrew Morton
2008-04-11 11:02   ` [PATCH] [IPV6]: bug 10437: " Dmitry Butskoy
2008-04-11 11:12     ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-11 11:39       ` Dmitry Butskoy
2008-04-14  6:15   ` [Bugme-new] [Bug 10437] New: " 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).