Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo development <gentoo-dev@l.g.o>
Subject: [gentoo-dev] rfc: "need net" mis-use in init scripts
Date: Thu, 18 Oct 2012 18:40:44
Message-Id: 20121018184001.GA11705@linux1
1 All,
2
3 If an init script has "need net" in its dependencies, this is
4 automatically problematic, because the script will be stopped when *any*
5 provider of net is stopped.
6
7 This is not good for services like sshd or ntpd for example, because, in
8 their default configuration they are able to start regardless of which
9 network interface(s) are active or not and adapt as interfaces go up and
10 down.
11
12 I think we should re-evaluate, and remove "need net" from init
13 scripts where possible.
14
15 The thing we would be looking for is services like sshd or ntpd which
16 can start successfully in their default configuration and
17 adapt as network interfaces go up and down and addresses and routes change.
18
19 In those situations, which are probably pretty common, we can just drop
20 "need net" from the init script.
21
22 If a service genuinely _NEEDS_ a specific network address, because it
23 binds to it _AND_ fails to start with out it, "need net" still isn't
24 accurate, because of the issue I pointed out above, so it should be
25 removed and this should be documented in the services conf.d file and left
26 to the user to set up.
27
28 If a user is using oldnet, they can do this by adding something like this
29 to your service's conf.d file:
30 rc_need="net.ifname"
31
32 If they are using newnet and configuring the interface in
33 /etc/conf.d/network as a static interface, they should add the following
34 to your conf.d file:
35 rc_need="network"
36
37 Does anyone have any thoughts?
38
39 William

Replies

Subject Author
Re: [gentoo-dev] rfc: "need net" mis-use in init scripts Dirkjan Ochtman <djc@g.o>