diff options
author | Alexander Aring <aar@pengutronix.de> | 2016-04-11 12:04:22 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2016-04-13 11:41:10 +0300 |
commit | a5862f2aba4ba53d461450685a67ae252935ab94 (patch) | |
tree | a17dadfd455ee95e796264d939e35de33ae5dd04 /include/net/6lowpan.h | |
parent | 2bc068c3d6e1212d09c11169c699560747ef8c2b (diff) | |
download | linux-a5862f2aba4ba53d461450685a67ae252935ab94.tar.xz |
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: Alexander Aring <aar@pengutronix.de>
Reviewed-by: Stefan Schmidt<stefan@osg.samsung.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net/6lowpan.h')
-rw-r--r-- | include/net/6lowpan.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h index a0c01f55e0d3..04b877c5baff 100644 --- a/include/net/6lowpan.h +++ b/include/net/6lowpan.h @@ -169,6 +169,22 @@ struct lowpan_802154_cb *lowpan_802154_cb(const struct sk_buff *skb) 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 /* print data in line */ static inline void raw_dump_inline(const char *caller, char *msg, |