Alexander Aring wrote: > To uncompress a multicast address is different than a other > non-multicasts addresses according to rfc6282.
The uncompression looks fine. But you should check skb->len before trying to access the data. This also means that you can simplify some of the skb_pull. Maybe a little helper function like this could be useful: static inline unsigned char *fetch(struct sk_buff *skb, unsigned int len) { unsigned char *tmp = skb->data; if (unlikely(len > skb->len)) return NULL; skb_pull(skb, len); return tmp; } then things like ipaddr->s6_addr[0] = 0xFF; ipaddr->s6_addr[1] = *skb->data; skb_pull(skb, 1); memcpy(&ipaddr->s6_addr[11], skb->data, 5); skb_pull(skb, 5); break; would become something like const unsigned char *p; ... p = fetch(skb, 6); if (!p) return -EWHATEVER; ipaddr->s6_addr[0] = 0xFF; ipaddr->s6_addr[1] = *p++; memcpy(&ipaddr->s6_addr[11], p, 5); break; Or use/extend the concept of the somewhat unwieldy lowpan_fetch_skb_u8. - Werner ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel