netcfg hang bug in autoconfig.c

Bug #917905 reported by Alec Warner
This bug affects 5 people
Affects Status Importance Assigned to Milestone
netcfg (Ubuntu)
Stéphane Graber

Bug Description

I am working on the Precise alpha (beta?) It appears there is a bug in netcfg's autoconfig.c.

antarus@goats2 ~ $ rdisc6 eth0
Soliciting ff02::2 (ff02::2) on eth0...

Hop limit : 64 ( 0x40)
Stateful address conf. : No
Stateful other conf. : Yes
Router preference : medium
Router lifetime : 1800 (0x00000708) seconds
Reachable time : unspecified (0x00000000)
Retransmit time : unspecified (0x00000000)
 Source link-layer address: 00:05:73:A0:00:65
 MTU : 1500 bytes (valid)
 Prefix : 2620:0:1000:2800::/64
  Valid time : 2592000 (0x00278d00) seconds
  Pref. time : 604800 (0x00093a80) seconds
 from fe80::5:73ff:fea0:65

We set Stateful Other conf which correctly tells netcfg to try dhcpv6.
Sadly we don't have dhcpv6 set up yet, so dhclient will never receive a lease. netcfg/dhcpv6_timeout is normally set for 15s and this should only impose a minor delay for us (until we properly configure our network.) However due to a bug in netcfg_dhcpv6() it hangs forever instead.

in netcfg_dhcpv6(...)
        rv = poll_dhcpv6_client(client, interface);

        dhcpv6_reader = fdopen(dhcpv6_pipe[0], "r");
        while (fgets(l, sizeof(l), dhcpv6_reader) != NULL) {

It looks like the code tries to read from dhcpv6_pipe which is the stdout of the dhclient process. However the client has not actually received any leases (since we don't run dhcpv6) so the output it is expecting will never happen and it will hang on the fgets() call. I think you should check the value of 'rv' to see if we actually got a lease. If we didn't then we shouldn't try to read from the pipe.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in netcfg (Ubuntu):
status: New → Confirmed
Revision history for this message
Alec Warner (antarus) wrote :

I built a custom initrd and tried it here and it solved my issue.

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

The attachment "Push dhcpv6_timeout from debconf into dhclient's config. Run dhclient with -1 (oneshot) so it will die if it fails to get a lease." 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
Revision history for this message
Stéphane Graber (stgraber) wrote :

Thanks for your bug report and patch. do a quick test and review of the patch and if all looks good, apply it in Ubuntu and if it's common to Debian, submit it there too.

Changed in netcfg (Ubuntu):
assignee: nobody → Stéphane Graber (stgraber)
Revision history for this message
Colin Watson (cjwatson) wrote :

I haven't tested it but it looks good to me.

Changed in netcfg (Ubuntu):
importance: Undecided → High
Revision history for this message
Stéphane Graber (stgraber) wrote :

I can confirm this fixes the bug. I'm running regression tests on it now.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netcfg - 1.68ubuntu9

netcfg (1.68ubuntu9) precise; urgency=low

  * Add a post-base-install hook to detect resolvconf and copy
    /run/resolvconf/resolv.conf to outside the target so that when /run
    is bind-mounted DNS resolving continues to work. (LP: #926447)
  * Apply patch from Alec Warner making netcfg respect netcfg/dhcpv6_timeout
    and running dhclient in one-shot mode (-1). (LP: #917905)
 -- Stephane Graber <email address hidden> Mon, 06 Feb 2012 12:05:02 -0500

Changed in netcfg (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers