mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
2008-05-23 Tambet Ingo <tambet@gmail.com>
Add a flag to NMSettingIP4Config to make it possible to ignore the DNS information received from DHCP. * libnm-util/nm-setting-ip4-config.c: Add a new membet "ignore_dhcp_dns" to make it possible to ignore the DNS information (both servers and searches) returned by DHCP server. * src/NetworkManagerUtils.c (nm_utils_merge_ip4_config): Reset the name servers and searches if "ignore_dhcp_dns" is set. * src/nm-ip4-config.c (nm_ip4_config_reset_nameservers) (nm_ip4_config_reset_searches): Implement. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3685 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
6cc399d126
commit
0ada5a4263
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2008-05-23 Tambet Ingo <tambet@gmail.com>
|
||||
|
||||
Add a flag to NMSettingIP4Config to make it possible to ignore the DNS
|
||||
information received from DHCP.
|
||||
|
||||
* libnm-util/nm-setting-ip4-config.c: Add a new membet "ignore_dhcp_dns"
|
||||
to make it possible to ignore the DNS information (both servers and
|
||||
searches) returned by DHCP server.
|
||||
|
||||
* src/NetworkManagerUtils.c (nm_utils_merge_ip4_config): Reset the
|
||||
name servers and searches if "ignore_dhcp_dns" is set.
|
||||
|
||||
* src/nm-ip4-config.c (nm_ip4_config_reset_nameservers)
|
||||
(nm_ip4_config_reset_searches): Implement.
|
||||
|
||||
2008-05-22 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Remove anything mDNS related. This is better done from a distro-specific
|
||||
|
|
|
@ -16,6 +16,7 @@ enum {
|
|||
PROP_DNS,
|
||||
PROP_DNS_SEARCH,
|
||||
PROP_ADDRESSES,
|
||||
PROP_IGNORE_DHCP_DNS,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
@ -111,6 +112,9 @@ set_property (GObject *object, guint prop_id,
|
|||
nm_utils_slist_free (setting->addresses, g_free);
|
||||
setting->addresses = nm_utils_ip4_addresses_from_gvalue (value);
|
||||
break;
|
||||
case PROP_IGNORE_DHCP_DNS:
|
||||
setting->ignore_dhcp_dns = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -136,6 +140,9 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_ADDRESSES:
|
||||
nm_utils_ip4_addresses_to_gvalue (setting->addresses, value);
|
||||
break;
|
||||
case PROP_IGNORE_DHCP_DNS:
|
||||
g_value_set_boolean (value, setting->ignore_dhcp_dns);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -186,4 +193,12 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class)
|
|||
"List of NMSettingIP4Addresses",
|
||||
DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_IGNORE_DHCP_DNS,
|
||||
g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_DHCP_DNS,
|
||||
"Ignore DHCP DNS",
|
||||
"Ignore DHCP DNS",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
||||
}
|
||||
|
|
|
@ -16,10 +16,11 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4"
|
||||
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD "method"
|
||||
#define NM_SETTING_IP4_CONFIG_DNS "dns"
|
||||
#define NM_SETTING_IP4_CONFIG_DNS_SEARCH "dns-search"
|
||||
#define NM_SETTING_IP4_CONFIG_ADDRESSES "addresses"
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD "method"
|
||||
#define NM_SETTING_IP4_CONFIG_DNS "dns"
|
||||
#define NM_SETTING_IP4_CONFIG_DNS_SEARCH "dns-search"
|
||||
#define NM_SETTING_IP4_CONFIG_ADDRESSES "addresses"
|
||||
#define NM_SETTING_IP4_CONFIG_IGNORE_DHCP_DNS "ignore-dhcp-dns"
|
||||
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD_DHCP "dhcp"
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD_AUTOIP "autoip"
|
||||
|
@ -38,6 +39,7 @@ typedef struct {
|
|||
GArray *dns; /* array of guint32 */
|
||||
GSList *dns_search; /* list of strings */
|
||||
GSList *addresses; /* array of NMSettingIP4Address */
|
||||
gboolean ignore_dhcp_dns;
|
||||
} NMSettingIP4Config;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* Dan Williams <dcbw@redhat.com>
|
||||
|
@ -242,6 +244,11 @@ nm_utils_merge_ip4_config (NMIP4Config *ip4_config, NMSettingIP4Config *setting)
|
|||
if (!setting)
|
||||
return; /* Defaults are just fine */
|
||||
|
||||
if (setting->ignore_dhcp_dns) {
|
||||
nm_ip4_config_reset_nameservers (ip4_config);
|
||||
nm_ip4_config_reset_searches (ip4_config);
|
||||
}
|
||||
|
||||
if (setting->dns) {
|
||||
int i, j;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* Dan Williams <dcbw@redhat.com>
|
||||
|
@ -238,6 +240,16 @@ guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config)
|
|||
return NM_IP4_CONFIG_GET_PRIVATE (config)->nameservers->len;
|
||||
}
|
||||
|
||||
void nm_ip4_config_reset_nameservers (NMIP4Config *config)
|
||||
{
|
||||
NMIP4ConfigPrivate *priv;
|
||||
|
||||
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
||||
|
||||
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||
g_array_remove_range (priv->nameservers, 0, priv->nameservers->len);
|
||||
}
|
||||
|
||||
void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis_server)
|
||||
{
|
||||
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
||||
|
@ -366,6 +378,16 @@ guint32 nm_ip4_config_get_num_searches (NMIP4Config *config)
|
|||
return NM_IP4_CONFIG_GET_PRIVATE (config)->searches->len;
|
||||
}
|
||||
|
||||
void nm_ip4_config_reset_searches (NMIP4Config *config)
|
||||
{
|
||||
NMIP4ConfigPrivate *priv;
|
||||
|
||||
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
||||
|
||||
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||
g_ptr_array_remove_range (priv->searches, 0, priv->searches->len);
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_mtu (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
||||
|
|
|
@ -70,6 +70,7 @@ void nm_ip4_config_set_ptp_address (NMIP4Config *config, guint32 ptp_addr);
|
|||
void nm_ip4_config_add_nameserver (NMIP4Config *config, guint32 nameserver);
|
||||
guint32 nm_ip4_config_get_nameserver (NMIP4Config *config, guint i);
|
||||
guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config);
|
||||
void nm_ip4_config_reset_nameservers (NMIP4Config *config);
|
||||
|
||||
void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis_server);
|
||||
guint32 nm_ip4_config_get_nis_server (NMIP4Config *config, guint i);
|
||||
|
@ -92,6 +93,7 @@ guint32 nm_ip4_config_get_num_domains (NMIP4Config *config);
|
|||
void nm_ip4_config_add_search (NMIP4Config *config, const char *search);
|
||||
const char * nm_ip4_config_get_search (NMIP4Config *config, guint i);
|
||||
guint32 nm_ip4_config_get_num_searches (NMIP4Config *config);
|
||||
void nm_ip4_config_reset_searches (NMIP4Config *config);
|
||||
|
||||
guint32 nm_ip4_config_get_mtu (NMIP4Config *config);
|
||||
void nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu);
|
||||
|
|
Loading…
Reference in a new issue