Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 322853 - network location aware startup scripts
Summary: network location aware startup scripts
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: OpenRC Team
URL:
Whiteboard: openrc:oldnet
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-05 13:54 UTC by Łukasz Stelmach
Modified: 2013-04-25 23:08 UTC (History)
2 users (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 Łukasz Stelmach 2010-06-05 13:54:57 UTC
These are a few ideas what may make network startup scripts more usable on workstations and portables.

The scripts detect what network a machine is connected to and launches appropriate services (eg. different firewall settings, but they may be network urelated too). Basically there should be at least two networks (classes?)

* home - trusted
* public - terra incognita

One of smart ways to detect the location I came across recently is gateway's MAC address. If the address is on a list then it is a home network the machine is connected to if not it is a public one. It may be even more convenient to have many "known" locations e.g. home, corpo, campus, etc.

Current "location" should be available somewhere in /var/{lib,run,lib/init.d}. 

To keep things simple the default route's gateway MAC should be considered. 

I think different runlevels might be used for location aware service launching. There must be, however, something that keeps track of network connections and kicks init(8) appropriately.

Another, maybe simpler, matter is an Internet connection detection. Some services like ntp-client (with default settings) require not only a network connection but one that routes to the Internet.

Reproducible: Always

Steps to Reproduce:
Comment 1 Michael Weber (RETIRED) gentoo-dev 2010-06-07 04:16:18 UTC
Hello Lukasz,

this is a very good suggestion. I would take the (B)SSID into account, "eduroam" is provided by literally thousands of APs around the world (e.g. 1388 in metro area of Munich). 

Have you tried using the pahse functions (i use preup() {if [ ${IFACE} == "lo" ];} and postdown() in /etc/conf.d/net?

Afaik, Gentoo lacks the possibility to use id_str from /etc/wpa_supplicant/wpa_supplicant.conf. Debian runs ifup/ifdown with these values and you can hook actions according to the IFACE var. 

You can use a wpa_cli session to trace the event on the network.

the IP address can be taken into account too. Our local university network LRZ-MUNICH uses /21 parts of a 10/8 network on unencrypted AP and wall jacks to provide network via Cisco VPN and other parts to be masqueraded transparently.

Hm, a set of schemes, plus a set of triggers (mii-tool on eth + wpa_cli on wlan plus hibernation/suspend detection) to get changes would be cool.

I stay tuned for patches/actions!

   Michael
Comment 2 Łukasz Stelmach 2010-06-07 11:47:07 UTC
(In reply to comment #1)

> this is a very good suggestion. I would take the (B)SSID into account,
> "eduroam" is provided by literally thousands of APs around the world (e.g.
> 1388 in metro area of Munich). 

This may be an option but since it's not available on wired ethernet it must not be the only one. One should be able to choose or even mix these two methods as BSSID is quite easy to fake. Having to fake both BSSID and GW's MAC isn't that simple.

> Have you tried using the pahse functions (i use preup() {if [ ${IFACE} == "lo"
> ];} and postdown() in /etc/conf.d/net?

I'd rather used postup() but this is rather a detail. I 

> the IP address can be taken into account too. 

That's good to. So let's look at:

* host IP (certain network, rather than only a particular address, in the end
  there is always /32)
* network IP (IP addr "-" netmask, matching as above)
* GW MAC addr (might not be so convenient in large and "heavily managed"
  networks, but works fine at home)
* (B)SSID
* AP mac (geolocation ersatz)
* combination of the above
* anything else?

> Hm, a set of schemes, plus a set of triggers (mii-tool on eth + wpa_cli on 

I think hooking into postup() is best, because that's the moment you begin actually working on a particular network and all those triggers that launch net.IF start already exist.