Re: dnsmasq



Hi,

some initial comments:

On Sat, Sep 06, 2008 at 04:47:33AM -0700, Howard Chu wrote:
> +static gboolean
> +dnsmasq_update(NMNamedManager *mgr)
> +{
> +	NMNamedManagerPrivate *priv;
> +	GSList *iter;
> +	DBusMessage *msg;
> +	const char *domain;
>  
> +	priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr);
> +
> +	msg = dbus_message_new_method_call(
> +		"uk.org.thekelleys.dnsmasq",
> +		"/uk/org/thekelleys/dnsmasq",
> +		"uk.org.thekelleys.dnsmasq",
> +		"SetServers");
> +	for (iter = priv->configs; iter; iter = g_slist_next (iter)) {

Instead of iterating here on your own, couldnt you use the "composite"
IP4 config by moving the dnsmasq_update function call further down here:

>  static gboolean
>  rewrite_resolv_conf (NMNamedManager *mgr, const char *iface, GError **error)
>  {
> @@ -378,6 +437,19 @@
>  
>  	priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr);
>  
> +	if (priv->dnsmasq_proxy)
> +	{
> +		GString *ver;
> +		/* see if dnsmasq is listening */
> +		if (dbus_g_proxy_call(priv->dnsmasq_proxy, "GetVersion", error,
> +			G_TYPE_INVALID, G_TYPE_STRING, &ver, G_TYPE_INVALID ))
> +		{
> +			success = dnsmasq_update(mgr);
> +			if (success)
> +				return success;
> +		}
> +	}
> +
>  	/* Construct the composite config from all the currently active IP4Configs */
>  	composite = nm_ip4_config_new ();
>  
         ^^^^


>  static void
> Index: named-manager/nm-named-manager.h
> ===================================================================
> --- named-manager/nm-named-manager.h	(revision 4043)
> +++ named-manager/nm-named-manager.h	(working copy)
> @@ -26,6 +26,7 @@
>  #include "config.h"
>  #include <glib-object.h>
>  #include <dbus/dbus.h>
> +#include <dbus/dbus-glib-lowlevel.h>
>  #include "nm-ip4-config.h"
>  
>  typedef enum {

Is there a particular reason to put that include here instead of the
.c file where its used?


 - Alexander



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