On Fri, 2005-02-11 at 22:51 +0100, Tomislav Vujec wrote: >On Fri, 11 Feb 2005 09:21:10 -0500, Colin Walters wrote: >> Tomislav, thanks for the patch. This should already be fixed in the >> latest CVS though. Which version of NetworkManager are you using? > >The fix in the patch you posted would work too, but I can't find it in the >CVS. It seems that there is a single branch, and no diffs after 1.9 >include your change. I am using the revision 1.12 which is the current >HEAD. Could it be that this patch is only in your private tree? Ah, how embarrassing :) Indeed. Could you try the patch? I'm in the middle of a number of things right now and won't have a chance to set up a DHCP server etc for testing soon. I am still wondering whether this is actually a standard DHCP feature, and if it is whether other separators like tab are valid.
Index: src/NetworkManagerMain.h
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerMain.h,v
retrieving revision 1.9
diff -u -d -r1.9 NetworkManagerMain.h
--- src/NetworkManagerMain.h 7 Feb 2005 23:04:05 -0000 1.9
+++ src/NetworkManagerMain.h 11 Feb 2005 23:00:41 -0000
@@ -42,7 +42,7 @@
NMNamedManager *named;
GList *nameserver_ids; /* For now these are global instead of per-device */
- guint domain_search_id;
+ GList *domain_search_ids;
DBusConnection *dbus_connection;
NMDbusMethodList *nm_methods;
Index: src/NetworkManagerDHCP.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerDHCP.c,v
retrieving revision 1.12
diff -u -d -r1.12 NetworkManagerDHCP.c
--- src/NetworkManagerDHCP.c 10 Feb 2005 20:54:04 -0000 1.12
+++ src/NetworkManagerDHCP.c 11 Feb 2005 23:00:41 -0000
@@ -81,31 +81,45 @@
}
}
-static void set_domain_search (NMDevice *dev, const char *domain)
+static void set_domain_searches (NMDevice *dev, const char *searches_str)
{
GError *error = NULL;
- guint id;
+ GList *elt;
+ char **searches;
- if (dev->app_data->domain_search_id
- && !nm_named_manager_remove_domain_search (dev->app_data->named,
- dev->app_data->domain_search_id,
- &error))
+ /* Reset our domain search list */
+ for (elt = dev->app_data->domain_search_ids; elt; elt = elt->next)
{
- syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't remove domain search: %s\n", error->message);
- g_clear_error (&error);
+ if (!nm_named_manager_remove_domain_search (dev->app_data->named,
+ GPOINTER_TO_UINT (elt->data),
+ &error))
+ {
+ syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't remove domain search: %s\n", error->message);
+ g_clear_error (&error);
+ }
}
-
- syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Adding domain search: %s\n", domain);
- if ((id = nm_named_manager_add_domain_search (dev->app_data->named,
- domain,
- &error)))
- dev->app_data->domain_search_id = id;
- else
+ g_list_free (dev->app_data->domain_search_ids);
+ dev->app_data->domain_search_ids = NULL;
+
+ searches = g_strsplit (searches_str, " ", 0);
+
+ for (; *searches; searches++)
{
- dev->app_data->domain_search_id = 0;
- syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't add domain search: %s\n", error->message);
- g_clear_error (&error);
+ const char *search_elt = *searches;
+ guint id;
+
+ syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Adding domain search: %s\n", search_elt);
+ if ((id = nm_named_manager_add_domain_search (dev->app_data->named,
+ search_elt,
+ &error)))
+ dev->app_data->domain_search_ids = g_list_append (dev->app_data->domain_search_ids, GUINT_TO_POINTER (id));
+ else
+ {
+ syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't add domain search: %s\n", error->message);
+ g_clear_error (&error);
+ }
}
+ g_strfreev (searches);
}
/*
@@ -151,7 +165,7 @@
set_nameservers (dev, dhcp_interface_get_dhcp_field (dev->dhcp_iface, dns), dhcp_interface_get_dhcp_field_len (dev->dhcp_iface, dns));
if (dhcp_interface_dhcp_field_exists (dev->dhcp_iface, domainName))
- set_domain_search (dev, dhcp_interface_get_dhcp_field (dev->dhcp_iface, domainName));
+ set_domain_searches (dev, dhcp_interface_get_dhcp_field (dev->dhcp_iface, domainName));
}
Attachment:
signature.asc
Description: This is a digitally signed message part