summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@G5.local>2009-10-25 17:04:33 -0400
committerScott Ullrich <sullrich@G5.local>2009-10-25 17:04:33 -0400
commit88157f66b9b7a34fb7c49a0c60d09ad3296c39b7 (patch)
treedb2068cf9f3df09d2e4f3856df83e8bfdfc0f505
parent103940594317f44d16b92b0241335f3054054823 (diff)
downloadpfsense-88157f66b9b7a34fb7c49a0c60d09ad3296c39b7.zip
pfsense-88157f66b9b7a34fb7c49a0c60d09ad3296c39b7.tar.gz
Take into account hostap type interfaces
-rw-r--r--etc/inc/interfaces.inc35
-rwxr-xr-xusr/local/www/interfaces.php1
2 files changed, 27 insertions, 9 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 2083f51..b719a4f 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1288,6 +1288,30 @@ EOD;
return $vipif;
}
+function interface_wireless_clone($if, &$wlcfg) {
+ global $config;
+ /* Check to see if interface has been cloned as of yet.
+ * If it has not been cloned then go ahead and clone it.
+ */
+ $interface_num = substr($wlcfg['if'], 3);
+ $needs_clone = true;
+ if(does_interface_exist($wlcfg['if'] . "_wlan{$interface_num}")) {
+ $hostap_enabled = `/sbin/ifconfig {$wlcfg['if']} . "_wlan{$interface_num}" | grep hostap`;
+ if($hostap_enabled) {
+ $needs_clone = false;
+ } else {
+ exec("/sbin/ifconfig $if destroy");
+ }
+ }
+ if($needs_clone) {
+ // Setup wireless nic
+ if($wlcfg['wireless']['mode'] == "hostap")
+ $mode = "wlanmode hostap";
+ exec("/sbin/ifconfig wlan{$interface_num} create wlandev {$wlcfg['if']} $mode");
+ exec("/sbin/ifconfig wlan{$interface_num} name {$wlcfg['if']}_wlan{$interface_num}");
+ }
+}
+
function interface_wireless_configure($if, &$wlcfg) {
global $config, $g;
@@ -1302,15 +1326,8 @@ function interface_wireless_configure($if, &$wlcfg) {
unlink_if_exists("{$g['tmp_path']}/{$if}_setup.sh");
- /* Check to see if interface has been cloned as of yet.
- * If it has not been cloned then go ahead and clone it.
- */
- if(!does_interface_exist($if)) {
- $ifr = $wlcfg['if'];
- $interface_num = substr($wlcfg['if'], 4);
- exec("/sbin/ifconfig wlan{$interface_num} create wlandev {$ifr}");
- }
-
+ interface_wireless_clone($if, $wlcfg);
+
$fd_set = fopen("/tmp/{$if}_setup.sh","w");
fwrite($fd_set, "#!/bin/sh\n");
fwrite($fd_set, "# {$g['product_name']} wireless configuration script.\n\n");
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 57ebad8..16cff63 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -190,6 +190,7 @@ $pconfig['mtu'] = $wancfg['mtu'];
/* Wireless interface? */
if (isset($wancfg['wireless'])) {
/* Get wireless modes */
+ interface_wireless_clone($if, $wancfg);
$curif = convert_friendly_interface_to_real_interface_name($if);
$wlanif = get_real_interface($if);
$wl_modes = get_wireless_modes($if);
OpenPOWER on IntegriCloud