diff options
-rw-r--r-- | src/devices/nm-device.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4440986851..b8d15d6344 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -693,6 +693,32 @@ get_ip_iface_identifier (NMDevice *self, NMUtilsIPv6IfaceId *out_iid) static gboolean nm_device_get_ip_iface_identifier (NMDevice *self, NMUtilsIPv6IfaceId *iid) { + NMSettingIP6Config *s_ip6; + const char *token; + struct in6_addr i6_token; + NMConnection *connection; + + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); + + connection = nm_device_get_applied_connection (self); + nm_assert (connection); + + s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting_ip6_config (connection)); + nm_assert (s_ip6); + + token = nm_setting_ip6_config_get_token (s_ip6); + if (token && inet_pton (AF_INET6, token, &i6_token) == 1) { + iid->id_u8[7] = i6_token.s6_addr[15]; + iid->id_u8[6] = i6_token.s6_addr[14]; + iid->id_u8[5] = i6_token.s6_addr[13]; + iid->id_u8[4] = i6_token.s6_addr[12]; + iid->id_u8[3] = i6_token.s6_addr[11]; + iid->id_u8[2] = i6_token.s6_addr[10]; + iid->id_u8[1] = i6_token.s6_addr[9]; + iid->id_u8[0] = i6_token.s6_addr[8]; + return TRUE; + } + return NM_DEVICE_GET_CLASS (self)->get_ip_iface_identifier (self, iid); } @@ -5667,7 +5693,10 @@ check_and_add_ipv6ll_addr (NMDevice *self) return; } - if (!nm_device_get_ip_iface_identifier (self, &iid)) { + /* Don't use nm_device_get_ip_iface_identifier() -- we don't want to take + * the token into account for the link-local address . No particular good + * reason for that other than that the kernel doesn't do that either. */ + if (!NM_DEVICE_GET_CLASS (self)->get_ip_iface_identifier (self, &iid)) { _LOGW (LOGD_IP6, "linklocal6: failed to get interface identifier; IPv6 cannot continue"); return; } @@ -5952,10 +5981,7 @@ addrconf6_start_with_link_ready (NMDevice *self) g_assert (priv->rdisc); - if (nm_platform_link_get_ipv6_token (NM_PLATFORM_GET, priv->ifindex, &iid)) { - _LOGD (LOGD_IP6, "addrconf6: IPv6 tokenized identifier present"); - nm_rdisc_set_iid (priv->rdisc, iid); - } else if (nm_device_get_ip_iface_identifier (self, &iid)) { + if (nm_device_get_ip_iface_identifier (self, &iid)) { _LOGD (LOGD_IP6, "addrconf6: using the device EUI-64 identifier"); nm_rdisc_set_iid (priv->rdisc, iid); } else { |