diff options
| author | Michael Biebl <biebl@debian.org> | 2022-12-19 11:37:58 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-12-19 11:37:58 +0100 |
| commit | 3fbe6fc596ff5cb77eb3a51a82d7d32dc315e596 (patch) | |
| tree | c90f43ad9456cf5f3ccff167047ac6bec6c69631 /src/core/nm-core-utils.c | |
| parent | cecaa6ed43023e0f2c1d88cb9d5bed393529c6e6 (diff) | |
| parent | b2ca000f0e0a915aba25f7d16b34bd092055ad59 (diff) | |
Merge tag 'debian/1.40.8-1' into debian/bullseye-backports
network-manager Debian release 1.40.8-1
Diffstat (limited to 'src/core/nm-core-utils.c')
| -rw-r--r-- | src/core/nm-core-utils.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index 480e9b28..4aad9414 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -3265,25 +3265,32 @@ nm_utils_get_ipv6_interface_identifier(NMLinkType link_type, * making sure to set the 'u' bit to 1. The GUID is the lower 64 bits * of the IPoIB interface's hardware address. */ - g_return_val_if_fail(hwaddr_len == INFINIBAND_ALEN, FALSE); - memcpy(out_iid->id_u8, hwaddr + INFINIBAND_ALEN - 8, 8); - out_iid->id_u8[0] |= 0x02; - return TRUE; + if (hwaddr_len == INFINIBAND_ALEN) { + memcpy(out_iid->id_u8, hwaddr + INFINIBAND_ALEN - 8, 8); + out_iid->id_u8[0] |= 0x02; + return TRUE; + } + break; case NM_LINK_TYPE_GRE: /* Hardware address is the network-endian IPv4 address */ - g_return_val_if_fail(hwaddr_len == 4, FALSE); - addr = *(guint32 *) hwaddr; - out_iid->id_u8[0] = get_gre_eui64_u_bit(addr); - out_iid->id_u8[1] = 0x00; - out_iid->id_u8[2] = 0x5E; - out_iid->id_u8[3] = 0xFE; - memcpy(out_iid->id_u8 + 4, &addr, 4); - return TRUE; + if (hwaddr_len == 4) { + addr = unaligned_read_ne32(hwaddr); + out_iid->id_u8[0] = get_gre_eui64_u_bit(addr); + out_iid->id_u8[1] = 0x00; + out_iid->id_u8[2] = 0x5E; + out_iid->id_u8[3] = 0xFE; + memcpy(out_iid->id_u8 + 4, &addr, 4); + return TRUE; + } + break; 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; + if (hwaddr_len == sizeof(out_iid->id_u8)) { + memcpy(out_iid->id_u8, hwaddr, sizeof(out_iid->id_u8)); + return TRUE; + } + break; default: if (hwaddr_len == ETH_ALEN) { /* Translate 48-bit MAC address to a 64-bit Modified EUI-64. See |