[Bug 932275] Re: Bogus or no nameserver information written to /etc/network/interfaces

Thomas Hood 932275 at bugs.launchpad.net
Mon Feb 27 20:23:33 UTC 2012


In #940260 I wrote (in reverse order):
> 3. Perhaps the maintainer scripts should detect a flawed-netcfg-corrupted
> /e/n/i and either notify the admin or give her the opportunity
> (via debconf?) to repair the corrupted file.

Steve Langasek's change in 1.63ubuntu9 implements the most important
aspect of this, namely, not to accept garbage as a valid IP address for
the purpose of deciding whether or not to append the original file.

A fix-the-bogus-dns-nameservers-line wizard would be nice, but if we
were going to do that we would simply write a wizard for configuring
ifupdown for resolvconf.  What would be the correct way to implement
such a thing in Ubuntu?


> 2. Perhaps resolvconf should check the validity of each nameserver
> address string fed to it. Currently it doesn't do so, even though it
> does some "normalization" of address strings.

The normalized_stdin() function in /sbin/resolvconf should also be
enhanced to filter out bogus nameserver addresses.  Otherwise those
addresses will end up in resolv.conf, which is not what we want.  This
is a non-negligible issue, I think.


> 1. We need to check ifupdown and resolvconf code, thinking about
> what will happen when they get fed such dns-nameservers lines.


I will do this sometime this week, even though it means reading ifupdown code, which may still be written (yikes) in Literate Programming.  ;)

-- 
Thomas

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ifupdown in Ubuntu.
https://bugs.launchpad.net/bugs/932275

Title:
  Bogus or no nameserver information written to /etc/network/interfaces

Status in “ifupdown” package in Ubuntu:
  Triaged
Status in “netcfg” package in Ubuntu:
  Fix Released
Status in “resolvconf” package in Ubuntu:
  Fix Released

Bug description:
  Doing a test install of precise with static networking, I noticed
  bogus (non-ASCII) data written on the dns-nameservers line in
  /etc/network/interfaces, which was then be carried over to resolv.conf
  by the resolvconf package. Other times, this line would simply not be
  in /etc/network/interfaces at all.

  After looking at the code and doing some testing, the problem seems to
  be that at the end of static.c, the netcfg_write_resolvconf_options is
  called with the nameserver_array array, but this array is never
  actually populated. So, in the best-case scenario, it's pointing at
  zeros in memory and doesn't put anything in the interfaces file, but
  in other cases, spits out whatever happens to be in memory. :-) As
  near as I can tell, it looks like this happened somewhere between
  version 1.68 from debian and version 1.68ubuntu1.

  The fix is to either pass the namserver array from the iface struct,
  or just pass the struct itself and deal with it in the
  netcfg_write_resolvconf_options function.

  I'll attach two patches - a quick-and-dirty one and one that matches
  the way the netcfg_write_resolv function works.

  I'd love to have someone who's more familiar with the code have a look
  and make sure that I'm not doing anything bad, and then if it's
  helpful, I'm happy to create a debdiff.

  Thanks and let me know if you have any questions or if there's any
  more info I can provide.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/932275/+subscriptions




More information about the foundations-bugs mailing list