core-utils: use 64-bit WPAN address for a 6LoWPAN IID

If the hardware address is a 64-bit value it can be used directly as an
IEEE EUI-64 address when generating an interface identifier.
This commit is contained in:
Lubomir Rintel
2018-05-23 11:03:05 +02:00
parent 5da77c0e2c
commit 1d396e9972

View File

@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright 2004 - 2014 Red Hat, Inc.
* Copyright 2004 - 2018 Red Hat, Inc.
* Copyright 2005 - 2008 Novell, Inc.
*/
@@ -3018,6 +3018,11 @@ nm_utils_get_ipv6_interface_identifier (NMLinkType link_type,
out_iid->id_u8[3] = 0xFE;
memcpy (out_iid->id_u8 + 4, &addr, 4);
return TRUE;
case NM_LINK_TYPE_6LOWPAN:
/* The hardware address is already 64-bit. This is the case for
* IEEE 802.15.4 networks. */
memcpy (out_iid->id_u8, hwaddr, sizeof (out_iid->id_u8));
return TRUE;
default:
if (hwaddr_len == ETH_ALEN) {
/* Translate 48-bit MAC address to a 64-bit Modified EUI-64. See