summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-06-27 16:46:46 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-06-27 16:46:46 +0000
commit5508cf572921eb77f657e8775787268873180447 (patch)
treec39b063e246b133ca239e96ffb5072f5ad1622cd /etc/inc
parentc0ce312f60142ad9b92a1bb25a5ec26599715cf0 (diff)
downloadpfsense-5508cf572921eb77f657e8775787268873180447.zip
pfsense-5508cf572921eb77f657e8775787268873180447.tar.gz
Update wireless support to work with IBSS and BSS.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/interfaces.inc125
1 files changed, 62 insertions, 63 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 5b65565..180d608 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -316,70 +316,69 @@ function interfaces_carp_bringup() {
}
function interfaces_wireless_configure($if, $wlcfg) {
- global $config, $g;
-
- /* wireless configuration */
- $ifcargs = escapeshellarg($if) .
- " ssid " . escapeshellarg($wlcfg['ssid']) . " channel " .
- escapeshellarg($wlcfg['channel']) . " ";
-
- /* XXX: apparent not everything likes this little blurb */
- //if ($wlcfg['stationname'])
- // $ifcargs .= "stationname " . escapeshellarg($wlcfg['stationname']) . " ";
-
- if (isset($wlcfg['wep']['enable']) && is_array($wlcfg['wep']['key'])) {
- $ifcargs .= "wepmode on ";
-
- $i = 1;
- foreach ($wlcfg['wep']['key'] as $wepkey) {
- $ifcargs .= "wepkey " . escapeshellarg("{$i}:{$wepkey['value']}") . " ";
- if (isset($wepkey['txkey'])) {
- $ifcargs .= "weptxkey {$i} ";
- }
- $i++;
- }
- } else {
- $ifcargs .= "wepmode off ";
- }
+ global $config, $g;
+
+ /* wireless configuration */
+ $ifcargs = escapeshellarg($if) .
+ " ssid " . escapeshellarg($wlcfg['ssid']) . " channel " .
+ escapeshellarg($wlcfg['channel']) . " ";
+
+ if ($wlcfg['stationname'])
+ $ifcargs .= "stationname " . escapeshellarg($wlcfg['stationname']) . " ";
+
+ if (isset($wlcfg['wep']['enable']) && is_array($wlcfg['wep']['key'])) {
+ $ifcargs .= "wepmode on ";
+
+ $i = 1;
+ foreach ($wlcfg['wep']['key'] as $wepkey) {
+ $ifcargs .= "wepkey " . escapeshellarg("{$i}:{$wepkey['value']}") . " ";
+ if (isset($wepkey['txkey'])) {
+ $ifcargs .= "weptxkey {$i} ";
+ }
+ $i++;
+ }
+ } else {
+ $ifcargs .= "wepmode off ";
+ }
+
+ if (strstr($if, "ath")) {
+ if ($wlcfg['standard'])
+ $ifcargs .= "mode {$wlcfg['standard']} ";
+ }
+
+ switch ($wlcfg['mode']) {
+ case 'hostap':
+ if (strstr($if, "ath"))
+ $ifcargs .= "-mediaopt adhoc mediaopt hostap ";
+ else if (strstr($if, "wi"))
+ $ifcargs .= "-mediaopt ibss mediaopt hostap ";
+ break;
+ case 'ibss':
+ case 'IBSS':
+ if (strstr($if, "ath"))
+ $ifcargs .= "-mediaopt hostap mediaopt adhoc ";
+ else if (strstr($if, "wi"))
+ $ifcargs .= "-mediaopt hostap mediaopt ibss ";
+ else if (strstr($if, "an"))
+ $ifcargs .= "mediaopt adhoc ";
+ break;
+ case 'bss':
+ case 'BSS':
+ if (strstr($if, "ath"))
+ $ifcargs .= "-mediaopt hostap -mediaopt adhoc ";
+ else if (strstr($if, "wi"))
+ $ifcargs .= "-mediaopt hostap -mediaopt ibss ";
+ else if (strstr($if, "an"))
+ $ifcargs .= "-mediaopt adhoc ";
+ break;
+ }
+
+ $ifcargs .= "up";
+
+ mwexec("/sbin/ifconfig " . $ifcargs);
+
+ return 0;
- switch ($wlcfg['mode']) {
- case 'hostap':
- $ifcargs .= "mediaopt hostap ";
- break;
- case 'ibss':
- case 'IBSS':
- if (strstr($if, "wi"))
- $ifcargs .= "mediaopt ibss ";
- else if (strstr($if, "an"))
- $ifcargs .= "mediaopt adhoc ";
- else if (strstr($if, "ath"))
- $ifcargs .= "mediaopt hostap ";
- break;
- case 'bss':
- case 'BSS':
- if (strstr($if, "wi"))
- $ifcargs .= "mediaopt ibss ";
- else if (strstr($if, "an"))
- $ifcargs .= "mediaopt adhoc ";
- else if (strstr($if, "ath"))
- $ifcargs .= "mediaopt hostap ";
- break;
- }
-
- if($wlcfg['standard'] <> "")
- $ifcargs .= " mode {$wlcfg['standard']}";
-
- $ifcargs .= " up";
-
- mwexec("/sbin/ifconfig " . $ifcargs);
-
- /* write out the startup command to /tmp/ for
- debugging */
- $fout = fopen("/tmp/debug.wireless","w");
- fwrite($fout, "/sbin/ifconfig " . $ifcargs);
- fclose($fout);
-
- return 0;
}
function interfaces_wan_configure() {
OpenPOWER on IntegriCloud