6lowpan: Set MAC address length according to LOWPAN_LLTYPE
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Sun, 12 Mar 2017 08:19:34 +0000 (10:19 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Apr 2017 20:02:36 +0000 (22:02 +0200)
Set MAC address length according to the 6LoWPAN link layer in use.
Bluetooth Low Energy uses 48 bit addressing while IEEE802.15.4 uses
64 bits.

Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/6lowpan/core.c

index 5945f7e19c679cb882a5a5716a1de33bed50a8f1..5f9909a2b58c84e3d416314c1b786150a45b155c 100644 (file)
@@ -23,7 +23,16 @@ int lowpan_register_netdevice(struct net_device *dev,
 {
        int i, ret;
 
-       dev->addr_len = EUI64_ADDR_LEN;
+       switch (lltype) {
+       case LOWPAN_LLTYPE_IEEE802154:
+               dev->addr_len = EUI64_ADDR_LEN;
+               break;
+
+       case LOWPAN_LLTYPE_BTLE:
+               dev->addr_len = ETH_ALEN;
+               break;
+       }
+
        dev->type = ARPHRD_6LOWPAN;
        dev->mtu = IPV6_MIN_MTU;
        dev->priv_flags |= IFF_NO_QUEUE;