Revision fa13098b
Added by Erik Fonnesbeck over 15 years ago
etc/inc/interfaces.inc | ||
---|---|---|
1622 | 1622 |
fwrite($fd_set, "{$wpa_supplicant} -B -i {$if} -c {$g['varetc_path']}/wpa_supplicant_{$if}.conf\n"); |
1623 | 1623 |
} |
1624 | 1624 |
if ($wlcfg['mode'] == "hostap") { |
1625 |
$baseif = substr($if, 0, stripos($if, "_wlan")); |
|
1626 |
$baseif_mac = get_interface_mac($baseif); |
|
1627 |
$if_bssid = get_interface_bssid($if); |
|
1628 |
if(!is_macaddr($if_bssid)) { |
|
1629 |
mwexec("/sbin/ifconfig " . escapeshellarg($if) . " up"); |
|
1630 |
$if_bssid = get_interface_bssid($if); |
|
1631 |
mwexec("/sbin/ifconfig " . escapeshellarg($if) . " down"); |
|
1632 |
} |
|
1633 |
if(!is_macaddr($if_bssid)) { |
|
1634 |
$if_bssid = baseif_mac; |
|
1635 |
} |
|
1636 |
/* XXX: Workaround because hostapd won't properly detect BSSID of |
|
1637 |
* clone interfaces and uses base interface's MAC instead |
|
1638 |
* wpa_supplicant may also need this, but that needs to be tested */ |
|
1639 |
fwrite($fd_set, "/sbin/ifconfig {$baseif} ether {$if_bssid}\n"); |
|
1625 | 1640 |
fwrite($fd_set, "{$hostapd} -B {$g['varetc_path']}/hostapd_{$if}.conf\n"); |
1641 |
fwrite($fd_set, "/sbin/ifconfig {$baseif} ether {$baseif_mac}\n"); |
|
1626 | 1642 |
} |
1627 | 1643 |
} |
1628 | 1644 |
|
... | ... | |
2886 | 2902 |
} |
2887 | 2903 |
} |
2888 | 2904 |
|
2905 |
function get_interface_bssid($interface) { |
|
2906 |
$mac = array(); |
|
2907 |
exec("/sbin/ifconfig {$interface} | /usr/bin/awk '/bssid/ {print $2}'", $mac); |
|
2908 |
if(is_macaddr($mac[0])) { |
|
2909 |
return trim($mac[0]); |
|
2910 |
} else { |
|
2911 |
return ""; |
|
2912 |
} |
|
2913 |
} |
|
2914 |
|
|
2889 | 2915 |
/****f* pfsense-utils/generate_random_mac_address |
2890 | 2916 |
* NAME |
2891 | 2917 |
* generate_random_mac - generates a random mac address |
Also available in: Unified diff
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.