blob: 0fff66820f457d743e27f4660ea2881dc016d0c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# Ethernet connection support for netctl
. "$SUBR_DIR/ip"
ethernet_up() {
if ! is_interface "$Interface"; then
report_error "Interface '$Interface' does not exist"
return 1
fi
# Disable IPv6 before bringing the interface up to prevent SLAAC
if [[ $IP6 == "no" ]]; then
sysctl -q -w "net.ipv6.conf.${Interface/.//}.disable_ipv6=1"
fi
if ! bring_interface_up "$Interface"; then
report_error "Failed to bring interface '$Interface' up"
return 1
fi
if ! is_yes "${SkipNoCarrier:-no}"; then
# Some cards are plain slow to come up. Don't fail immediately.
if ! timeout_wait "${TimeoutCarrier:-5}" '(( $(< "/sys/class/net/$Interface/carrier") ))'; then
report_error "No connection on interface '$Interface'"
bring_interface_down "$Interface"
return 1
fi
fi
if is_yes "${Auth8021X:-no}"; then
. "$SUBR_DIR/8021x"
: ${WPAConfigFile:=/etc/wpa_supplicant.conf}
: ${WPADriver:=wired}
: ${TimeoutWPA:=15}
if ! wpa_start "$Interface" "$WPADriver" "$WPAConfigFile"; then
report_error "The WPA supplicant did not start for interface '$Interface'"
bring_interface_down "$Interface"
return 1
fi
if ! wpa_wait_until_state "$TimeoutWPA" "$Interface" "ASSOCIATED"; then
wpa_stop "$Interface"
bring_interface_down "$Interface"
report_error "WPA Authentication/Association Failed"
return 1
fi
fi
if ! ip_set; then
stop_80211x
bring_interface_down "$Interface"
return 1
fi
}
ethernet_down() {
ip_unset
stop_80211x
bring_interface_down "$Interface"
}
# Stop wpa_supplicant if neccessary
stop_80211x() {
if is_yes "${Auth8021X:-no}"; then
. "$SUBR_DIR/8021x"
: ${WPAConfigFile:=/etc/wpa_supplicant.conf}
do_debug wpa_stop "$Interface"
fi
}
# vim: set ts=4 et sw=4:
|