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
Message-Id: Pine.GSO.4.53.0303191815490.15485@oaktree.cisco.com
Argh, wrong again :(

---------- Forwarded message ----------
Date: Wed, 19 Mar 2003 16:47:07 +0100 (CET)
From: Wout Mertens <wmertens@g.o>
To: gentoo-dev@××××××.com
Cc: Joseph Carter <knghtbrd@×××.org>,
     Frederick Reeve <frederick@××××××××××.org>,
     Alain Penders <alain@g.o>, Martin Schlemmer <azarah@g.o>
Subject: Re: [gentoo-dev] net.eth0

(People in Cc: Sorry for the repost, I used the wrong email-address)

On Tue, 18 Mar 2003, Martin Schlemmer wrote:
> On Mon, 17 Mar 2003 16:35:30 +0100 (CET) > Wout Mertens <wmertens@g.o> wrote: > > > I guess Azarah could add support for a /etc/net.d/ directory with > > scripts that are called with the arguments <interface> <state>. Or > > something along those lines. I know I would like something that > > reconfigures my wwwoffle for the current network automatically. > > I have been thinking about this in the past (think there is a bug > about ipv6 that I suggested that we make it much more modular), > but I have been too busy, and I do not want to rush it and do > an half backed job that have to be redone/bandaged at some stage > in the future again.
Well, maybe we can kick off a conversation? Some issues: - Some people have static networks. It would be nice if there was a set way to detect and configure those. They can always hand-roll their own network scripts, but those will not be the same quality that we all can do. - Some services bind on specific interfaces, and need to be notified when one comes up. (apache, squid, ...) - Some services only need to know if there is network connectivity or not, and they need to be notified when the first interface comes up and the last interface goes down (ntp daemons, wwwoffle, ...) - Some services would like to know when the ip address changes (dynamic dns, etc) - There is currently no fixed way to setup your wireless interfaces. They have extra parameters that can be set by iwconfig (wireless-tools), which needs to be done before dhcpcd is called. A simple matter of adding iwconfig_${IFACE}, I think. - At my company, we use LEAP authentication for wireless. This is a proprietary extension, but it's used by thousands of people. I'm not claiming that they are all using gentoo, but it would be cool to have support for this. How I do it, I first let dhcpcd fail, then set up the card for LEAP, run interactive authentication (xterm for the console user), and if it succeeded, run dhcpcd again. - Some people want to use a different dhcp client - Some interfaces have media detection. These could be automatically brought up when a cable is inserted. (See sys-apps/ifplugd) So here is a modular approach: - To bring an interface up, try a list of "activation" scripts that try to bring it up and test the outcome. Examples: a list of ips with an ip that should be active when up, dhcpcd, pump, leap-auth+dhcp, ... . The user chooses the order by setting up a net/activate.d directory, and several standard scripts are included (and they get info from /etc/conf.d/net). Scripts that just set up interfaces, like iwconfig, always fail after doing their stuff. These scripts also provide the command that needs to be run to shut down the interface again. This could be the script itself with different parameters. - Any time networking parameters change, scripts in a net/event.d get called in order. They get the following parameters: - interface that changed - What happened to it: up, down, ipchange, linkup, linkdown - ip address of that interface - the "global" networking state: netup, netdown, netsame. This is for scripts that only care about the networking state and not about interfaces. If possible, the dhcp clients should also call these scripts when the ip address changed. Ifplugd could notify these script that the link went down, but wait a little while before actually bringing the interface down. This could be used to set wwwoffled or chronyd in offline mode without impacting running tcp connections. And when the link goes up again before the interface is brought down, this could be used to kick dhcpcd to verify the lease (dhcpcd -n). A similar, and maybe cleaner approach would not use directories but just strings with functions/scripts to be called, defined in /etc/conf.d/net. (The rest stays the same) Something like activate_eth0="dhcp static" activate_eth1="iwconfig static dhcp leap" activate_ppp0="ppp" # Extra parameters in net.ppp0 events_eth0="apache" events_ppp0="dyndns" events_global="wwwoffled chronyd" What do you think? I think this would be able to take all the things I tried to do over the last few years :) We could start prototyping something in a separate ebuild, sys-apps/gentoo-net or something, and when it is stable, merge it back in baselayout. Comments? Wout. -- gentoo-dev@g.o mailing list