6LoWPAN devices have an EUI-64 address rather than an EUI-48 address.
Use the full EUI-64 address when generating the clock identity to
avoid duplicates.

The constant ARPHRD_6LOWPAN is not yet present in the glibc version of
if_arp.h, so define it locally if necessary.

Signed-off-by: Michael Brown <mbr...@fensystems.co.uk>
---
 address.h | 4 ++++
 sk.c      | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/address.h b/address.h
index 35ef05f..eb5ef83 100644
--- a/address.h
+++ b/address.h
@@ -26,6 +26,10 @@
 #include <sys/un.h>
 #include <net/if_arp.h>
 
+#ifndef ARPHRD_6LOWPAN
+#define ARPHRD_6LOWPAN 825
+#endif
+
 struct address {
        socklen_t len;
        union {
diff --git a/sk.c b/sk.c
index 72926ab..6017206 100644
--- a/sk.c
+++ b/sk.c
@@ -238,6 +238,11 @@ int sk_interface_macaddr(const char *name, struct address 
*mac)
                        }
                        mac->sll.sll_halen = EUI64;
                        break;
+               case ARPHRD_6LOWPAN:
+                       memcpy(mac->sll.sll_addr, &ifreq.ifr_hwaddr.sa_data,
+                              GUID_LEN);
+                       mac->sll.sll_halen = EUI64;
+                       break;
                default:
                        memcpy(mac->sll.sll_addr, &ifreq.ifr_hwaddr.sa_data, 
MAC_LEN);
                        mac->sll.sll_halen = EUI48;
-- 
2.14.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to