From 2aa031e7c71b87fc9839340cb83d641eeeb4f8c7 Mon Sep 17 00:00:00 2001 From: Joakim Gebart Date: Tue, 3 Mar 2015 19:51:58 +0100 Subject: [PATCH] sixlowpan: Set U/L bit in short address to local. --- sys/net/network_layer/sixlowpan/lowpan.c | 4 ++-- sys/net/network_layer/sixlowpan/mac.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/net/network_layer/sixlowpan/lowpan.c b/sys/net/network_layer/sixlowpan/lowpan.c index c8e4803e30..e1d594d65b 100644 --- a/sys/net/network_layer/sixlowpan/lowpan.c +++ b/sys/net/network_layer/sixlowpan/lowpan.c @@ -895,10 +895,10 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, if (!net_if_get_eui64(&own_iid, if_id, 0)) { return 1; } - - own_iid.uint8[0] ^= 0x02; } + own_iid.uint8[0] ^= 0x02; + ipv6_buf = ipv6_buf_extra; memset(&lowpan_iphc, 0, 2); diff --git a/sys/net/network_layer/sixlowpan/mac.c b/sys/net/network_layer/sixlowpan/mac.c index 9957225889..822c3f49fc 100644 --- a/sys/net/network_layer/sixlowpan/mac.c +++ b/sys/net/network_layer/sixlowpan/mac.c @@ -54,7 +54,9 @@ static uint8_t macdsn; static inline void mac_frame_short_to_eui64(net_if_eui64_t *eui64, uint8_t *frame_short) { - eui64->uint32[0] = HTONL(0x000000ff); + /* Since this is a short address, which is never globally unique, we set + * the local/universal bit to 1. */ + eui64->uint32[0] = HTONL(0x020000ff); eui64->uint16[2] = HTONS(0xfe00); eui64->uint8[6] = frame_short[1]; eui64->uint8[7] = frame_short[0];