I have made some small changes to the default /etc/inid.d/net.eth0 and /etc/conf.d/net. These changes simply add functionality alowing for an alternate ip config should dhcpcd fail to find a server. I made these changes because I use a labtop and when I would boot away from my network apache, fam, metalog, and other needed daemons would fail causing poblems for many programs (at least ones I run) and this prevents this. Anyway I will attach the diffs after filing this report. Reproducible: Always Steps to Reproduce: 1. setup dhcp in /etc/conf.d/net 2. unplug network cable from computer 3. restart Actual Results: As stated due to script depends the failure of net.ethx causes needed daemons not to start. Expected Results: If dhcpcd failes an alternate ip address for the interface should be set. I know any one can write a work around for this I just thought it would be nice it did it by default. Also I used dhcpcd -t 30 by default because after some testing I found the default 60 sec to be way more than needed and yet 20 was not enough on some networks. I think 30 is a good medium. However this is no big deal.
Created attachment 9173 [details, diff] Patch to fix this "bug". Modifies net.eth0.
Created attachment 9174 [details, diff] The other patch for /etc/conf.d/net
Sorry, just a bit hecktic this side. Looks good as I said in lists, but it will be a bit more effort to merge against cvs which have changed some.
Can you elaborate on the need of the ip address? If I understand you correctly, you have a number of daemons that fail to load because they are bound on an interface and stop when that interface isn't up? Why is metalog in that list, and fam? What if you tell apache to just listen to all traffic, regardless of interface? What happens if you go somewhere else, and you get a different IP address? I use a laptop with and without network, with fam and metalog, and have no problems in that department. I use wwwoffled for caching/proxying http traffic, and switch it to offline mode when not connected. I switch around configurations for wwwoffled according to where I am, so that I just have to switch proxies in one location. I'm not saying that your needs aren't valid, just wondering if there are other ways. Assuming that you have a valid needs, and looking at the code, it looks like you made it more confusing than it need be. This only needs to be an extra if-clause in the case where dhcp is used. And I think it would be best if the configuration variable would be called dhcpcd_fail_ip_<iface>, so that it has the same naming convention as the rest, with the interface at the end. Also, I think that your solution could be improved: 1) You want to check if your cable is connected. You can do that much faster with mii-tool, in all probability. In fact, I wrote a script that monitors mii-tool, and brings up my interface as soon as I plug in the cable. I'll make it available when it's ready. 2) What IP address do you want to give it? Perhaps, if dhcp fails, we could provide a list of configs and hosts that should be on-line for that network to make sense. Then, if cable is plugged in (or if it cannot be detected), and dhcpcd fails, it will go over the list one by one until it gets a config that works. Or the other way round, dhcpcd takes more time. Azarah, what do you think?
I am not user of dhcp. If you guys can sort it out to be a generic and working fix, I will apply.
I posted the solution for me in http://bugs.gentoo.org/show_bug.cgi?id=16665 With the cable - think about wlan ;-) There is no cable... But there are tools like netenv, http://netenv.sourceforge.net/ which might be interesting for this problem...
This is fixed in baselayout-1.9.0 using ifconfig_fallback_eth0. See bug 48305