mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
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.
This commit is contained in:
parent
611870347a
commit
0e6d194060
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue