Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: addrconf: fix 48 bit 6lowpan autoconfiguration

This patch adds support for 48 bit 6LoWPAN address length
autoconfiguration which is the case for BTLE 6LoWPAN.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Alexander Aring and committed by
Marcel Holtmann
8a7a4b47 94e4a680

+12 -5
+12 -5
net/ipv6/addrconf.c
··· 2073 2073 __ipv6_dev_ac_dec(ifp->idev, &addr); 2074 2074 } 2075 2075 2076 - static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev) 2076 + static int addrconf_ifid_6lowpan(u8 *eui, struct net_device *dev) 2077 2077 { 2078 - if (dev->addr_len != EUI64_ADDR_LEN) 2078 + switch (dev->addr_len) { 2079 + case ETH_ALEN: 2080 + return addrconf_ifid_eui48(eui, dev); 2081 + case EUI64_ADDR_LEN: 2082 + memcpy(eui, dev->dev_addr, EUI64_ADDR_LEN); 2083 + eui[0] ^= 2; 2084 + break; 2085 + default: 2079 2086 return -1; 2080 - memcpy(eui, dev->dev_addr, EUI64_ADDR_LEN); 2081 - eui[0] ^= 2; 2087 + } 2088 + 2082 2089 return 0; 2083 2090 } 2084 2091 ··· 2177 2170 case ARPHRD_TUNNEL: 2178 2171 return addrconf_ifid_gre(eui, dev); 2179 2172 case ARPHRD_6LOWPAN: 2180 - return addrconf_ifid_eui64(eui, dev); 2173 + return addrconf_ifid_6lowpan(eui, dev); 2181 2174 case ARPHRD_IEEE1394: 2182 2175 return addrconf_ifid_ieee1394(eui, dev); 2183 2176 case ARPHRD_TUNNEL6: