Lines 27-32
Link Here
|
27 |
inet6_IFACE="$(eval echo \$\{inet6_${IFACE}\})" |
27 |
inet6_IFACE="$(eval echo \$\{inet6_${IFACE}\})" |
28 |
alias_IFACE="$(eval echo \$\{alias_${IFACE}\})" |
28 |
alias_IFACE="$(eval echo \$\{alias_${IFACE}\})" |
29 |
status_IFACE="$(ifconfig | gawk -v IFACE="${IFACE}" '/Link/ { if ($1 == IFACE) print "up" }')" |
29 |
status_IFACE="$(ifconfig | gawk -v IFACE="${IFACE}" '/Link/ { if ($1 == IFACE) print "up" }')" |
|
|
30 |
if [ -x `which iwconfig` ]; then |
31 |
wireless_IFACE="$(iwconfig 2>/dev/null | gawk -v IFACE="${IFACE}" '/IEEE/ { if ($1 == IFACE) print "yes" }')" |
32 |
else |
33 |
wireless_IFACE="not installed" |
34 |
fi |
35 |
} |
36 |
|
37 |
setup_wireless() { |
38 |
# Try to find Access Points |
39 |
iwconfig $IFACE mode Managed |
40 |
iwconfig $IFACE rate auto |
41 |
iwconfig $IFACE key off |
42 |
iwconfig $IFACE rts off |
43 |
iwconfig $IFACE frag off |
44 |
iwconfig $IFACE essid any |
45 |
ifconfig $IFACE up |
46 |
for AP in `iwlist $IFACE scan 2>/dev/null | grep ESSID | awk -F: '{print $2}' | sed 's/[-"]//g'`; do |
47 |
essid_AP="$(eval echo \$\{essid_${AP}\})" |
48 |
if [ ! -z $essid_AP ]; then |
49 |
key_AP="$(eval echo \$\{key_${AP}\})" |
50 |
fi |
51 |
done |
52 |
ifconfig $IFACE down |
53 |
if [ ! -z $essid_AP ]; then |
54 |
iwconfig $IFACE essid $essid_AP |
55 |
return 0 |
56 |
fi |
57 |
if [ ! -z $key_AP ]; then |
58 |
iwconfig $IFACE key $key_AP |
59 |
return 0 |
60 |
fi |
61 |
return 1 |
30 |
} |
62 |
} |
31 |
|
63 |
|
32 |
start() { |
64 |
start() { |
Lines 34-40
Link Here
|
34 |
|
66 |
|
35 |
setup_env |
67 |
setup_env |
36 |
checkconfig || return 1 |
68 |
checkconfig || return 1 |
37 |
|
69 |
if [ ${wireless_IFACE} == "yes" ]; then |
|
|
70 |
ebegin "Detecting network for ${IFACE}" |
71 |
setup_wireless |
72 |
eend 0 |
73 |
fi |
38 |
ebegin "Bringing ${IFACE} up" |
74 |
ebegin "Bringing ${IFACE} up" |
39 |
if [ "${iface_IFACE}" != "dhcp" ] |
75 |
if [ "${iface_IFACE}" != "dhcp" ] |
40 |
then |
76 |
then |