summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2009-09-14load hooks only from /usr/lib/network/hooksJim Pryor1-10/+4
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14revert regexp ESSID patchesJim Pryor3-26/+14
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14/sys/class/rfkill/rfkillN/state=2 for disabled on my systemJim Pryor1-1/+1
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14remove duplicated list_networksJim Pryor1-40/+0
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14Returns and exitsJim Pryor4-10/+18
* add some abortive returns * some exit tweaks Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14Sourcing not necessary in get_rf_state, set_rf_stateJim Pryor1-4/+1
Every time these functions are called, the sourcing has already just been done by the caller. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14check for $IFACE_DIR/$INTERFACE before sourcingJim Pryor1-2/+2
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14tabs->spaces, vim modelinesJim Pryor13-174/+178
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-14Tweaks while mergingJim Pryor6-38/+40
* added various quotes * made some vars local * tweaked some [[ ]]s, including one broken one in netcfg-menu * s/ra0/$INTERFACE/ in ethernet-iproute and wireless Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07Rework rfkill into re-usable functionsJames Rayner3-74/+74
2009-09-07Generalise wpa_supplicant scan informationJames Rayner1-7/+51
2009-09-07Added initial rfkill supportJames Rayner3-33/+79
Added some extra debug points Directed debug out to stderr, as debug messages were being used as output from find_essid.
2009-09-07at_interface_{up,down} => IFACE_{UP,DOWN}Jim Pryor2-36/+31
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07Read /etc/network.d/interfaces/ when loading profileJames Rayner2-10/+9
* profile is sourced again after doing so, so profile-level assignments can override * folded validate_profile into load_profile: the extra source command in load_profile was redundant, so all that load_profile effectively did was just call validate_profile
2009-09-07quotes around $(...) where neededJim Pryor5-6/+6
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07Replace pipe to xargs with pipe to while read...Jim Pryor1-1/+3
Was trying to fix an issue with /etc/rc.d/functions. Ended up fixing the issue in initscripts instead. But this is a bit simpler for netcfg anyway. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07typo in a commentJim Pryor1-1/+1
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07move checkyesno to globals, make NETCFG_DEBUG a yes/no setting (default=no)Jim Pryor2-29/+33
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07Comments, more harmless bitsJim Pryor4-11/+20
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07long switches when calling netcfgJim Pryor1-2/+2
Also, the code seems mostly to use /usr/bin/netcfg2 rather than /usr/bin/netcfg. So I've made it do that consistently (I think, in earlier commits). Is this your intent? Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07Lots of little tweaks that should never hurt. Some of them may help inJames Rayner8-48/+56
corner cases; others probably make no difference. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07respect TMPDIRJim Pryor3-9/+9
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07i/o tweaksJim Pryor2-5/+9
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-09-07Use wpa_supplicant for list_networksJames Rayner1-27/+20
2009-09-02Shorten find_ap/essid and allow net-profiles to continue if a profile failsJames Rayner2-3/+2
2009-08-17prevent check_iface from always returning external, output from get_iface_profJames Rayner1-4/+4
2009-08-15quotes!Jim Pryor11-109/+108
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Isolate ip to ethernet-iproute, ifconfig to ethernet + wirelessJim Pryor3-16/+27
* The point of having both ethernet and ethernet-iproute was presumably to transition slowly from ifconfig/net-tools to iproute2. But the current codebase mixes the two in handling ethernet and wireless connections. This commit separates all the ip calls to the newer connections, and the ifconfig calls to the older connections. The latter now call set_interface with up-old, down-old, forcedown-old. * I'm not urging that ifconfig code sticks around. Just trying to make the code consistent with what seems to me to be its implicit design principles. * the check for NO-CARRIER in ethernet is now also done without calling iproute2 tools. I saw this technique recommended somewhere but have no citation. I don't know how many kernel revisions one can rely on any given part of /sys to remain stable for. It may be possible to achieve the same goal here in other ways. If in fact it's worth the effort to keep the ifconfig code around. * Began also to integrate the IPROUTE variable introduced in ethernet, but stopped. If that's integrated everywhere, shouldn't it make connection=ethernet equivalent to connection=ethernet-iproute? Is there justification for using it at some places but not everywhere? I just let it alone for now. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15start consolidation of ifconfig/ip/set_interfaceJim Pryor4-20/+42
* try to factor all the ifconfig/ip set dev code to single location (currently networks/set_interface, though I recommend a different name for this function because it's too close in name and different in functionality from set_iface, set_profile). * added "forcedown" option to set_interface, meaning "just go down don't worry about 'nodown' quirks" * even with "forcedown", this factoring would introduce "ip addr flush dev $INTERFACE" calls to existing code. I assume that's harmless? or even beneficial? * one code block (in ethernet_iproute) had stdout,stderr of the down calls redirected to /dev/null. I've moved that to set_interface, so now everyone's getting that behavior. I assume that's appropriate... * now no more calls to "ip" or "ifconfig" outside of set_interface, except the checks for NO-CARRIER after ethernet*/set_interface up. They might also be moved to network/set_interface? * as of this commit, all the set_interface calls are now using ip instead of ifconfig. A subsequent commit will isolate the ip-use to ethernet-iproute and the ifconfig-use to ethernet. * ALERT: attend to wireless_down, it seems to be calling set_interface down twice (once in ethernet_down, once in itself). And neither this commit nor the code it's patching respects quirk nodown in the ethernet_down block. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Improve suspend/resume, allow for subsets of ifacesJim Pryor1-16/+35
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15improve list_networks, report APs tooJim Pryor1-9/+31
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Add AP argument to profile, also let ESSID arguments be regexpsJim Pryor2-17/+58
* AP= arguments in profiles take precedence over ESSID= arguments * ESSID= arguments regexps instead of literals. To avoid screwing up any currently working profiles, I restricted the interpretation as a regexp to just the new wireless-dbus connection types. * But a global change involved in implementing this is that the connection up/down calls will be passed a literal ESSID (which of the local networks matches the regexp) as an additional argument. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15silence an error in set_ifaceJim Pryor1-1/+1
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15use STATE_DIR in /usr/bin/netcfgJim Pryor1-4/+4
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15make wep_check more robustJim Pryor1-1/+1
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Integrate netcfg-menu and net-profilesJim Pryor2-12/+42
* net-profiles will only attempt to control the profiles it was told to; if you manually netcfg a different interface, it will be left alone. (This also helps keep netcfg from stomping on other daemons that might be hooking into it.) Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15use subshells as sandboxes, and failing POST_UP/PRE_DOWN abortsJim Pryor1-18/+46
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Improve listing/iterating over profilesJim Pryor2-19/+27
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Improve debugging and error-reporting.Jim Pryor3-12/+13
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15grep tweaksJim Pryor5-11/+11
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15More secure temp WPA_CONFIG fileJim Pryor1-15/+13
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Don't overwrite existing $WEP_OPTSJim Pryor1-5/+7
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15ethernet_up will create resolv.conf also for $DNSJim Pryor1-1/+1
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Sanitize quotes for wpa_startJim Pryor1-0/+5
Arguments to wpa_start shouldn't be expanded until wpa_start receives them: so should be quoted by all calling functions. I added quotes throughout. In general, it seems wise to quote except when it's absolutely certain not to be needed---or you specifically _do_ want to expand arguments. In this case, it's extra important. Because this might be missed in later code, I also wrangled wpa_start so that it doesn't rely on WPA_OPTS being all in $3. One of these fixes would have sufficed, but what the hell I did both. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15wpa_cli, start/stop_wpa, wpa_check tweaksJim Pryor4-19/+28
* Supply -i switch to wpa_cli * Have wpa_check call stop_wpa on failure, instead of duplicating (only some of) the termination code. * Need brief sleep in termination code. * Note that functions which call wpa_check don't need to call stop_wpa themselves, when wpa_check fails. * Functions which call wpa_check and start_wpa are however responsible for all error reporting on failure. * Add some debugging calls to announce calls to wpa_start/wpa_check Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Everyone use i/o functions from globals/hooksJim Pryor6-21/+10
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15netcfg current and netcfg listJim Pryor1-2/+26
These and "netcfg version" don't require root privileges. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-15Add contrib dir and logging hooksJim Pryor2-17/+27
* Add contrib/logging.hook * Update Makefile and manpage * Propose that hooks go into /etc, not /usr---latter should be shareable and possibly read-only, not good spot for user-configurable files like these. * Since we have hooks/arch as part of the package, this commit attempts to load hooks from both /usr/lib/network/hooks and /etc/network.d/hooks. (Executable hooks in /etc take precedence over hooks with same name from /usr.) * Need to load /etc/rc.conf before /etc/rc.d/functions (e.g. for USECOLORS) Signed-off-by: Jim Pryor <profjim@jimpryor.net>
2009-08-10Erase any suspended profiles on a newly connected interfaceJames Rayner1-0/+13
2009-08-10allow interfaces to be marked as externally controlledJames Rayner1-14/+28