Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 137727 - The depend function for network init scripts doesn't work if you set different init profiles
Summary: The depend function for network init scripts doesn't work if you set differen...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Roy Marples (RETIRED)
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2006-06-23 06:40 UTC by Stefano Varesi
Modified: 2006-08-01 02:18 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 Stefano Varesi 2006-06-23 06:40:33 UTC
The depend function for network init scripts doesn't work if you set different init profiles.
Sometimes I connect to the internet through a lan with a dhcp server, other times I make an adsl connection through a wifi modem/router.
I have two runlevels: default and adsl. In the default runlevel the network is set on dhcp, in the adsl is set to make a point-to-point adsl connection, so I have two different configuration files (ath0 is a wifi 802.11 card using madwifi drivers):

/etc/conf.d/net (for the default runlevel):
>
> config_eth0="dhcp"
> config_ath0="null"
>

/etc/conf.d/net.adsl (for the adsl runlevel):
>
> config_eth0="null"
> config_ath0="dhcp"
> config_ppp0="ppp"
> link_ppp0="ath0"
> plugins_ppp0="pppoe"
> pppd_ppp0=( "updetach" "defaultroute" "usepeerdns" )
>

The ppp adsl connection works over the wifi connection. To make it work I have to automatically start also the net.ath0 script as a dependency for the net.ppp0 script, because it does the WEP autentication (I didn't report my passwords and wep key for simplicity), so I have to put the following lines in /etc/conf.d/net.adsl:

>
> depend_ppp0() {
>         need net.ath0
> }
>

as written in net.example. It doesn't work. After investigating (putting some echoes in the depend() function in the net.lo init script) I found that I have to put the same 3 lines in /etc/conf.d/net and not in /etc/conf.d/net.adsl.
So the depend_${iface}() function only works if you put it in /etc/conf.d/net and in this way it will be called for every runlevel (which is a wrong behavior).
And if I want two different configurations for net.ppp0, one with a dependency and the other without dependency, or maybe with different dependencies, it will not work.
I think the problem is in the /etc/init.d/net.lo script.
Comment 1 Roy Marples (RETIRED) gentoo-dev 2006-06-26 01:17:53 UTC
I'm not going to fix this as we cannot have dependencies different between runlevels.

Would you be happy if I added a note to say this in net.example?

NOTE: Due to the way we handle our init.d script dependencies you cannot put a depend_ppp0() in /etc/conf.d/net.$runlevel - it has to be in /etc/conf.d/net
Comment 2 Stefano Varesi 2006-06-26 03:18:37 UTC
I didn't know that it was impossible to have different dependecies between runlevels.
I thought it was logical that different configurations can have also different dependencies.
Maybe it's better if you add that note in net.example, so that other users that make use of a depend function wouldn't be confused about that. Thanks.

My problem has been resolved with a preup function that registers to the essid and makes the wep autentication and a postdown function that brings ath0 down.
Comment 3 Roy Marples (RETIRED) gentoo-dev 2006-06-27 03:47:45 UTC
Documented in our svn repo - will be in baselayout-1.12.2
Comment 4 Roy Marples (RETIRED) gentoo-dev 2006-08-01 02:18:00 UTC
Fixed