summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-11-01 13:43:01 +0100
committerLubomir Rintel <lkundrak@v3.sk>2016-11-09 17:23:32 +0100
commit0e6d1940601250e72a85fbcbdce43920f6f052ef (patch)
tree4c8cb81d2448fec94ad987be65a6ffd6459688d3
parent611870347a26bd3ed1839064aedf34c22b37b74e (diff)
downloadNetworkManager-0e6d1940601250e72a85fbcbdce43920f6f052ef.tar.gz
settings: allow method=shared with manual IPv6 configuration
IPv4 already allows setting an address, reusing its prefix for the network it shares connection with. Additionally, for IPv6, the NDP can also share the DNS configuration.
-rw-r--r--libnm-core/nm-setting-ip6-config.c56
-rw-r--r--libnm-util/nm-setting-ip6-config.c19
2 files changed, 41 insertions, 34 deletions
diff --git a/libnm-core/nm-setting-ip6-config.c b/libnm-core/nm-setting-ip6-config.c
index 50b3654301..4ef3333dc3 100644
--- a/libnm-core/nm-setting-ip6-config.c
+++ b/libnm-core/nm-setting-ip6-config.c
@@ -172,34 +172,38 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
} else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
|| !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)
|| !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
- if (nm_setting_ip_config_get_num_dns (s_ip) > 0) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP_CONFIG_METHOD, method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS);
- return FALSE;
- }
- if (nm_setting_ip_config_get_num_dns_searches (s_ip) > 0) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP_CONFIG_METHOD, method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS_SEARCH);
- return FALSE;
- }
+ /* Shared allows IP addresses and DNS; link-local and disabled do not */
+ if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_SHARED) != 0) {
+ if (nm_setting_ip_config_get_num_dns (s_ip) > 0) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("this property is not allowed for '%s=%s'"),
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS);
+ return FALSE;
+ }
- if (nm_setting_ip_config_get_num_addresses (s_ip) > 0) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP_CONFIG_METHOD, method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
- return FALSE;
+ if (nm_setting_ip_config_get_num_dns_searches (s_ip) > 0) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("this property is not allowed for '%s=%s'"),
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS_SEARCH);
+ return FALSE;
+ }
+
+ if (nm_setting_ip_config_get_num_addresses (s_ip) > 0) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("this property is not allowed for '%s=%s'"),
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
+ return FALSE;
+ }
}
} else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)
|| !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) {
diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c
index 9ad93ac16c..37bdd0ed73 100644
--- a/libnm-util/nm-setting-ip6-config.c
+++ b/libnm-util/nm-setting-ip6-config.c
@@ -868,14 +868,17 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
return FALSE;
}
- if (g_slist_length (priv->addresses)) {
- g_set_error (error,
- NM_SETTING_IP6_CONFIG_ERROR,
- NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
- _("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP6_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES);
- return FALSE;
+ /* Shared allows IP addresses; link-local and disabled do not */
+ if (strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_SHARED) != 0) {
+ if (g_slist_length (priv->addresses)) {
+ g_set_error (error,
+ NM_SETTING_IP6_CONFIG_ERROR,
+ NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
+ _("this property is not allowed for '%s=%s'"),
+ NM_SETTING_IP6_CONFIG_METHOD, priv->method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES);
+ return FALSE;
+ }
}
} else if ( !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)
|| !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) {