If /etc/conf.d/net has routes formatted like this: routes_eth0=" default via X.X.X.X " then net.eth0 assumes this is a "-host" routing failing to set up the proper default. This happens because of the whitespace in front of the command that prevents a case block from matching it. Reproducible: Always Steps to Reproduce: 1. Format your routes_eth0 like in the description 2. Run /etc/init.d/net.eth0 restart 3. Run netstat -rn and see that the route is not a network default Actual Results: Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 64.81.40.1 255.255.255.255 UGH 0 0 0 eth0 Expected Results: Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface ... 0.0.0.0 64.81.40.1 0.0.0.0 UG 0 0 0 eth0 It's a non-obvious bug that can easily happen as a result of translating old array format ( "..." "..." ) into the new baselayout-2 format. It happens because in this case block: case ${cmd} in -net" "*|-host" "*);; *" "netmask" "*) cmd="-net ${cmd}";; *.*.*.*/32*) cmd="-host ${cmd}";; *.*.*.*/*|0.0.0.0|0.0.0.0" "*) cmd="-net ${cmd}";; default|default" "*) cmd="-net ${cmd}";; *) cmd="-host ${cmd}";; esac ... the line does not match anything and falls into *, getting -host in front of it.
Created attachment 272693 [details, diff] Crude patch using sed Not sure if it's a good idea to call an external process, but can't think of anything better right now. May be adding a "trim" command of some sort into runscript?
Comment on attachment 272693 [details, diff] Crude patch using sed This patch is not in a unified diff format, so I am unable to apply it. Can you please re-post this in a unified diff format?
Created attachment 272993 [details, diff] Same sed based patch in unified format Patch reposted in unified format.
I can't reproduce your problem, works fine for me.
Christian, did you test with the exact format I described (whitespace in front of "default via")? I still see the bug in openrc 0.8.3. It's minor, I agree, but it is easy to put a space in front of "default" by mistake which would show no error and would set up incorrect routes. The fix is trivial. I don't see any reason not to apply it.
Yeah, I also tried it with spaces as well as tabs and also with space/tab at the end of the route. Looks good here. Can you please attach your conf.d/net, so that I can test it again?
Created attachment 287049 [details] Config that does not work
If I add an output below line 624 of /etc/init.d/net.lo then I get this on the attached config: * Caching service dependencies [ ok ] * Bringing up interface eth0 * 192.168.0.205/24 [ ok ] * Adding routes * default via 192.168.0.1 ... * <<<<-host default via 192.168.0.1>>>> Notice "-host" in the cmd? It should be "-net" if not for the whitespace.
# /etc/conf.d/net modules="iproute2" config_eth0=" 192.168.1.200/24 " routes_eth0=" default via 192.168.1.160 " # /etc/init.d/net.eth0 restart * Bringing down interface eth0 * Bringing up interface eth0 * 192.168.1.200/24 ... [ ok ] * Adding routes * default via 192.168.1.160 ... [ ok ] # netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.1.160 0.0.0.0 UG 0 0 0 eth0 127.0.0.0 127.0.0.1 255.0.0.0 UG 0 0 0 lo 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Oh, btw. I use the latest git revision of openrc, so currently rc (OpenRC) 0.9.3git-645bbf (Gentoo Linux). iputils 20100418-r1 (Shouldn't matter but anyway..)
I don't know about the git version, but the latest in portage (0.9.3-r1) still has this problem, I just checked. ...and looking at the git version (without actually installing it) I don't see it fixed there either.
Can't reproduce it with 0.9.3-r1 either. Please also attach emerge --info.
Created attachment 287059 [details] emerge --info, per request.
Ok, this happens if you use net-tools instead of iproute2.
(In reply to comment #14) > Ok, this happens if you use net-tools instead of iproute2. In that case, can we take a look at ifconfig.sh.Linux.in and see if we should fix something in there instead of in net.lo.in?
No. The problem is determining the right parameters to call _add_route with, whichever module provides it. Iproute works because it ignores both -host and -net as the first parameter.
This should be fixed by commit 930f402. You can apply the patch by: # wget 'http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=patch;h=930f4021b1904b9c46c41c70b99d6e0620a1b59d' -O /tmp/net.lo.patch # patch /etc/init.d/net.lo < /tmp/net.lo.patch