Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 23428 - Dhcpcd patch for correct stop and correct resolv.conf handling
Summary: Dhcpcd patch for correct stop and correct resolv.conf handling
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Brandon Low (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-24 20:05 UTC by Alwyn Schoeman
Modified: 2004-08-18 21:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch file for dhcpcd (dhcpcd-1.3.22_p4-keepCacheAndResolv.diff,4.56 KB, patch)
2003-06-24 20:06 UTC, Alwyn Schoeman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alwyn Schoeman 2003-06-24 20:05:19 UTC
The patch is a patch for dhcpcd-1.3.22-pl4.  I have submitted a patch to the
upstream developer but he seems to be 'missing' so I submit this to gentoo for
use until said developer is 'found' again.

Problems fixed by this patch:

1) Currently in gentoo dhcpcd is stopped by doing a -k on it.  The result of
this is that a machine almost always gets a new ip address on reboot.  There are
cases where this behaviour is unwanted.  Some people have proposed to use kill
-s SIGTERM to get beyond this, but it is just not clean enough for me.

1-fix) The patch adds a -z option which will shutdown dhcpcd precisely the same
as -k except for not removing the cache file which solves the problem.  The
manpage has also been updated to reflect the new command.

2) In some scenarios a user would want to use his own resolv.conf at work and
perhaps a dhcp assigned one at home. If you specify a -R in dhcpcd it will use
your current resolv.conf, if not it will backup this file to resolv.conf.sv and
replace resolv.conf.  Upon shutdown it will replace the resolv.conf file with
the original from resolv.conf.sv again.

This is all fine and well except for the case where your machine shuts down
improperly and resolv.conf.sv is not restored.  In such a case you loose your
fixed resolv.conf.

2-fix) The patch makes sure that if there is a resolv.conf.sv present from the
previous session, it gets restored to resolv.conf before dhcpcd does its normal
resolv.conf processing.

How to add it:
1) Add the patch file to the files directory and rebuild md5 hashes.
2) Add epatch $FILESDIR/${P}-keepCacheAndResolv.diff to end of src_unpack of the
latest ebuild file.
3) Change the standard /etc/init.d/net.eth0 to use -z on stop.

Reproducible: Always
Steps to Reproduce:
Not bug, but patch


Expected Results:  
I have an eth0 with fixed resolv.conf at work and wlan0 with dhcp resolv.conf at
home.

I always keep the same address when using -z and my resolv.conf works correctly
wherever I am.
Comment 1 Alwyn Schoeman 2003-06-24 20:06:54 UTC
Created attachment 13812 [details, diff]
Patch file for dhcpcd
Comment 2 Daniel Robbins (RETIRED) gentoo-dev 2003-09-06 16:43:11 UTC
Thanks for this patch! It will show up in 1.3.22_p4-r1 later today. This will really help us.
Comment 3 Alwyn Schoeman 2004-08-17 21:18:30 UTC
Hi,

For some reason this patch has been removed from portage. 

I am now having the same problems as originally.  Please add the patch again
or if it has problems applying, inform so I can fix.

Thank you.
Comment 4 Alwyn Schoeman 2004-08-17 21:31:35 UTC
Hmm, let me just check, it looks as if it is still there but not working? Will investigate further.
Comment 5 Alwyn Schoeman 2004-08-17 21:36:26 UTC
Will test tonight on my wireless network.

Maybe it is net.eth0 related or just my stupidity, will update
bug tomorrow.
Comment 6 Alwyn Schoeman 2004-08-18 21:18:29 UTC
Ok, found the problem, but not the solution.

It appears that the net.eth0 script looks for the pid of dhcpcd before it uses dhcpcd to release the ip.

For some reason the pid isn't created as dhcpcd doesn't seem to stay running after configuring the interface.

I do not know yet what the problem is, but it is not with the patch.

So I'm marking it fixed.