mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 04:08:01 +02:00
ifcfg-rh: add support for addr-gen-mode property
This commit is contained in:
parent
f70c8f3d29
commit
60d2504291
2 changed files with 30 additions and 7 deletions
|
|
@ -1317,8 +1317,9 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
shvarFile *network_ifcfg;
|
||||
gboolean never_default = FALSE;
|
||||
gboolean ip6_privacy = FALSE, ip6_privacy_prefer_public_ip;
|
||||
char *ip6_privacy_str;
|
||||
NMSettingIP6ConfigPrivacy ip6_privacy_val;
|
||||
NMSettingIP6ConfigAddrGenMode addr_gen_mode;
|
||||
char *tmp;
|
||||
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
|
||||
|
|
@ -1402,20 +1403,20 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
/* TODO - handle other methods */
|
||||
|
||||
/* Read IPv6 Privacy Extensions configuration */
|
||||
ip6_privacy_str = svGetValue (ifcfg, "IPV6_PRIVACY", FALSE);
|
||||
if (ip6_privacy_str) {
|
||||
tmp = svGetValue (ifcfg, "IPV6_PRIVACY", FALSE);
|
||||
if (tmp) {
|
||||
ip6_privacy = svGetValueBoolean (ifcfg, "IPV6_PRIVACY", FALSE);
|
||||
if (!ip6_privacy)
|
||||
ip6_privacy = g_strcmp0 (ip6_privacy_str, "rfc4941") == 0 ||
|
||||
g_strcmp0 (ip6_privacy_str, "rfc3041") == 0;
|
||||
ip6_privacy = g_strcmp0 (tmp, "rfc4941") == 0 ||
|
||||
g_strcmp0 (tmp, "rfc3041") == 0;
|
||||
}
|
||||
ip6_privacy_prefer_public_ip = svGetValueBoolean (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", FALSE);
|
||||
ip6_privacy_val = ip6_privacy_str ?
|
||||
ip6_privacy_val = tmp ?
|
||||
(ip6_privacy ?
|
||||
(ip6_privacy_prefer_public_ip ? NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR : NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR) :
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED) :
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN;
|
||||
g_free (ip6_privacy_str);
|
||||
g_free (tmp);
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP_CONFIG_METHOD, method,
|
||||
|
|
@ -1499,6 +1500,17 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
}
|
||||
}
|
||||
|
||||
/* IPv6 addressing mode configuration */
|
||||
tmp = svGetValue (ifcfg, "IPV6_ADDR_GEN_MODE", FALSE);
|
||||
if (tmp) {
|
||||
if (nm_utils_enum_from_str (nm_setting_ip6_config_addr_gen_mode_get_type (), tmp,
|
||||
(int *) &addr_gen_mode, NULL))
|
||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, addr_gen_mode, NULL);
|
||||
else
|
||||
PARSE_WARNING ("Invalid IPV6_ADDR_GEN_MODE");
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
/* DNS servers
|
||||
* Pick up just IPv6 addresses (IPv4 addresses are taken by make_ip4_setting())
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2391,6 +2391,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
gint64 route_metric;
|
||||
GString *ip_str1, *ip_str2, *ip_ptr;
|
||||
char *route6_path;
|
||||
NMSettingIP6ConfigAddrGenMode addr_gen_mode;
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (!s_ip6) {
|
||||
|
|
@ -2403,6 +2404,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
svSetValue (ifcfg, "IPV6_PEERROUTES", "yes", FALSE);
|
||||
svSetValue (ifcfg, "IPV6_FAILURE_FATAL", "no", FALSE);
|
||||
svSetValue (ifcfg, "IPV6_ROUTE_METRIC", NULL, FALSE);
|
||||
svSetValue (ifcfg, "IPV6_ADDR_GEN_MODE", "stable-privacy", FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2540,6 +2542,15 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
break;
|
||||
}
|
||||
|
||||
/* IPv6 Address generation mode */
|
||||
addr_gen_mode = nm_setting_ip6_config_get_addr_gen_mode (NM_SETTING_IP6_CONFIG (s_ip6));
|
||||
if (addr_gen_mode != NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64) {
|
||||
tmp = nm_utils_enum_to_str (nm_setting_ip6_config_addr_gen_mode_get_type (),
|
||||
addr_gen_mode);
|
||||
svSetValue (ifcfg, "IPV6_ADDR_GEN_MODE", tmp, FALSE);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
/* Static routes go to route6-<dev> file */
|
||||
route6_path = utils_get_route6_path (ifcfg->fileName);
|
||||
if (!route6_path) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue