mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-23 22:30:35 +01:00
libnm-util: add IPv6 method 'dhcp'
This commit is contained in:
parent
2ef7ea02b3
commit
69790deedd
2 changed files with 51 additions and 46 deletions
|
|
@ -19,7 +19,7 @@
|
|||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2007 - 2008 Red Hat, Inc.
|
||||
* (C) Copyright 2007 - 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
|
@ -435,26 +435,23 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
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_IGNORE)
|
||||
} else if ( !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
|
||||
|| !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)
|
||||
|| !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
|
||||
if (!priv->ignore_auto_dns) {
|
||||
if (priv->dns && g_slist_length (priv->dns)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_IP6_CONFIG_ERROR,
|
||||
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
return FALSE;
|
||||
}
|
||||
if (g_slist_length (priv->dns)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_IP6_CONFIG_ERROR,
|
||||
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (g_slist_length (priv->dns_search)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_IP6_CONFIG_ERROR,
|
||||
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
return FALSE;
|
||||
}
|
||||
if (g_slist_length (priv->dns_search)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_IP6_CONFIG_ERROR,
|
||||
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (g_slist_length (priv->addresses)) {
|
||||
|
|
@ -464,6 +461,9 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
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)) {
|
||||
/* nothing to do */
|
||||
} else {
|
||||
g_set_error (error,
|
||||
NM_SETTING_IP6_CONFIG_ERROR,
|
||||
|
|
@ -598,30 +598,33 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class)
|
|||
*
|
||||
* IPv6 configuration method. If 'auto' is specified then the appropriate
|
||||
* automatic method (DHCP, PPP, advertisement, etc) is used for the
|
||||
* interface and most other properties can be left unset. If 'link-local'
|
||||
* is specified, then an IPv6 link-local address will be assigned to the
|
||||
* interface. If 'manual' is specified, static IP addressing is used and
|
||||
* at least one IP address must be given in the 'addresses' property. If
|
||||
* 'ignored' is specified, IPv6 configuration is not done. This property
|
||||
* must be set. NOTE: DHCP configuration and the 'shared' method are not
|
||||
* yet supported.
|
||||
* interface and most other properties can be left unset. To force the use
|
||||
* of DHCP only, specify 'dhcp'; this method is only valid for ethernet-
|
||||
* based hardware. If 'link-local' is specified, then an IPv6 link-local
|
||||
* address will be assigned to the interface. If 'manual' is specified,
|
||||
* static IP addressing is used and at least one IP address must be given
|
||||
* in the 'addresses' property. If 'ignored' is specified, IPv6
|
||||
* configuration is not done. This property must be set. NOTE: the 'shared'
|
||||
* method are not yet supported.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_METHOD,
|
||||
g_param_spec_string (NM_SETTING_IP6_CONFIG_METHOD,
|
||||
"Method",
|
||||
"IPv6 configuration method. If 'auto' is specified "
|
||||
"then the appropriate automatic method (DHCP, PPP, "
|
||||
"then the appropriate automatic method (PPP, router "
|
||||
"advertisement, etc) is used for the device and "
|
||||
"most other properties can be left unset. If "
|
||||
"most other properties can be left unset. To force "
|
||||
"the use of DHCP only, specify 'dhcp'; this method "
|
||||
"is only valid for ethernet-based hardware. If "
|
||||
"'link-local' is specified, then an IPv6 link-local "
|
||||
"address will be assigned to the interface. If "
|
||||
"'manual' is specified, static IP addressing is "
|
||||
"used and at least one IP address must be given in "
|
||||
" the 'addresses' property. If 'ignored' is "
|
||||
"specified, IPv6 configuration is not done. This "
|
||||
"property must be set. NOTE: DHCP configuration "
|
||||
"and the 'shared' method are not yet supported.",
|
||||
"property must be set. NOTE: the 'shared' method"
|
||||
"is not yet supported.",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
|
|
@ -740,38 +743,39 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class)
|
|||
/**
|
||||
* NMSettingIP6Config:ignore-auto-routes:
|
||||
*
|
||||
* When the method is set to 'auto' and this property to TRUE, automatically
|
||||
* configured routes are ignored and only routes specified in
|
||||
* #NMSettingIP6Config:routes, if any, are used.
|
||||
* When the method is set to 'auto' or 'dhcp' and this property is set to
|
||||
* TRUE, automatically configured routes are ignored and only routes
|
||||
* specified in #NMSettingIP6Config:routes, if any, are used.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_IGNORE_AUTO_ROUTES,
|
||||
g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES,
|
||||
"Ignore automatic routes",
|
||||
"When the method is set to 'auto' and this property "
|
||||
"to TRUE, automatically configured routes are "
|
||||
"ignored and only routes specified in the 'routes' "
|
||||
"property, if any, are used.",
|
||||
"When the method is set to 'auto' or 'dhcp' and this "
|
||||
"property is set to TRUE, automatically configured "
|
||||
"routes are ignored and only routes specified in the "
|
||||
"'routes' property, if any, are used.",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
/**
|
||||
* NMSettingIP6Config:ignore-auto-dns:
|
||||
*
|
||||
* When the method is set to 'auto' and this property to TRUE, automatically
|
||||
* configured nameservers and search domains are ignored and only namservers
|
||||
* and search domains specified in #NMSettingIP6Config:dns and
|
||||
* #NMSettingIP6Config:dns-search, if any, are used.
|
||||
* When the method is set to 'auto' or 'dhcp' and this property is set to
|
||||
* TRUE, automatically configured nameservers and search domains are ignored
|
||||
* and only namservers and search domains specified in
|
||||
* #NMSettingIP6Config:dns and #NMSettingIP6Config:dns-search, if any, are
|
||||
* used.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_IGNORE_AUTO_DNS,
|
||||
g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS,
|
||||
"Ignore DHCPv6/RDNSS DNS",
|
||||
"When the method is set to 'auto' and this property "
|
||||
"to TRUE, automatically configured nameservers and "
|
||||
"search domains are ignored and only namservers and "
|
||||
"search domains specified in the 'dns' and 'dns-search' "
|
||||
"properties, if any, are used.",
|
||||
"When the method is set to 'auto' or 'dhcp' and this "
|
||||
"property is set to TRUE, automatically configured "
|
||||
"nameservers and search domains are ignored and only "
|
||||
"namservers and search domains specified in the 'dns' "
|
||||
"and 'dns-search' properties, if any, are used.",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2007 - 2008 Red Hat, Inc.
|
||||
* (C) Copyright 2007 - 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_SETTING_IP6_CONFIG_H
|
||||
|
|
@ -65,6 +65,7 @@ GQuark nm_setting_ip6_config_error_quark (void);
|
|||
|
||||
#define NM_SETTING_IP6_CONFIG_METHOD_IGNORE "ignore"
|
||||
#define NM_SETTING_IP6_CONFIG_METHOD_AUTO "auto"
|
||||
#define NM_SETTING_IP6_CONFIG_METHOD_DHCP "dhcp"
|
||||
#define NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL "link-local"
|
||||
#define NM_SETTING_IP6_CONFIG_METHOD_MANUAL "manual"
|
||||
#define NM_SETTING_IP6_CONFIG_METHOD_SHARED "shared"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue