From 618df44837aa8fd2a8c90ccd9b67d5f8b114cc0f Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Mon, 13 Jul 2015 20:53:57 +0200 Subject: [PATCH] ng_ipv6_netif: use EUI-64 as base for 6LoWPAN IPv6 addresses [RFC 6775](https://tools.ietf.org/html/rfc6775#section-1.3) suggests strongly to use the EUI-64 as basis for the IPv6 addresses, since otherwise duplicate address detection and some measures to give new addresses (in case of duplicate) e.g. DHCPv6 needs to be in place. --- sys/net/network_layer/ng_ipv6/netif/ng_ipv6_netif.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/net/network_layer/ng_ipv6/netif/ng_ipv6_netif.c b/sys/net/network_layer/ng_ipv6/netif/ng_ipv6_netif.c index eab9fdbcb4..7453bafb4e 100644 --- a/sys/net/network_layer/ng_ipv6/netif/ng_ipv6_netif.c +++ b/sys/net/network_layer/ng_ipv6/netif/ng_ipv6_netif.c @@ -473,8 +473,13 @@ void ng_ipv6_netif_init_by_dev(void) if ((ng_netapi_get(ifs[i], NETCONF_OPT_PROTO, 0, &if_type, sizeof(if_type)) != -ENOTSUP) && (if_type == NG_NETTYPE_SIXLOWPAN)) { + uint16_t src_len = 8; DEBUG("Set 6LoWPAN flag\n"); ipv6_ifs[i].flags |= NG_IPV6_NETIF_FLAGS_SIXLOWPAN; + /* use EUI-64 (8-byte address) for IID generation and for sending + * packets */ + ng_netapi_set(ifs[i], NETCONF_OPT_SRC_LEN, 0, &src_len, + sizeof(src_len)); /* don't care for result */ } #endif