linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* problems with udp header compression
@ 2014-10-30  9:42 Simon Vincent
  2014-10-30 10:18 ` Simon Vincent
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Vincent @ 2014-10-30  9:42 UTC (permalink / raw)
  To: linux-wpan

I think I have stumbled across a bug in the udp header compression or 
possibly in a higher layer of the network stack.

If I send a UDP message using a RAW socket[0] the src and dest port 
numbers get corrupted on 802.15.4 devices. This does not occur on ethernet.

If I print out the udp source and destination ports in 
compress_udp_header they are incorrect. The function udp_hdr is not 
pointing at the udp header but actually the ip6 header.

If I send a UDP message using a normal UDP socket I do not have this 
problem.

Any ideas?

Simon

[0] - socket(AF_INET6, SOCK_RAW, IPPROTO_RAW);

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

* Re: problems with udp header compression
  2014-10-30  9:42 problems with udp header compression Simon Vincent
@ 2014-10-30 10:18 ` Simon Vincent
  2014-11-01  9:10   ` Alexander Aring
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Vincent @ 2014-10-30 10:18 UTC (permalink / raw)
  To: linux-wpan

This appears to be because if you use a RAW socket with IPPROTO_RAW the 
ipv6 stack passes it straight through and the skb transport_header, 
network_header offset are not set.

Putting the following at the top of compress_udp_header fixes the 
problem but I am not sure it is safe.
if (skb->transport_header == skb->network_header){
         skb_set_transport_header(skb,sizeof(struct ipv6hdr));
     }


Simon
-
On 30/10/14 09:42, Simon Vincent wrote:
> I think I have stumbled across a bug in the udp header compression or 
> possibly in a higher layer of the network stack.
>
> If I send a UDP message using a RAW socket[0] the src and dest port 
> numbers get corrupted on 802.15.4 devices. This does not occur on 
> ethernet.
>
> If I print out the udp source and destination ports in 
> compress_udp_header they are incorrect. The function udp_hdr is not 
> pointing at the udp header but actually the ip6 header.
>
> If I send a UDP message using a normal UDP socket I do not have this 
> problem.
>
> Any ideas?
>
> Simon
>
> [0] - socket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: problems with udp header compression
  2014-10-30 10:18 ` Simon Vincent
@ 2014-11-01  9:10   ` Alexander Aring
  2014-11-04 12:34     ` Simon Vincent
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Aring @ 2014-11-01  9:10 UTC (permalink / raw)
  To: Simon Vincent; +Cc: linux-wpan

Hi Simon,

On Thu, Oct 30, 2014 at 10:18:35AM +0000, Simon Vincent wrote:
> This appears to be because if you use a RAW socket with IPPROTO_RAW the ipv6
> stack passes it straight through and the skb transport_header,
> network_header offset are not set.
> 
> Putting the following at the top of compress_udp_header fixes the problem
> but I am not sure it is safe.
> if (skb->transport_header == skb->network_header){
>         skb_set_transport_header(skb,sizeof(struct ipv6hdr));
>     }
> 

I see, this could make trouble for IPV6 RAW sockets. Can you please send
a patch for this and cc linux-bluetooth and linux-wpan. Also add some
comment why we do this is here, because the RAW socket issue.

Or just send it as RFC (means replace the PATCH into RFC in the
subject). Then we can talk about a better solution if this isn't a
perfect solution.

Also remove the unnecessary brackets -> checkpatch should show an error
because this.

- Alex

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

* Re: problems with udp header compression
  2014-11-01  9:10   ` Alexander Aring
@ 2014-11-04 12:34     ` Simon Vincent
  2014-11-04 12:37       ` Alexander Aring
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Vincent @ 2014-11-04 12:34 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan

I will send a patch. I have done lots of testing and it seems fine.
Do you want the patch based on bluetooth-next?

Simon

On 01/11/14 09:10, Alexander Aring wrote:
> Hi Simon,
>
> On Thu, Oct 30, 2014 at 10:18:35AM +0000, Simon Vincent wrote:
>> This appears to be because if you use a RAW socket with IPPROTO_RAW the ipv6
>> stack passes it straight through and the skb transport_header,
>> network_header offset are not set.
>>
>> Putting the following at the top of compress_udp_header fixes the problem
>> but I am not sure it is safe.
>> if (skb->transport_header == skb->network_header){
>>          skb_set_transport_header(skb,sizeof(struct ipv6hdr));
>>      }
>>
> I see, this could make trouble for IPV6 RAW sockets. Can you please send
> a patch for this and cc linux-bluetooth and linux-wpan. Also add some
> comment why we do this is here, because the RAW socket issue.
>
> Or just send it as RFC (means replace the PATCH into RFC in the
> subject). Then we can talk about a better solution if this isn't a
> perfect solution.
>
> Also remove the unnecessary brackets -> checkpatch should show an error
> because this.
>
> - Alex
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: problems with udp header compression
  2014-11-04 12:34     ` Simon Vincent
@ 2014-11-04 12:37       ` Alexander Aring
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Aring @ 2014-11-04 12:37 UTC (permalink / raw)
  To: Simon Vincent; +Cc: linux-wpan

On Tue, Nov 04, 2014 at 12:34:35PM +0000, Simon Vincent wrote:
> I will send a patch. I have done lots of testing and it seems fine.
> Do you want the patch based on bluetooth-next?
> 
yes, please eveything on bluetooth-next now.

Please cc:

linux-wpan@vger.kernel.org

and

linux-bluetooth@vger.kernel.org 

this problem should also occur on bluetooth 6LoWPAN.
I think it's some patch for "net/6lowpan/iphc.c".

- Alex

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

end of thread, other threads:[~2014-11-04 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30  9:42 problems with udp header compression Simon Vincent
2014-10-30 10:18 ` Simon Vincent
2014-11-01  9:10   ` Alexander Aring
2014-11-04 12:34     ` Simon Vincent
2014-11-04 12:37       ` Alexander Aring

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).