summaryrefslogtreecommitdiffstats
path: root/ifplugd
diff options
context:
space:
mode:
authorJames Rayner <james@rayner.id.au>2010-11-21 03:08:34 +0100
committerJames Rayner <james@rayner.id.au>2010-11-21 03:08:34 +0100
commit0fc35b1462b3257653ebca6d2df65a6062a2194a (patch)
tree35a8cdecf59c7f2d074b5bc1e49735df7a0a0ff1 /ifplugd
parentde9a2b3ba9e58075fe79d48c11abed93a8e69c31 (diff)
downloadnetctl-0fc35b1462b3257653ebca6d2df65a6062a2194a.tar.gz
netctl-0fc35b1462b3257653ebca6d2df65a6062a2194a.tar.xz
FS#17190 - fix auto-wired, improve handling of static connections
Diffstat (limited to 'ifplugd')
-rw-r--r--[-rwxr-xr-x]ifplugd/netcfg.action35
1 files changed, 21 insertions, 14 deletions
diff --git a/ifplugd/netcfg.action b/ifplugd/netcfg.action
index cffcdf5..0c081df 100755..100644
--- a/ifplugd/netcfg.action
+++ b/ifplugd/netcfg.action
@@ -14,25 +14,32 @@ case "$2" in
# it's difficult to tell if static succeeded
# Also check profile is same iface and is right connection
echo "up"
+ declare -a preferred_profiles
+ declare -a dhcp_profiles
declare -a static_profiles
for profile in $(list_profiles); do (
load_profile "$profile"
- echo "loadin $profile"
+ echo "loading $profile"
[[ "$INTERFACE" != "$1" ]] && continue
[[ "$CONNECTION" != @(ethernet|ethernet-iproute) ]] && continue
- if [[ "$IP" == "dhcp" ]]; then
- netcfg "$profile" && exit 1
- else
- static_profiles+=("$profile")
- fi
- exit 0
- ) || exit 0; done
- for profile in "${static_profiles[@]}"; do (
- load_profile "$profile"
- netcfg "$profile" && exit 1
- exit 0
- ) || exit 0; done
- exit 1
+ checkyesno "${AUTO_WIRED:-no}" && exit 1 # user preferred AUTO profile
+ [[ "$IP" == "dhcp" ]] && exit 2 # dhcp profile
+ exit 3 # static profile
+ )
+ case $? in
+ 1) preferred_profiles+=("$profile");;
+ 2) dhcp_profiles+=("$profile");;
+ 3) static_profiles+=("$profile");;
+ esac
+ done
+ if [[ ${#preferred_profiles[@]} > 1 ]]; then
+ echo "AUTO_WIRED flag for $1 set in more than one profile (${preferred_profiles[*]})"
+ else
+ for profile in "${preferred_profiles[@]}" "${dhcp_profiles[@]}" "${static_profiles[@]}"; do (
+ netcfg "$profile" && exit 1
+ exit 0
+ ) || exit 0; done
+ fi
;;
down)
if check_iface "$1"; then