Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 218674 - sys-apps/openrc: arping.sh can trigger an infinite loop
Summary: sys-apps/openrc: arping.sh can trigger an infinite loop
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-21 03:16 UTC by kouyu
Modified: 2008-10-07 15:46 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kouyu 2008-04-21 03:16:59 UTC
I have upgraded baselayout1 to baselayout2 with openrc.

If I write my net config like this:
----------------------------------------------------------------------
config_eth0="192.168.0.123/24 arping" 
dns_servers_192168000001_001234567890="202.202.202.202" 
gateways_eth0="192.168.0.1,00:12:34:56:78:90" 
routes_eth0="default via 192.168.0.1" 
dns_servers_eth0="192.168.0.1" 
----------------------------------------------------------------------
Then I got a infinite loop.

You can find the bug in function arping_start which is in arping.sh.

The code with problem is below:
----------------------------------------------------------------------
_configure_variables ${conf} 
... 
# Ensure that we have a valid config - ie arping is no longer there 
local IFS="$__IFS" 
for i in $(_get_array "config_${IFVAR}"); do 
   if [ "${i}" = "arping" ]; then 
      eend 1 "No config found for ${ip} (config_${conf}=\"...\")" 
      continue 2 
   fi 
done 
unset IFS 

_load_config 
----------------------------------------------------------------------
You can see arping_start can not parse multi-config separated by whitespace which is in one config_IFACE variable. It considers newline and only newline as separator. So then it will call _load_config to load old config which still has "arping" in it endlessly.

If I write config_eth0 like this:
config_eth0="192.168.0.123/24
arping"
Then it works.

You might say this is not a bug. I don't think so. No docs, neither online nor local example say explicitly that the users had better use newline as separator, oppositely there are so many examples which use whitespace to separate multi-config in config_IFACE variable. 

And, the important point is not only the examples, but also the net init scripts (/lib/rc/sh/net.sh) does support two kind of separator, newline and whitespace (you can see function _load_config in net.sh). I.e. the user are allowed to use one-line config like I have done. But the support is not completely. _load_config supports, but arping_start doesn't. So the bug appeared.


I have posted a new topic in forums.gentoo.org, but nobody reply. You can go there to get more details.
http://forums.gentoo.org/viewtopic-t-688909.html
(And the 2nd post in this topic also describes a bug, another bug, Bug 218673 )
Comment 1 kouyu 2008-04-21 03:19:54 UTC
openrc I'm using is openrc-0.2.2
Comment 2 SpanKY gentoo-dev 2008-04-21 03:40:07 UTC
instead of posting specific versions, you should be posting `emerge --info`
Comment 3 Roy Marples 2008-04-21 14:38:40 UTC
Actually, you'll find all local examples of config_$IFACE using multiline.

However, this does raise an interesting issue about configs :)

config_eth0="1.2.3.4 netmask 255.255.0.0
4.5.6.7 netmask 255.0.0.0"
config_eth0="1.2.3.4/16 4.5.6.7/8"

Obviously the two are the same, aside from syntax. One is mulitline as the config syntax for a single entry *requires* spaces (thank you ifconfig and bash arrays).
In my efforts to ensure we work on non bash shells, maybe I've been to religious in trying to keep existing syntax working.
Maybe we should move to this

address_eth0="1.2.3.4/18 4.5.6.7/8"
ifconfig_eth0="custom ifconfig commands here"
ip_eth0="custom ip commands here"

intead of doing everything through the config_eth0 variable.
Comment 4 Roy Marples 2008-04-21 14:39:42 UTC
Or in another way, keep config_foo as it is, but encourage new address setup as single words only.
Comment 5 kouyu 2008-04-27 16:14:37 UTC
Old config setup? or new config setup?
I don't care. I just hope the config has only one style, one explicit style.


And so, how do you plan for this bug?
Don't you intend to add one-line-config support to function arping_start?
Or you will force user to use multi-line-config. (forget one-line-config?)

Comment 6 Doug Goldstein (RETIRED) gentoo-dev 2008-10-07 15:46:29 UTC
You will need to update your configuration just like any program out there that comes out with a new version. The migration guide covers certain cases when you need to update your configs and the changes required are documented.