Bug 198601 - Pass the DHCP lease from the initrd to dhclient
Summary: Pass the DHCP lease from the initrd to dhclient
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mkinitrd
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Jones
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-12 08:44 UTC by Mark McLoughlin
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version: 5.0.47-1
Clone Of:
Environment:
Last Closed: 2006-07-13 18:57:55 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
mkinitrd-dhcp-lease.patch (4.50 KB, patch)
2006-07-12 08:44 UTC, Mark McLoughlin
no flags Details | Diff
initscripts-initrd-dhcp-lease.patch (1.84 KB, patch)
2006-07-12 08:45 UTC, Mark McLoughlin
no flags Details | Diff
mkinitrd-dhcp-lease.patch (4.00 KB, patch)
2006-07-12 14:14 UTC, Mark McLoughlin
no flags Details | Diff
initscripts-initrd-dhcp-lease.patch (1.28 KB, patch)
2006-07-12 14:15 UTC, Mark McLoughlin
no flags Details | Diff

Description Mark McLoughlin 2006-07-12 08:44:11 UTC
With nash's "network --bootproto dhcp" command, the initrd obtains a DHCP lease
and brings up the device.

However, if this device is configured to be brought up at boot time (ONBOOT=yes)
with dhcp (BOOTPROTO=dhcp) by the init scripts, the device is first brought down
and then a new DHCP lease is obtained before bringing the device back up.

This is obviously pretty catastrophic when the root filesystem is on NFS.

The most correct fix seems to be to allow the initrd to pass the lease onto
dhclient, in which case dhclient won't re-configure the device.


Attaching patches which takes a first cut at this.

The mkinitrd patch does the following:

  - Makes libdhcp write out the lease[1]
  - Adds a lame "cp" command to nash
  - Makes setuproot mount a tmpfs on /sysroot/var/lib/initrd
  - Copies the lease to there

The initscripts patch does the following:

  - Creates the /var/lib/initrd dir
  - In ifup-eth, copies any lease for that device from /var/lib/initrd
    for dhclient

[1] - If we're not happy with /var/lib/dhclient/dhclient.leases as the location
for this, we have the following options:

  - change libdhcp's pumpDhcpClassRun() to accept a path for the lease
    and pass that using "-lf <path>" to libdhcp4client's dhcpv4_client()
  - set the PATH_DHCLIENT_DB env var with the path for the lease

Comment 1 Mark McLoughlin 2006-07-12 08:44:11 UTC
Created attachment 132287 [details]
mkinitrd-dhcp-lease.patch

Comment 2 Mark McLoughlin 2006-07-12 08:45:24 UTC
Created attachment 132288 [details]
initscripts-initrd-dhcp-lease.patch

Comment 3 Jeremy Katz 2006-07-12 11:00:22 UTC
One problem with this is that it doesn't work if you have /var as a separate
filesystem (which we allow, and lots of people do).  :-/

Comment 4 Mark McLoughlin 2006-07-12 12:28:04 UTC
how about /initrd ? :/

Comment 5 Bill Nottingham 2006-07-12 13:12:56 UTC
Well, if you want someplace writable, that pretty much leaves /dev.

/initrd is dead, AFAIR.

Comment 6 Mark McLoughlin 2006-07-12 13:23:03 UTC
(In reply to comment #5)
> Well, if you want someplace writable, that pretty much leaves /dev.

Yeah ...

> /initrd is dead, AFAIR.

Sure, but it could be re-incarnated :)

We could make ourselves feel a bit better by saying /initrd is a "generic
mechanism for the initrd to pass stuff to initscripts" so, e.g. the initrd could
generate the root fstab entry this way too.

Comment 7 Bill Nottingham 2006-07-12 13:46:41 UTC
In rc.sysinit, we use /dev/.in_sysinit for some ugly temporary bookkeeping.
Defining something else could work, altough the LSB/FHS would probably yell at us.

Comment 8 Mark McLoughlin 2006-07-12 14:14:29 UTC
Created attachment 132308 [details]
mkinitrd-dhcp-lease.patch

Comment 9 Mark McLoughlin 2006-07-12 14:15:40 UTC
Created attachment 132309 [details]
initscripts-initrd-dhcp-lease.patch

Comment 10 Mark McLoughlin 2006-07-12 14:16:30 UTC
Okay, updated (but didn't test yet) the patches to copy the lease into /dev

Comment 11 Bill Nottingham 2006-07-13 17:58:50 UTC
Seems OK visually. Added in initscripts CVS.

Comment 12 Peter Jones 2006-07-13 18:57:55 UTC
In mkinitrd as well.


Note You need to log in before you can comment on or make changes to this bug.