platform: remove nm_platform_link_get_ipv6_token()

No need for the extra cache lookup.
This commit is contained in:
Thomas Haller
2016-04-29 21:34:06 +02:00
committed by Lubomir Rintel
parent e5f63f2a50
commit e88f5a6c23
3 changed files with 8 additions and 38 deletions

View File

@@ -1606,7 +1606,6 @@ device_link_changed (NMDevice *self)
{ {
NMDeviceClass *klass = NM_DEVICE_GET_CLASS (self); NMDeviceClass *klass = NM_DEVICE_GET_CLASS (self);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMUtilsIPv6IfaceId token_iid;
gboolean ip_ifname_changed = FALSE; gboolean ip_ifname_changed = FALSE;
const char *udi; const char *udi;
NMPlatformLink info; NMPlatformLink info;
@@ -1678,11 +1677,12 @@ device_link_changed (NMDevice *self)
nm_device_emit_recheck_auto_activate (self); nm_device_emit_recheck_auto_activate (self);
} }
if (priv->rdisc && nm_platform_link_get_ipv6_token (NM_PLATFORM_GET, priv->ifindex, &token_iid)) { if (priv->rdisc && info.inet6_token.id) {
if (nm_rdisc_set_iid (priv->rdisc, info.inet6_token)) {
_LOGD (LOGD_DEVICE, "IPv6 tokenized identifier present on device %s", priv->iface); _LOGD (LOGD_DEVICE, "IPv6 tokenized identifier present on device %s", priv->iface);
if (nm_rdisc_set_iid (priv->rdisc, token_iid))
nm_rdisc_start (priv->rdisc); nm_rdisc_start (priv->rdisc);
} }
}
if (klass->link_changed) if (klass->link_changed)
klass->link_changed (self, &info); klass->link_changed (self, &info);
@@ -6104,13 +6104,15 @@ static gboolean
addrconf6_start_with_link_ready (NMDevice *self) addrconf6_start_with_link_ready (NMDevice *self)
{ {
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
const NMPlatformLink *pllink;
NMUtilsIPv6IfaceId iid; NMUtilsIPv6IfaceId iid;
g_assert (priv->rdisc); g_assert (priv->rdisc);
if (nm_platform_link_get_ipv6_token (NM_PLATFORM_GET, priv->ifindex, &iid)) { pllink = nm_platform_link_get (NM_PLATFORM_GET, priv->ifindex);
if (pllink && pllink->inet6_token.id) {
_LOGD (LOGD_IP6, "addrconf6: IPv6 tokenized identifier present"); _LOGD (LOGD_IP6, "addrconf6: IPv6 tokenized identifier present");
nm_rdisc_set_iid (priv->rdisc, iid); nm_rdisc_set_iid (priv->rdisc, pllink->inet6_token);
} else if (nm_device_get_ip_iface_identifier (self, &iid)) { } else if (nm_device_get_ip_iface_identifier (self, &iid)) {
_LOGD (LOGD_IP6, "addrconf6: using the device EUI-64 identifier"); _LOGD (LOGD_IP6, "addrconf6: using the device EUI-64 identifier");
nm_rdisc_set_iid (priv->rdisc, iid); nm_rdisc_set_iid (priv->rdisc, iid);

View File

@@ -899,37 +899,6 @@ nm_platform_link_uses_arp (NMPlatform *self, int ifindex)
return !NM_FLAGS_HAS (_link_get_flags (self, ifindex), IFF_NOARP); return !NM_FLAGS_HAS (_link_get_flags (self, ifindex), IFF_NOARP);
} }
/**
* nm_platform_link_get_ipv6_token:
* @self: platform instance
* @ifindex: Interface index
* @iid: Tokenized interface identifier
*
* Returns IPv6 tokenized interface identifier. If the platform or OS doesn't
* support IPv6 tokenized interface identifiers, or the token is not set
* this call will fail and return %FALSE.
*
* Returns: %TRUE a tokenized identifier was available
*/
gboolean
nm_platform_link_get_ipv6_token (NMPlatform *self, int ifindex, NMUtilsIPv6IfaceId *iid)
{
const NMPlatformLink *pllink;
_CHECK_SELF (self, klass, FALSE);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (iid, FALSE);
pllink = nm_platform_link_get (self, ifindex);
if (pllink && pllink->inet6_token.id) {
*iid = pllink->inet6_token;
return TRUE;
}
return FALSE;
}
const char * const char *
nm_platform_link_get_udi (NMPlatform *self, int ifindex) nm_platform_link_get_udi (NMPlatform *self, int ifindex)
{ {

View File

@@ -730,7 +730,6 @@ gboolean nm_platform_link_is_up (NMPlatform *self, int ifindex);
gboolean nm_platform_link_is_connected (NMPlatform *self, int ifindex); gboolean nm_platform_link_is_connected (NMPlatform *self, int ifindex);
gboolean nm_platform_link_uses_arp (NMPlatform *self, int ifindex); gboolean nm_platform_link_uses_arp (NMPlatform *self, int ifindex);
guint32 nm_platform_link_get_mtu (NMPlatform *self, int ifindex); guint32 nm_platform_link_get_mtu (NMPlatform *self, int ifindex);
gboolean nm_platform_link_get_ipv6_token (NMPlatform *self, int ifindex, NMUtilsIPv6IfaceId *iid);
gboolean nm_platform_link_get_user_ipv6ll_enabled (NMPlatform *self, int ifindex); gboolean nm_platform_link_get_user_ipv6ll_enabled (NMPlatform *self, int ifindex);
gconstpointer nm_platform_link_get_address (NMPlatform *self, int ifindex, size_t *length); gconstpointer nm_platform_link_get_address (NMPlatform *self, int ifindex, size_t *length);
int nm_platform_link_get_master (NMPlatform *self, int slave); int nm_platform_link_get_master (NMPlatform *self, int slave);