From 9ebd958218f25cf0a0d7fda7d5a58a225bf92b1d Mon Sep 17 00:00:00 2001 From: evilsocket Date: Thu, 27 Mar 2025 13:34:35 +0100 Subject: [PATCH] fix: do not reset wifi channels if set before wifi module start --- modules/wifi/wifi.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/wifi/wifi.go b/modules/wifi/wifi.go index d36b0261..0cd0338f 100644 --- a/modules/wifi/wifi.go +++ b/modules/wifi/wifi.go @@ -651,13 +651,15 @@ func (mod *WiFiModule) Configure() error { mod.hopPeriod = time.Duration(hopPeriod) * time.Millisecond if mod.source == "" { - if freqs, err := network.GetSupportedFrequencies(ifName); err != nil { - return fmt.Errorf("error while getting supported frequencies of %s: %s", ifName, err) - } else { - mod.setFrequencies(freqs) - } + if len(mod.frequencies) == 0 { + if freqs, err := network.GetSupportedFrequencies(ifName); err != nil { + return fmt.Errorf("error while getting supported frequencies of %s: %s", ifName, err) + } else { + mod.setFrequencies(freqs) + } - mod.Debug("wifi supported frequencies: %v", mod.frequencies) + mod.Debug("wifi supported frequencies: %v", mod.frequencies) + } // we need to start somewhere, this is just to check if // this OS supports switching channel programmatically.