Re: NetworkManager on Debian



On Thu, 2008-05-01 at 14:27 +0300, Hristo Hristov wrote:
> Hello,
> 
> I was trying to make NM work with Debian with the help of Michael
> Biebl. I found several issues:
> 1) When the nm-system-settings was not working (because of missing configuration 
> file) the gnome applet was not showing when a wired network was enabled in the 
> left-click menu, and I could not get network information from the right-click menu.
> Is this expected behaviour?

I don't quite understand.  You're saying that nm-system-settings was
unable to claim it's D-Bus service name?  If that's the case, then NM
wouldn't be able to talk to it, and couldn't get any connections from
it, and then couldn't connect the wired network.  Could you explain a
bit more?

> 2) NM 0.7 doesn't seem to use the configuration of wireless networks I had from 0.6

The applet will convert the keys in GConf (see src/applet-compat.c) into
connections that 0.7 can use.

> 3) I'm trying to make NM work with resolvconf. I want to pass DNS configurations 
> received from DHCP to the dispatcher and then to the dispatcher script. I have no 
> knowledge of dbus, so I made an ugly patch to pass the first nameserver configuration.
> Could you tell me what should be the correct way of passing the nameservers 
> to the dispatcher?

You shouldn't be using the dispatcher for this or any other core
functionality of NM.  Instead, what information does resolvconf need,
and how do you call it?  Can we detect when the user wishes to run with
resolvconf enabled?  I view resolvconf as just one more method to
handle /etc/resolv.conf, in addition to the (broken) caching-nameserver
code and the direct resolv.conf manipulation.  I'd rather teach NM about
resolvconf properly if we can.

Dan

> 
> Best regards,
> Hristo
> 
> Index: callouts/nm-dispatcher-action.h
> ===================================================================
> --- callouts/nm-dispatcher-action.h	(revision 3624)
> +++ callouts/nm-dispatcher-action.h	(working copy)
> @@ -32,4 +32,5 @@
>  #define NMD_DEVICE_PROPS_TYPE             "type"
>  #define NMD_DEVICE_PROPS_STATE            "state"
>  #define NMD_DEVICE_PROPS_PATH             "path"
> +#define NMD_DEVICE_PROPS_DNS_NAMESERVERS  "nameservers"
>  
> Index: callouts/nm-dispatcher-action.c
> ===================================================================
> --- callouts/nm-dispatcher-action.c	(revision 3624)
> +++ callouts/nm-dispatcher-action.c	(working copy)
> @@ -218,12 +218,19 @@
>  dispatch_scripts (const char *action,
>                    const char *iface,
>                    const char *parent_iface,
> -                  NMDeviceType type)
> +                  NMDeviceType type,
> +                  guint32 nameservers)
>  {
>  	GDir *dir;
>  	const char *filename;
>  	GSList *scripts = NULL, *iter;
>  	GError *error = NULL;
> +	char sz_nameservers[20];
> +	sprintf( sz_nameservers, "%u.%u.%u.%u",
> +					(int)(nameservers&0xFF),
> +					(int)((nameservers >> 8)&0xFF),
> +					(int)((nameservers >> 16)&0xFF),
> +					(int)((nameservers >> 24)&0xFF) );
>  
>  	if (!(dir = g_dir_open (NMD_SCRIPT_DIR, 0, &error))) {
>  		g_warning ("g_dir_open() could not open '" NMD_SCRIPT_DIR "'.  '%s'",
> @@ -262,14 +269,15 @@
>  	g_dir_close (dir);
>  
>  	for (iter = scripts; iter; iter = g_slist_next (iter)) {
> -		gchar *argv[4];
> +		gchar *argv[5];
>  		gchar *envp[1] = { NULL };
>  		gint status = -1;
>  
>  		argv[0] = (char *) iter->data;
>  		argv[1] = (char *) iface;
>  		argv[2] = (char *) action;
> -		argv[3] = NULL;
> +		argv[3] = (char *) sz_nameservers;
> +		argv[4] = NULL;
>  
>  		error = NULL;
>  		if (g_spawn_sync ("/", argv, envp, 0, child_setup, NULL, NULL, NULL, &status, &error)) {
> @@ -304,6 +312,7 @@
>  	char *parent_iface = NULL;
>  	NMDeviceType type = DEVICE_TYPE_UNKNOWN;
>  	GValue *value;
> +	guint32 nameservers = 0;
>  
>  	/* Back off the quit timeout */
>  	if (d->quit_timeout)
> @@ -341,8 +350,13 @@
>  	}
>  	type = g_value_get_uint (value);
>  
> -	dispatch_scripts (action, iface, parent_iface, type);
> +	value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_DNS_NAMESERVERS);
> +	if (value && G_VALUE_HOLDS_UINT (value)) {
> +		nameservers = g_value_get_uint (value);
> +	}
>  
> +	dispatch_scripts (action, iface, parent_iface, type, nameservers);
> +
>  out:
>  	return TRUE;
>  }
> Index: src/NetworkManagerUtils.c
> ===================================================================
> --- src/NetworkManagerUtils.c	(revision 3624)
> +++ src/NetworkManagerUtils.c	(working copy)
> @@ -354,6 +354,8 @@
>  	GHashTable *connection_hash;
>  	GHashTable *connection_props;
>  	GHashTable *device_props;
> +	NMIP4Config *config = NULL;
> +	guint32 num_nameservers = 0;
>  
>  	g_return_if_fail (action != NULL);
>  	g_return_if_fail (NM_IS_DEVICE (device));
> @@ -423,6 +425,12 @@
>  	g_hash_table_insert (device_props, NMD_DEVICE_PROPS_PATH,
>  	                     op_to_gvalue (nm_device_get_udi (device)));
>  
> +	config = nm_device_get_ip4_config (device);
> +	num_nameservers = nm_ip4_config_get_num_nameservers (config);
> +	if ( num_nameservers > 0 )
> +		g_hash_table_insert (device_props, NMD_DEVICE_PROPS_DNS_NAMESERVERS,
> +			uint_to_gvalue (nm_ip4_config_get_nameserver(config, 0)));
> +
>  	dbus_g_proxy_call_no_reply (proxy, "Action",
>  	                            G_TYPE_STRING, action,
>  	                            DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash,
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]