Commit a5862f2a authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

6lowpan: move eui64 uncompress function

This function will be use in later functionality in other branches than
generic 6lowpan, so we move it to the global 6lowpan header.
Signed-off-by: default avatarAlexander Aring <aar@pengutronix.de>
Reviewed-by: Stefan Schmidt<stefan@osg.samsung.com>
Acked-by: default avatarJukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 2bc068c3
...@@ -169,6 +169,22 @@ struct lowpan_802154_cb *lowpan_802154_cb(const struct sk_buff *skb) ...@@ -169,6 +169,22 @@ struct lowpan_802154_cb *lowpan_802154_cb(const struct sk_buff *skb)
return (struct lowpan_802154_cb *)skb->cb; return (struct lowpan_802154_cb *)skb->cb;
} }
static inline void lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr *ipaddr,
const void *lladdr)
{
/* fe:80::XXXX:XXXX:XXXX:XXXX
* \_________________/
* hwaddr
*/
ipaddr->s6_addr[0] = 0xFE;
ipaddr->s6_addr[1] = 0x80;
memcpy(&ipaddr->s6_addr[8], lladdr, EUI64_ADDR_LEN);
/* second bit-flip (Universe/Local)
* is done according RFC2464
*/
ipaddr->s6_addr[8] ^= 0x02;
}
#ifdef DEBUG #ifdef DEBUG
/* print data in line */ /* print data in line */
static inline void raw_dump_inline(const char *caller, char *msg, static inline void raw_dump_inline(const char *caller, char *msg,
......
...@@ -156,22 +156,6 @@ ...@@ -156,22 +156,6 @@
#define LOWPAN_IPHC_CID_DCI(cid) (cid & 0x0f) #define LOWPAN_IPHC_CID_DCI(cid) (cid & 0x0f)
#define LOWPAN_IPHC_CID_SCI(cid) ((cid & 0xf0) >> 4) #define LOWPAN_IPHC_CID_SCI(cid) ((cid & 0xf0) >> 4)
static inline void lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr *ipaddr,
const void *lladdr)
{
/* fe:80::XXXX:XXXX:XXXX:XXXX
* \_________________/
* hwaddr
*/
ipaddr->s6_addr[0] = 0xFE;
ipaddr->s6_addr[1] = 0x80;
memcpy(&ipaddr->s6_addr[8], lladdr, EUI64_ADDR_LEN);
/* second bit-flip (Universe/Local)
* is done according RFC2464
*/
ipaddr->s6_addr[8] ^= 0x02;
}
static inline void static inline void
lowpan_iphc_uncompress_802154_lladdr(struct in6_addr *ipaddr, lowpan_iphc_uncompress_802154_lladdr(struct in6_addr *ipaddr,
const void *lladdr) const void *lladdr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment