diff options
author | Dan Williams <dcbw@redhat.com> | 2008-03-09 05:11:22 +0000 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2008-03-09 05:11:22 +0000 |
commit | 95ef49b1681f4fe1dd8d85ba83f3f2877ef2fe5e (patch) | |
tree | 2de76de3bd9c59fc53161f48c7fda5c52bbb5a57 | |
parent | f6c98a9d80df011bad61b7f3737ddb4130cd2d0b (diff) | |
download | NetworkManager-95ef49b1681f4fe1dd8d85ba83f3f2877ef2fe5e.tar.gz |
2008-03-09 Dan Williams <dcbw@redhat.com>
Patch from Bas Zoetekouw <bas@debian.org>
* src/nm-ip4-config.c
src/nm-ip4-config.h
- (nm_ip4_config_add_search, nm_ip4_config_get_search,
nm_ip4_config_get_num_searches): add 'searches' as distinct from
domains. 'searches' is the correct way to store multiple search
domains, whereas 'domains' is really just supposed to store one
domain. Some sites abuse the DHCP 'domain-name' option to push
search domains to the client.
- (nm_ip4_config_add_domain): group with related functions (my patch)
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3402 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | src/nm-ip4-config.c | 48 | ||||
-rw-r--r-- | src/nm-ip4-config.h | 4 |
3 files changed, 55 insertions, 11 deletions
@@ -1,5 +1,19 @@ 2008-03-09 Dan Williams <dcbw@redhat.com> + Patch from Bas Zoetekouw <bas@debian.org> + + * src/nm-ip4-config.c + src/nm-ip4-config.h + - (nm_ip4_config_add_search, nm_ip4_config_get_search, + nm_ip4_config_get_num_searches): add 'searches' as distinct from + domains. 'searches' is the correct way to store multiple search + domains, whereas 'domains' is really just supposed to store one + domain. Some sites abuse the DHCP 'domain-name' option to push + search domains to the client. + - (nm_ip4_config_add_domain): group with related functions (my patch) + +2008-03-09 Dan Williams <dcbw@redhat.com> + * src/dhcp-manager/nm-dhcp-manager.c - (dhclient_run): send interface-specific config files to dhclient diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 6fb7058162..bdd97732ab 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -51,6 +51,7 @@ typedef struct { GArray *nameservers; GPtrArray *domains; + GPtrArray *searches; gchar * hostname; gchar * nis_domain; @@ -251,17 +252,6 @@ guint32 nm_ip4_config_get_num_nis_servers (NMIP4Config *config) return NM_IP4_CONFIG_GET_PRIVATE (config)->nis_servers->len; } -void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain) -{ - g_return_if_fail (NM_IS_IP4_CONFIG (config)); - g_return_if_fail (domain != NULL); - - if (!strlen (domain)) - return; - - g_ptr_array_add (NM_IP4_CONFIG_GET_PRIVATE (config)->domains, g_strdup (domain)); -} - void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname) { g_return_if_fail (NM_IS_IP4_CONFIG (config)); @@ -319,6 +309,19 @@ guint32 nm_ip4_config_get_num_static_routes (NMIP4Config *config) return (NM_IP4_CONFIG_GET_PRIVATE (config)->static_routes->len) / 2; } + +void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain) +{ + g_return_if_fail (NM_IS_IP4_CONFIG (config)); + g_return_if_fail (domain != NULL); + g_return_if_fail (strlen (domain) > 0); + + if (!strlen (domain)) + return; + + g_ptr_array_add (NM_IP4_CONFIG_GET_PRIVATE (config)->domains, g_strdup (domain)); +} + const char *nm_ip4_config_get_domain (NMIP4Config *config, guint i) { g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL); @@ -333,6 +336,29 @@ guint32 nm_ip4_config_get_num_domains (NMIP4Config *config) return NM_IP4_CONFIG_GET_PRIVATE (config)->domains->len; } +void nm_ip4_config_add_search (NMIP4Config *config, const char *search) +{ + g_return_if_fail (config != NULL); + g_return_if_fail (search != NULL); + g_return_if_fail (strlen (search) > 0); + + g_ptr_array_add (NM_IP4_CONFIG_GET_PRIVATE (config)->searches, g_strdup (search)); +} + +const char *nm_ip4_config_get_search (NMIP4Config *config, guint i) +{ + g_return_val_if_fail (config != NULL, NULL); + + return (const char *) g_ptr_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->searches, i); +} + +guint32 nm_ip4_config_get_num_searches (NMIP4Config *config) +{ + g_return_val_if_fail (config != NULL, 0); + + return NM_IP4_CONFIG_GET_PRIVATE (config)->searches->len; +} + guint32 nm_ip4_config_get_mtu (NMIP4Config *config) { g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0); diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index 4528968e79..720a64948b 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -96,6 +96,10 @@ void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain); const char * nm_ip4_config_get_domain (NMIP4Config *config, guint i); 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); + guint32 nm_ip4_config_get_mtu (NMIP4Config *config); void nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu); |