Gentoo Archives: gentoo-dev

From: Wout Mertens <wmertens@×××××.com>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] net.eth0
Date: Wed, 19 Mar 2003 17:15:19
1 Argh, wrong again :(
3 ---------- Forwarded message ----------
4 Date: Wed, 19 Mar 2003 16:47:07 +0100 (CET)
5 From: Wout Mertens <wmertens@g.o>
6 To: gentoo-dev@××××××.com
7 Cc: Joseph Carter <knghtbrd@×××.org>,
8 Frederick Reeve <frederick@××××××××××.org>,
9 Alain Penders <alain@g.o>, Martin Schlemmer <azarah@g.o>
10 Subject: Re: [gentoo-dev] net.eth0
12 (People in Cc: Sorry for the repost, I used the wrong email-address)
14 On Tue, 18 Mar 2003, Martin Schlemmer wrote:
15 > On Mon, 17 Mar 2003 16:35:30 +0100 (CET)
16 > Wout Mertens <wmertens@g.o> wrote:
17 >
18 > > I guess Azarah could add support for a /etc/net.d/ directory with
19 > > scripts that are called with the arguments <interface> <state>. Or
20 > > something along those lines. I know I would like something that
21 > > reconfigures my wwwoffle for the current network automatically.
22 >
23 > I have been thinking about this in the past (think there is a bug
24 > about ipv6 that I suggested that we make it much more modular),
25 > but I have been too busy, and I do not want to rush it and do
26 > an half backed job that have to be redone/bandaged at some stage
27 > in the future again.
29 Well, maybe we can kick off a conversation?
30 Some issues:
31 - Some people have static networks. It would be nice if there was a set
32 way to detect and configure those. They can always hand-roll their own
33 network scripts, but those will not be the same quality that we all can
34 do.
35 - Some services bind on specific interfaces, and need to be notified when
36 one comes up. (apache, squid, ...)
37 - Some services only need to know if there is network connectivity or not,
38 and they need to be notified when the first interface comes up and the
39 last interface goes down (ntp daemons, wwwoffle, ...)
40 - Some services would like to know when the ip address changes (dynamic
41 dns, etc)
42 - There is currently no fixed way to setup your wireless interfaces. They
43 have extra parameters that can be set by iwconfig (wireless-tools),
44 which needs to be done before dhcpcd is called. A simple matter of
45 adding iwconfig_${IFACE}, I think.
46 - At my company, we use LEAP authentication for wireless. This is a
47 proprietary extension, but it's used by thousands of people. I'm not
48 claiming that they are all using gentoo, but it would be cool to have
49 support for this. How I do it, I first let dhcpcd fail, then set up the
50 card for LEAP, run interactive authentication (xterm for the console
51 user), and if it succeeded, run dhcpcd again.
52 - Some people want to use a different dhcp client
53 - Some interfaces have media detection. These could be automatically
54 brought up when a cable is inserted. (See sys-apps/ifplugd)
56 So here is a modular approach:
57 - To bring an interface up, try a list of "activation" scripts that try to
58 bring it up and test the outcome. Examples: a list of ips with an ip
59 that should be active when up, dhcpcd, pump, leap-auth+dhcp, ... . The
60 user chooses the order by setting up a net/activate.d directory, and
61 several standard scripts are included (and they get info from
62 /etc/conf.d/net). Scripts that just set up interfaces, like iwconfig,
63 always fail after doing their stuff.
64 These scripts also provide the command that needs to be run to shut down
65 the interface again. This could be the script itself with different
66 parameters.
67 - Any time networking parameters change, scripts in a net/event.d get
68 called in order. They get the following parameters:
69 - interface that changed
70 - What happened to it: up, down, ipchange, linkup, linkdown
71 - ip address of that interface
72 - the "global" networking state: netup, netdown, netsame. This is for
73 scripts that only care about the networking state and not about
74 interfaces.
75 If possible, the dhcp clients should also call these scripts when the
76 ip address changed.
77 Ifplugd could notify these script that the link went down, but wait a
78 little while before actually bringing the interface down. This could be
79 used to set wwwoffled or chronyd in offline mode without impacting
80 running tcp connections. And when the link goes up again before the
81 interface is brought down, this could be used to kick dhcpcd to verify
82 the lease (dhcpcd -n).
84 A similar, and maybe cleaner approach would not use directories but just
85 strings with functions/scripts to be called, defined in /etc/conf.d/net.
86 (The rest stays the same)
87 Something like
89 activate_eth0="dhcp static"
90 activate_eth1="iwconfig static dhcp leap"
91 activate_ppp0="ppp" # Extra parameters in net.ppp0
92 events_eth0="apache"
93 events_ppp0="dyndns"
94 events_global="wwwoffled chronyd"
96 What do you think? I think this would be able to take all the things I
97 tried to do over the last few years :)
99 We could start prototyping something in a separate ebuild,
100 sys-apps/gentoo-net or something, and when it is stable, merge it back in
101 baselayout.
105 Wout.
107 --
108 gentoo-dev@g.o mailing list