Roy Marples wrote: > Hi List! > > Now that NM supports the SUSE netconfig command, I've taken this a step > futher and patched in support for resolvconf [1]. > > As writing to /etc/resolv.conf and using resolvconf is pretty much the > same in C, I've split a few things up :) > > get_resolv_conf - Generates search and nameserver entries from > NMIP4Config [2] > dispatch_netconfig - Try and try SUSE netconfig > write_resolv_conf - Write out the resolv.conf file to a descriptor > dispatch_resolvconf - Try and use resolvconf > update_resolv_conf - Try and use /etc/resolv.conf > > In the patch, I changed the layout of resolv.conf slightly, removing > superflous new-lines and harsh text. > I gave it a try (on Debian), but it didn't out of the box. If I activate a normal (i.e. no vpn) connection, priv->vpn_config will be NULL. Thus in rewrite_resolv_conf(line 445), dispatch_resolvconf is called with an empty config. The results is that in dispatch_resolvconf(line 377) the resolvconf entry will be *removed* and as TRUE is returned, rewrite_resolv_conf will return at this point. I applied the attached patch to get it working for me. I haven't tested VPN connections. I'm not sure if openresolv is completely compatible to (Debian) resolvconf. In Debian, if /etc/resolv.conf is *not* a symlink to /etc/resolvconf/run/resolv.conf, it means that resolvconf is disabled. I guess we should add a check at nm-named-manager.c:349, to return FALSE in that case, so NM will update /etc/resolv.conf Cheers, Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
diff --git a/src/named-manager/nm-named-manager.c b/src/named-manager/nm-named-manager.c index bf36a37..20d3991 100644 --- a/src/named-manager/nm-named-manager.c +++ b/src/named-manager/nm-named-manager.c @@ -442,9 +442,9 @@ rewrite_resolv_conf (NMNamedManager *mgr, const char *iface, GError **error) /* If resolvconf is available, use it. * resolvconf only needs what the interface has provided, so don't merge */ - if (dispatch_resolvconf (priv->vpn_config, iface, TRUE, error)) + if (priv->vpn_config && dispatch_resolvconf (priv->vpn_config, iface, TRUE, error)) return TRUE; - if (dispatch_resolvconf (priv->device_config, iface, FALSE, error)) + if (priv->device_config && dispatch_resolvconf (priv->device_config, iface, FALSE, error)) return TRUE; /* Construct the composite config from all the currently active IP4Configs */
Attachment:
signature.asc
Description: OpenPGP digital signature