mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Filter channels for frequencies >5500 MHz per hostapd hw_features
This commit is contained in:
parent
fee5a69342
commit
2abe94b796
@ -40,12 +40,12 @@ class IwParser
|
|||||||
*/
|
*/
|
||||||
public function parseIwInfo()
|
public function parseIwInfo()
|
||||||
{
|
{
|
||||||
$excluded = array(
|
$excluded = [
|
||||||
"(no IR, radar detection)",
|
"(no IR, radar detection)",
|
||||||
"(radar detection)",
|
"(radar detection)",
|
||||||
"(disabled)",
|
"(disabled)",
|
||||||
"(no IR)"
|
"(no IR)"
|
||||||
);
|
];
|
||||||
$excluded_pattern = implode('|', array_map('preg_quote', $excluded));
|
$excluded_pattern = implode('|', array_map('preg_quote', $excluded));
|
||||||
$pattern = '/\*\s+(\d+)\s+MHz \[(\d+)\] \(([\d.]+) dBm\)\s(?!' .$excluded_pattern. ')/';
|
$pattern = '/\*\s+(\d+)\s+MHz \[(\d+)\] \(([\d.]+) dBm\)\s(?!' .$excluded_pattern. ')/';
|
||||||
$supportedFrequencies = [];
|
$supportedFrequencies = [];
|
||||||
@ -53,13 +53,21 @@ class IwParser
|
|||||||
// Match iw_output containing supported frequencies
|
// Match iw_output containing supported frequencies
|
||||||
preg_match_all($pattern, $this->iw_output, $matches, PREG_SET_ORDER, 0);
|
preg_match_all($pattern, $this->iw_output, $matches, PREG_SET_ORDER, 0);
|
||||||
|
|
||||||
|
/* For frequencies > 5500 MHz only the following "channels" are allowed:
|
||||||
|
* 100 108 116 124 132 140 149 157 184 192
|
||||||
|
* @see https://w1.fi/cgit/hostap/tree/src/common/hw_features_common.c
|
||||||
|
*/
|
||||||
|
$allowed = [100, 108, 116, 124, 132, 140, 149, 157, 184, 192];
|
||||||
|
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$frequency = [
|
if ( (int)$match[1] >= 5500 && in_array((int)$match[2],$allowed) ) {
|
||||||
'MHz' => (int)$match[1],
|
$frequency = [
|
||||||
'Channel' => (int)$match[2],
|
'MHz' => (int)$match[1],
|
||||||
'dBm' => (float)$match[3],
|
'Channel' => (int)$match[2],
|
||||||
];
|
'dBm' => (float)$match[3],
|
||||||
$supportedFrequencies[] = $frequency;
|
];
|
||||||
|
$supportedFrequencies[] = $frequency;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $supportedFrequencies;
|
return $supportedFrequencies;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user