If resolvconf returns an error condition then NM overwrites /run/resolvconf/resolv.conf

Bug #1072341 reported by Thomas Hood
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
New
Undecided
Unassigned

Bug Description

(Arises from discussion here: https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/1000244/comments/78)

The code in src/dns-manager/nm-dns-manager.c is essentially the following.

        success = dispatch_resolvconf (domain, searches, nameservers, iface, error);
        if (success == FALSE)
                success = update_resolv_conf (domain, searches, nameservers, iface, error);

When resolvconf runs if may or may not return an error. For example, if some /etc/resolvconf/update.d/ hook script returns a nonzero status then that status is returned by resolvconf to the caller, NetworkManager. But as NetworkManager is currently coded, if resolvconf returns an error for any reason then NM writes nameserver information directly to /etc/resolv.conf, i.e., generally, to /run/resolvconf/resolv.conf, clobbering the file that resolvconf has just written. This is not appropriate.

I mentioned this issue ten months ago in comment #30 on bug #324233.

    https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/324233/comments/30

Although the most serious of the several problems I discussed there have been fixed in Quantal, the problem remains that NetworkManager does not correctly handle a nonzero exit status returned by resolvconf.

The NM behavior in question dates from the time that resolvconf was an optional package in universe which returned nonzero status when /etc/resolv.conf failed to be a symbolic link. In Quantal resolvconf does not return nonzero status when /etc/resolv.conf fails to be a symbolic link. It returns nonzero only when there is some problem, e.g., non-writeable filesystem or whatever. NetworkManager should probably just report this failure and not immediately proceed to overwrite resolvconf's output.

Instead of the code quoted above, nm-dns-manager.c should implement the following logic.

    IF resolvconf is installed as evidenced by the presence of executable file /sbin/resolvconf
    THEN dispatch_resolvconf () # Send info to /sbin/resolvconf
    ELSE update_resolv_conf () # Write info directly to (the target of) /etc/resolv.conf

Tags: patch
Revision history for this message
Thomas Hood (jdthood) wrote :

Here is a tested patch which implements the requested change.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch to fix the way NM runs resolvconf" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.