Thread (17 messages) 17 messages, 2 authors, 2017-02-15

Re: [PATCH 4/5] ipv6: addrconf: fix 48 bit 6lowpan autoconfiguration

From: Alexander Aring <hidden>
Date: 2017-02-15 07:29:32

Hi,

On 02/09/2017 03:55 PM, Luiz Augusto von Dentz wrote:
quoted hunk ↗ jump to hunk
From: Alexander Aring <redacted>

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

Signed-off-by: Alexander Aring <redacted>
Signed-off-by: Luiz Augusto von Dentz <redacted>
---
 net/ipv6/addrconf.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ac9bd56..dede33f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2050,12 +2050,19 @@ static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
 	__ipv6_dev_ac_dec(ifp->idev, &addr);
 }
 
-static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev)
+static int addrconf_ifid_6lowpan(u8 *eui, struct net_device *dev)
 {
-	if (dev->addr_len != EUI64_ADDR_LEN)
+	switch (dev->addr_len) {
+	case ETH_ALEN:
+		return addrconf_ifid_eui48(eui, dev);
+	case EUI64_ADDR_LEN:
+		memcpy(eui, dev->dev_addr, EUI64_ADDR_LEN);
+		eui[0] ^= 2;
+		break;
+	default:
 		return -1;
-	memcpy(eui, dev->dev_addr, EUI64_ADDR_LEN);
-	eui[0] ^= 2;
+	}
+
 	return 0;
 }
The question is here to evaluate the link-layer type here... I see
problems coming if another 6LoWPAN adaptation is there and use the same
address length but RFC describes different handling to generate SLAAC.

Nevertheless it should work right now, we can always touch the code
again. :-)

- Alex
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help