[Pkg-utopia-maintainers] [PATCH] resolvconf support (Re: NM 0.7 Debian Lenny - strangest issue...)
Michael Biebl
biebl at debian.org
Tue Jul 8 14:42:39 UTC 2008
Alexander Sack wrote:
> On Mon, Jul 07, 2008 at 03:51:22PM -0400, Dan Williams wrote:
>> On Mon, 2008-07-07 at 20:26 +0200, Michael Biebl wrote:
>>> 2.) If resolvconf is installed, change NM to not manage /etc/resolv.conf
>>> itself, but only pass the dns information to resolvconf (which then
>>> will write /etc/resolv.conf).
>>> The downside is, that resolvconf might have own dns configuration. So
>>> the resulting /etc/resolv.conf might differ from what NM expects it to be.
>>>
>>> I'm leaning towards 2.), but I'm open to other suggestions and comments.
>> I'm fine with #2 also; I'll take patches for this upstream.
>>
>> But I have one question that I pointed out earlier. If you install
>> resolvconf, does that _necessarily_ imply that it is turned on? i.e. I
>> can install apache, but I don't actually have to run apache even if it's
>> installed. Does resolvconf have an on/off switch somewhere, or do you
>> have to uninstall it to turn it off?
>
>
> Below a first patch introducing basic resolvconf support. I decided to
Ok, so you basically agree with #2.
> not add/delete nameserver entries for individual NMIP4Config's, but
> instead just add/delete _one_ config named "NetworkManager", which is
> based on the merged NMIP4Config that NM uses in rewrite_resolv_conf.
>
> The code will fall back to normal resolv.conf rewriting if
> resolvconf fails. Further I guarded the new code by #ifdef
> WITH_RESOLVCONF. However, I didnt add a configure flag.
>
I wouldn't necessarily add a configure flag and #ifdef WITH_RESOLVCONF.
I'd simply check at runtime, if the resolvconf binary is available (
g_file_test (RESOLVCONF, G_FILE_TEST_IS_EXECUTABLE)) { .. } )
Compiling NM with resolvconf support doesn't necessarily mean, that the
machine NM is installed on, has resolvconf installed.
> Comments?
>
>
> --- src/named-manager/nm-named-manager.c 2008-06-26 19:33:13 +0000
> +++ src/named-manager/nm-named-manager.c 2008-07-08 10:07:08 +0000
> @@ -29,25 +29,30 @@
> #include <glib.h>
>
> #include <glib/gi18n.h>
>
> #include "nm-named-manager.h"
> #include "nm-ip4-config.h"
> #include "nm-utils.h"
> #include "NetworkManagerSystem.h"
> +#include "NetworkManagerUtils.h"
>
> #ifdef HAVE_SELINUX
> #include <selinux/selinux.h>
> #endif
>
> #ifndef RESOLV_CONF
> #define RESOLV_CONF "/etc/resolv.conf"
> #endif
>
> +#ifndef RESOLV_CONF_PATH
> +#define RESOLV_CONF_PATH "/sbin/resolvconf"
> +#endif
I'd name that simply RESOLVCONF
> G_DEFINE_TYPE(NMNamedManager, nm_named_manager, G_TYPE_OBJECT)
>
> #define NM_NAMED_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
> NM_TYPE_NAMED_MANAGER, \
> NMNamedManagerPrivate))
>
>
> struct NMNamedManagerPrivate {
> @@ -291,23 +296,51 @@ rewrite_resolv_conf (NMNamedManager *mgr
> g_strerror (errno));
> }
> }
>
> g_free (domain);
> g_free (searches);
>
> if (*error == NULL) {
> - if (rename (tmp_resolv_conf, RESOLV_CONF) < 0) {
> + gboolean do_rewrite = TRUE;
> +
> +#ifdef WITH_RESOLVCONF
> + gint exit_code;
> + char *cmd;
> +
> + // delete NM resolvconf
> + nm_spawn_process(RESOLV_CONF_PATH " -d NetworkManager");
> + cmd = g_strconcat (RESOLV_CONF_PATH " -a nm1 ",
> + tmp_resolv_conf,
> + NULL);
Don't you think, we should use the real interface name here?
(And is that a typo: Networkmanager vs. nm1?)
I haven't actually tested the code yet.
Cheers,
Michael
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-utopia-maintainers/attachments/20080708/242795dd/attachment.pgp
More information about the Pkg-utopia-maintainers
mailing list