1 The WiFi settings are configured in the file
\texttt{/etc/config/wireless
}
2 (currently supported on Broadcom, Atheros and mac80211). When booting the router for the first time
3 it should detect your card and create a sample configuration file. By default '
\texttt{option network lan
}' is
4 commented. This prevents unsecured sharing of the network over the wireless interface.
6 Each wireless driver has its own configuration script in
\texttt{/lib/wifi/driver
\_name.sh
} which handles
7 driver specific options and configurations. This script is also calling driver specific binaries like wlc for
8 Broadcom, or hostapd and wpa
\_supplicant for atheros.
10 The reason for using such architecture, is that it abstracts the driver configuration.
12 \paragraph{Generic Broadcom wireless config:
}
15 config wifi-device "wl0"
16 option type "broadcom"
25 option encryption "none"
28 \paragraph{Generic Atheros wireless config:
}
31 config wifi-device "wifi0"
42 option encryption "none"
45 \paragraph{Generic mac80211 wireless config:
}
48 config wifi-device "wifi0"
49 option type "mac80211"
58 option encryption "none"
61 \paragraph{Generic multi-radio Atheros wireless config:
}
64 config wifi-device wifi0
72 option ssid OpenWrt_private
74 option encryption none
76 config wifi-device wifi1
84 option ssid OpenWrt_public
86 option encryption none
89 There are two types of config sections in this file. The '
\texttt{wifi-device
}' refers to
90 the physical wifi interface and '
\texttt{wifi-iface
}' configures a virtual interface on top
91 of that (if supported by the driver).
93 A full outline of the wireless configuration file with description of each field:
96 config wifi-device wifi device name
97 option type broadcom, atheros, mac80211
98 option country us, uk, fr, de, etc.
100 option maxassoc
1-
128 (broadcom only)
102 option agmode
11b,
11g,
11a,
11bg (atheros only)
105 option network the interface you want wifi to bridge with
106 option device wifi0, wifi1, wifi2, wifiN
107 option mode ap, sta, adhoc, monitor, or wds
108 option ssid ssid name
109 option bssid bssid address
110 option encryption none, wep, psk, psk2, wpa, wpa2
111 option key encryption key
116 option server ip address
122 \paragraph{Options for the
\texttt{wifi-device
}:
}
125 \item \texttt{type
} \\
126 The driver to use for this interface.
128 \item \texttt{country
} \\
129 The country code used to determine the regulatory settings.
131 \item \texttt{channel
} \\
132 The wifi channel (e.g.
1-
14, depending on your country setting).
134 \item \texttt{maxassoc
} \\
135 Optional: Maximum number of associated clients. This feature is supported only on the broadcom chipset.
137 \item \texttt{distance
} \\
138 Optional: Distance between the ap and the furthest client in meters. This feature is supported only on the atheros chipset.
140 \item \texttt{mode
} \\
141 The frequency band (
\texttt{b
},
\texttt{g
},
\texttt{bg
},
\texttt{a
}). This feature is only supported on the atheros chipset.
146 \paragraph{Options for the
\texttt{wifi-iface
}:
}
149 \item \texttt{network
} \\
150 Selects the interface section from
\texttt{/etc/config/network
} to be
151 used with this interface
153 \item \texttt{device
} \\
154 Set the wifi device name.
156 \item \texttt{mode
} \\
163 \item \texttt{sta
} \\
166 \item \texttt{adhoc
} \\
169 \item \texttt{monitor
} \\
172 \item \texttt{wds
} \\
173 WDS point-to-point link
178 Set the SSID to be used on the wifi device.
181 Set the BSSID address to be used for wds to set the mac address of the other wds unit.
183 \item \texttt{encryption
} \\
184 Encryption setting. Accepts the following values:
189 \item \texttt{psk
},
\texttt{psk2
} \\
190 WPA(
2) Pre-shared Key
192 \item \texttt{wpa
},
\texttt{wpa2
} \\
196 \item \texttt{key, key1, key2, key3, key4
} (wep, wpa and psk) \\
197 WEP key, WPA key (PSK mode) or the RADIUS shared secret (WPA RADIUS mode)
199 \item \texttt{server
} (wpa) \\
200 The RADIUS server ip address
202 \item \texttt{port
} (wpa) \\
203 The RADIUS server port (defaults to
1812)
205 \item \texttt{hidden
} \\
206 0 broadcasts the ssid;
1 disables broadcasting of the ssid
208 \item \texttt{isolate
} \\
209 Optional: Isolation is a mode usually set on hotspots that limits the clients to communicate only with the AP and not with other wireless clients.
210 0 disables ap isolation (default);
1 enables ap isolation.
215 \paragraph{Limitations:
}
217 There are certain limitations when combining modes.
218 Only the following mode combinations are supported:
221 \item \textbf{Broadcom
}: \\
223 \item 1x
\texttt{sta
},
0-
3x
\texttt{ap
}
224 \item 1-
4x
\texttt{ap
}
225 \item 1x
\texttt{adhoc
}
226 \item 1x
\texttt{monitor
}
229 WDS links can only be used in pure AP mode and cannot use WEP (except when sharing the
230 settings with the master interface, which is done automatically).
232 \item \textbf{Atheros
}: \\
234 \item 1x
\texttt{sta
},
0-Nx
\texttt{ap
}
235 \item 1-Nx
\texttt{ap
}
236 \item 1x
\texttt{adhoc
}
239 N is the maximum number of VAPs that the module allows, it defaults to
4, but can be
240 changed by loading the module with the maxvaps=N parameter.
243 \paragraph{Adding a new driver configuration
}
245 Since we currently only support two different wireless drivers : Broadcom and Atheros,
246 you might be interested in adding support for another driver like Ralink RT2x00,
247 Texas Instruments ACX100/
111.
249 The driver specific script should be placed in
\texttt{/lib/wifi/<driver>.sh
} and has to
250 include several functions providing :
253 \item detection of the driver presence
254 \item enabling/disabling the wifi interface(s)
255 \item configuration reading and setting
256 \item third-party programs calling (nas, supplicant)
259 Each driver script should append the driver to a global DRIVERS variable :
262 append DRIVERS "driver name"
265 \subparagraph{\texttt{scan
\_<driver>
}}
267 This function will parse the
\texttt{/etc/config/wireless
} and make sure there
268 are no configuration incompatibilities, like enabling hidden SSIDS with ad-hoc mode
269 for instance. This can be more complex if your driver supports a lof of configuration
270 options. It does not change the state of the interface.
277 config_get vifs "$device" vifs
279 # check config consistency for wifi-iface sections
281 # check mode combination
285 \subparagraph{\texttt{enable
\_<driver>
}}
287 This function will bring up the wifi device and optionally create application specific
288 configuration files, e.g. for the WPA authenticator or supplicant.
295 config_get vifs "$device" vifs
297 # bring up virtual interface belonging to
298 # the wifi-device "$device"
303 \subparagraph{\texttt{disable
\_<driver>
}}
305 This function will bring down the wifi device and all its virtual interfaces (if supported).
312 # bring down virtual interfaces belonging to
313 # "$device" regardless of whether they are
314 # configured or not. Don't rely on the vifs
315 # variable at this point
319 \subparagraph{\texttt{detect
\_<driver>
}}
321 This function looks for interfaces that are usable with the driver. Template config sections
322 for new devices should be written to stdout. Must check for already existing config sections
323 belonging to the interfaces before creating new templates.
328 [ wifi-device = "$(config_get dummydev type)"
] && return
0
330 config wifi-device dummydev
332 # REMOVE THIS LINE TO ENABLE WIFI:
336 option device dummydev