problems with udp header compression
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);
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
-
Quoted 17 lines · Simon Vincent
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_headerthey are incorrect. The functionudp_hdris 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);Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Alexander Aring
maintainerHi Simon,
Quoted 10 lines · Simon Vincent
This appears to be because if you use a RAW socket with
IPPROTO_RAWthe ipv6 stack passes it straight through and the skbtransport_header,network_headeroffset are not set.Putting the following at the top of
compress_udp_headerfixes 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
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
Quoted 29 lines · Alexander Aring
Hi Simon,
Quoted 10 lines · Simon Vincent
This appears to be because if you use a RAW socket with
IPPROTO_RAWthe ipv6 stack passes it straight through and the skbtransport_header,network_headeroffset are not set.Putting the following at the top of
compress_udp_headerfixes 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Alexander Aring
maintainerQuoted 3 lines · Simon Vincent
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:
and
this problem should also occur on bluetooth 6LoWPAN. I think it's some patch for "net/6lowpan/iphc.c".
- Alex