Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | case "$METHOD" in loopback) exit 0 ;; esac |
| 4 | |
| 5 | IWCONFIG=/sbin/iwconfig |
| 6 | IWPRIV=/sbin/iwpriv |
| 7 | |
| 8 | if [ ! -x $IWCONFIG ]; then |
| 9 | exit 0 |
| 10 | fi |
| 11 | |
| 12 | # Detect and do nothing for linux-wlan-ng interfaces; |
| 13 | # which are configured by thier own if-pre-up script. |
| 14 | if [ -n "$IF_WIRELESS_TYPE" -a "$IF_WIRELESS_TYPE" = "wlan-ng" ]; then |
| 15 | exit 0 |
| 16 | fi |
| 17 | |
| 18 | if [ -n "$IF_NEEDS_RESET" ]; then |
| 19 | $IWPRIV "$IFACE" reset 1 |
| 20 | sleep 1 |
| 21 | fi |
| 22 | |
| 23 | if [ -n "$IF_NEEDS_FIRMWARE" ]; then |
| 24 | $IF_NEEDS_FIRMWARE "$IFACE" |
| 25 | fi |
| 26 | |
| 27 | if [ -n "$IF_WIRELESS_SENS" ]; then |
| 28 | $IWCONFIG "$IFACE" sens $IF_WIRELESS_SENS |
| 29 | fi |
| 30 | |
| 31 | if [ -n "$IF_WIRELESS_RATE" ]; then |
| 32 | $IWCONFIG "$IFACE" rate $IF_WIRELESS_RATE |
| 33 | fi |
| 34 | |
| 35 | if [ -n "$IF_WIRELESS_RTS" ]; then |
| 36 | $IWCONFIG "$IFACE" rts $IF_WIRELESS_RTS |
| 37 | fi |
| 38 | |
| 39 | if [ -n "$IF_WIRELESS_FRAG" ]; then |
| 40 | $IWCONFIG "$IFACE" frag $IF_WIRELESS_FRAG |
| 41 | fi |
| 42 | |
| 43 | if [ -n "$IF_WIRELESS_POWER" ]; then |
| 44 | $IWCONFIG "$IFACE" power $IF_WIRELESS_POWER |
| 45 | fi |
| 46 | |
| 47 | if [ -n "$IF_WIRELESS_POWERPERIOD" ]; then |
| 48 | $IWCONFIG "$IFACE" power period $IF_WIRELESS_POWERPERIOD |
| 49 | fi |
| 50 | |
| 51 | if [ -n "$IF_WIRELESS_POWERTIMEOUT" ]; then |
| 52 | $IWCONFIG "$IFACE" power timeout $IF_WIRELESS_POWERTIMEOUT |
| 53 | fi |
| 54 | |
| 55 | if [ -n "$IF_WIRELESS_TXPOWER" ]; then |
| 56 | $IWCONFIG "$IFACE" txpower $IF_WIRELESS_TXPOWER |
| 57 | fi |
| 58 | |
| 59 | if [ -n "$IF_WIRELESS_RETRY" ]; then |
| 60 | $IWCONFIG "$IFACE" retry $IF_WIRELESS_RETRY |
| 61 | fi |
| 62 | |
| 63 | if [ -n "$IF_WIRELESS_NICK" ]; then |
| 64 | $IWCONFIG "$IFACE" nick "$IF_WIRELESS_NICK" |
| 65 | fi |
| 66 | |
| 67 | if [ -n "$IF_WIRELESS_NWID" ]; then |
| 68 | $IWCONFIG "$IFACE" nwid "$IF_WIRELESS_NWID" |
| 69 | fi |
| 70 | |
| 71 | if [ -n "$IF_WIRELESS_ENC" ]; then |
| 72 | eval $IWCONFIG "$IFACE" enc $IF_WIRELESS_ENC |
| 73 | fi |
| 74 | |
| 75 | if [ -n "$IF_WIRELESS_KEY" ]; then |
| 76 | eval $IWCONFIG "$IFACE" key $IF_WIRELESS_KEY |
| 77 | fi |
| 78 | |
| 79 | if [ -n "$IF_WIRELESS_KEY1" ]; then |
| 80 | $IWCONFIG "$IFACE" key [1] "$IF_WIRELESS_KEY1" |
| 81 | fi |
| 82 | |
| 83 | if [ -n "$IF_WIRELESS_KEY2" ]; then |
| 84 | $IWCONFIG "$IFACE" key [2] "$IF_WIRELESS_KEY2" |
| 85 | fi |
| 86 | |
| 87 | if [ -n "$IF_WIRELESS_KEY3" ]; then |
| 88 | $IWCONFIG "$IFACE" key [3] "$IF_WIRELESS_KEY3" |
| 89 | fi |
| 90 | |
| 91 | if [ -n "$IF_WIRELESS_KEY4" ]; then |
| 92 | $IWCONFIG "$IFACE" key [4] "$IF_WIRELESS_KEY4" |
| 93 | fi |
| 94 | |
| 95 | if [ -n "$IF_WIRELESS_DEFAULTKEY" ]; then |
| 96 | $IWCONFIG "$IFACE" key ["$IF_WIRELESS_DEFAULTKEY"] |
| 97 | fi |
| 98 | |
| 99 | if [ -n "$IF_WIRELESS_KEYMODE" ]; then |
| 100 | $IWCONFIG "$IFACE" key "$IF_WIRELESS_KEYMODE" |
| 101 | fi |
| 102 | |
| 103 | if [ -n "$IF_WIRELESS_MODE" ]; then |
| 104 | $IWCONFIG "$IFACE" mode $IF_WIRELESS_MODE |
| 105 | fi |
| 106 | |
| 107 | if [ -n "$IF_WIRELESS_FREQ" ]; then |
| 108 | $IWCONFIG "$IFACE" freq $IF_WIRELESS_FREQ |
| 109 | fi |
| 110 | |
| 111 | if [ -n "$IF_WIRELESS_CHANNEL" ]; then |
| 112 | $IWCONFIG "$IFACE" channel $IF_WIRELESS_CHANNEL |
| 113 | fi |
| 114 | |
| 115 | if [ -n "$IF_WIRELESS_ESSID" ]; then |
| 116 | $IWCONFIG "$IFACE" essid "$IF_WIRELESS_ESSID" |
| 117 | fi |
| 118 | |
| 119 | if [ -n "$IF_WIRELESS_COMMIT" ]; then |
| 120 | $IWCONFIG "$IFACE" commit |
| 121 | fi |
| 122 | |