mirror of
https://github.com/KuskoSoft/FeitCSI.git
synced 2026-08-27 14:18:34 +03:00
Only create the AP interface for FTM modes
measure/inject operate on the monitor interface only (WiFiCsiController and PacketInjector use FeitCSImon), and measureCsi()/injectPackets() bring the AP interface down anyway; only ftm() uses it. Creating the AP unconditionally in initInterface() makes setApMode()/bring-up fail on no-IR channels (e.g. 5/6 GHz under the world regdomain 00), and the resulting netlink error propagates as an uncaught exception that aborts the whole run with "command failed: No such device (-19)". Create the AP interface only when an FTM mode is requested, and guard the now-optional AP teardown in the measure/inject paths.
This commit is contained in:
parent
a86a7d3b02
commit
97e5dff9c5
@ -289,9 +289,16 @@ void MainController::initInterface()
|
|||||||
}
|
}
|
||||||
this->wifiController.createMonitorInteface();
|
this->wifiController.createMonitorInteface();
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
|
// The AP interface is only used by FTM. measure/inject operate on the monitor interface,
|
||||||
|
// which createMonitorInteface() has already tuned to the requested frequency. Creating the
|
||||||
|
// AP unconditionally makes its bring-up fail on no-IR channels (e.g. 5/6 GHz under the world
|
||||||
|
// regdomain 00), which throws and aborts the whole run.
|
||||||
|
if (Arguments::arguments.ftm || Arguments::arguments.ftmResponder)
|
||||||
|
{
|
||||||
this->wifiController.createApInteface();
|
this->wifiController.createApInteface();
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(const std::exception& e)
|
catch(const std::exception& e)
|
||||||
{
|
{
|
||||||
if (MainController::mainWindow)
|
if (MainController::mainWindow)
|
||||||
@ -310,8 +317,12 @@ void MainController::initInterface()
|
|||||||
void *MainController::measureCsi(void *arg)
|
void *MainController::measureCsi(void *arg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
// The AP interface only exists for FTM (see initInterface); don't touch it otherwise.
|
||||||
|
if (Arguments::arguments.ftm || Arguments::arguments.ftmResponder)
|
||||||
{
|
{
|
||||||
MainController::getInstance()->wifiController.setInterfaceUpDown(AP_INTERFACE_NAME, false);
|
MainController::getInstance()->wifiController.setInterfaceUpDown(AP_INTERFACE_NAME, false);
|
||||||
|
}
|
||||||
MainController::getInstance()->wifiController.setInterfaceUpDown(MONITOR_INTERFACE_NAME, true);
|
MainController::getInstance()->wifiController.setInterfaceUpDown(MONITOR_INTERFACE_NAME, true);
|
||||||
WiFiCsiController wcs;
|
WiFiCsiController wcs;
|
||||||
wcs.init();
|
wcs.init();
|
||||||
@ -487,8 +498,12 @@ void *MainController::ftmResponder(void *arg)
|
|||||||
void *MainController::injectPackets(void *arg)
|
void *MainController::injectPackets(void *arg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
// The AP interface only exists for FTM (see initInterface); don't touch it otherwise.
|
||||||
|
if (Arguments::arguments.ftm || Arguments::arguments.ftmResponder)
|
||||||
{
|
{
|
||||||
MainController::getInstance()->wifiController.setInterfaceUpDown(AP_INTERFACE_NAME, false);
|
MainController::getInstance()->wifiController.setInterfaceUpDown(AP_INTERFACE_NAME, false);
|
||||||
|
}
|
||||||
MainController::getInstance()->wifiController.setInterfaceUpDown(MONITOR_INTERFACE_NAME, true);
|
MainController::getInstance()->wifiController.setInterfaceUpDown(MONITOR_INTERFACE_NAME, true);
|
||||||
PacketInjector pi;
|
PacketInjector pi;
|
||||||
if (Arguments::arguments.injectRepeat)
|
if (Arguments::arguments.injectRepeat)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user