summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorErik Fonnesbeck <efonnes@gmail.com>2010-02-14 03:57:54 -0700
committerErik Fonnesbeck <efonnes@gmail.com>2010-02-14 03:57:54 -0700
commitfa13098bf03f83abb3279f3d8885108c8d3b64a7 (patch)
treecee6bdd219b4d294be7836d57f69af4d707625bc /etc/inc
parent6d54e8650338872eb0ebafe720a9ef3181337d5c (diff)
downloadpfsense-fa13098bf03f83abb3279f3d8885108c8d3b64a7.zip
pfsense-fa13098bf03f83abb3279f3d8885108c8d3b64a7.tar.gz
Workaround for a hostapd bug that it uses the base interface's MAC instead of the clone's BSSID, preventing proper authorization on auxillary clones.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/interfaces.inc26
1 files changed, 26 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 77d25a6..00654c0 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1622,7 +1622,23 @@ EOD;
fwrite($fd_set, "{$wpa_supplicant} -B -i {$if} -c {$g['varetc_path']}/wpa_supplicant_{$if}.conf\n");
}
if ($wlcfg['mode'] == "hostap") {
+ $baseif = substr($if, 0, stripos($if, "_wlan"));
+ $baseif_mac = get_interface_mac($baseif);
+ $if_bssid = get_interface_bssid($if);
+ if(!is_macaddr($if_bssid)) {
+ mwexec("/sbin/ifconfig " . escapeshellarg($if) . " up");
+ $if_bssid = get_interface_bssid($if);
+ mwexec("/sbin/ifconfig " . escapeshellarg($if) . " down");
+ }
+ if(!is_macaddr($if_bssid)) {
+ $if_bssid = baseif_mac;
+ }
+ /* XXX: Workaround because hostapd won't properly detect BSSID of
+ * clone interfaces and uses base interface's MAC instead
+ * wpa_supplicant may also need this, but that needs to be tested */
+ fwrite($fd_set, "/sbin/ifconfig {$baseif} ether {$if_bssid}\n");
fwrite($fd_set, "{$hostapd} -B {$g['varetc_path']}/hostapd_{$if}.conf\n");
+ fwrite($fd_set, "/sbin/ifconfig {$baseif} ether {$baseif_mac}\n");
}
}
@@ -2886,6 +2902,16 @@ function get_interface_mac($interface) {
}
}
+function get_interface_bssid($interface) {
+ $mac = array();
+ exec("/sbin/ifconfig {$interface} | /usr/bin/awk '/bssid/ {print $2}'", $mac);
+ if(is_macaddr($mac[0])) {
+ return trim($mac[0]);
+ } else {
+ return "";
+ }
+}
+
/****f* pfsense-utils/generate_random_mac_address
* NAME
* generate_random_mac - generates a random mac address
OpenPOWER on IntegriCloud