diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2016-10-14 19:52:52 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2016-11-09 17:23:31 +0100 |
commit | 679f8dfc7d0e064dee26218f6aa914df0a0bddef (patch) | |
tree | 999fd8014bb8532e6ac3439e34c9510afb5b869d /src | |
parent | c84313a2b78fc1aed1f045596682416029b00075 (diff) | |
download | NetworkManager-679f8dfc7d0e064dee26218f6aa914df0a0bddef.tar.gz |
ndisc/trivial: move nm_ndisc_set_iid upwards
Diffstat (limited to 'src')
-rw-r--r-- | src/ndisc/nm-ndisc.c | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/src/ndisc/nm-ndisc.c b/src/ndisc/nm-ndisc.c index 667d7fec49..f78c4fd453 100644 --- a/src/ndisc/nm-ndisc.c +++ b/src/ndisc/nm-ndisc.c @@ -425,53 +425,6 @@ nm_ndisc_add_dns_domain (NMNDisc *ndisc, const NMNDiscDNSDomain *new) /*****************************************************************************/ -/** - * nm_ndisc_set_iid: - * @ndisc: the #NMNDisc - * @iid: the new interface ID - * - * Sets the "Modified EUI-64" interface ID to be used when generating - * IPv6 addresses using received prefixes. Identifiers are either generated - * from the hardware addresses or manually set by the operator with - * "ip token" command. - * - * Upon token change (or initial setting) all addresses generated using - * the old identifier are removed. The caller should ensure the addresses - * will be reset by soliciting router advertisements. - * - * In case the stable privacy addressing is used %FALSE is returned and - * addresses are left untouched. - * - * Returns: %TRUE if addresses need to be regenerated, %FALSE otherwise. - **/ -gboolean -nm_ndisc_set_iid (NMNDisc *ndisc, const NMUtilsIPv6IfaceId iid) -{ - NMNDiscPrivate *priv; - NMNDiscDataInternal *rdata; - - g_return_val_if_fail (NM_IS_NDISC (ndisc), FALSE); - - priv = NM_NDISC_GET_PRIVATE (ndisc); - rdata = &priv->rdata; - - if (priv->iid.id != iid.id) { - priv->iid = iid; - - if (priv->addr_gen_mode == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY) - return FALSE; - - if (rdata->addresses->len) { - _LOGD ("IPv6 interface identifier changed, flushing addresses"); - g_array_remove_range (rdata->addresses, 0, rdata->addresses->len); - _emit_config_change (ndisc, NM_NDISC_CONFIG_ADDRESSES); - } - return TRUE; - } - - return FALSE; -} - static gboolean send_rs_timeout (NMNDisc *ndisc) { @@ -536,6 +489,55 @@ solicit (NMNDisc *ndisc) priv->send_rs_id = g_timeout_add_seconds ((guint32) next, (GSourceFunc) send_rs_timeout, ndisc); } +/*****************************************************************************/ + +/** + * nm_ndisc_set_iid: + * @ndisc: the #NMNDisc + * @iid: the new interface ID + * + * Sets the "Modified EUI-64" interface ID to be used when generating + * IPv6 addresses using received prefixes. Identifiers are either generated + * from the hardware addresses or manually set by the operator with + * "ip token" command. + * + * Upon token change (or initial setting) all addresses generated using + * the old identifier are removed. The caller should ensure the addresses + * will be reset by soliciting router advertisements. + * + * In case the stable privacy addressing is used %FALSE is returned and + * addresses are left untouched. + * + * Returns: %TRUE if addresses need to be regenerated, %FALSE otherwise. + **/ +gboolean +nm_ndisc_set_iid (NMNDisc *ndisc, const NMUtilsIPv6IfaceId iid) +{ + NMNDiscPrivate *priv; + NMNDiscDataInternal *rdata; + + g_return_val_if_fail (NM_IS_NDISC (ndisc), FALSE); + + priv = NM_NDISC_GET_PRIVATE (ndisc); + rdata = &priv->rdata; + + if (priv->iid.id != iid.id) { + priv->iid = iid; + + if (priv->addr_gen_mode == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY) + return FALSE; + + if (rdata->addresses->len) { + _LOGD ("IPv6 interface identifier changed, flushing addresses"); + g_array_remove_range (rdata->addresses, 0, rdata->addresses->len); + _emit_config_change (ndisc, NM_NDISC_CONFIG_ADDRESSES); + } + return TRUE; + } + + return FALSE; +} + static gboolean ndisc_ra_timeout_cb (gpointer user_data) { |