From 0c2fb39c5ab666ceb82ecf57ff9c451dd189d443 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 14 Apr 2026 13:30:41 +0200 Subject: [PATCH] wifi-scripts: iwinfo scan() must not abort the interpreter on failure Replace exit(1) on every failure path with return null so callers that iterate over multiple radios can collect results from the radios that did succeed instead of aborting on the first one that refuses an off-channel scan. Route diagnostics to stderr via warn() so stdout stays clean for callers parsing JSON output, and include the device name in each message to disambiguate per-radio failures. Signed-off-by: John Crispin Signed-off-by: Felix Fietkau --- .../files-ucode/usr/share/ucode/iwinfo.uc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc index 3dfad25523b..c56026f1045 100644 --- a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc +++ b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc @@ -577,23 +577,24 @@ export function scan(dev) { scan_ssids: [ '' ], }; - let res = nl80211.request(nl80211.const.NL80211_CMD_TRIGGER_SCAN, 0, params); - if (res === false) { - printf("Unable to trigger scan: " + nl80211.error() + "\n"); - exit(1); + nl80211.request(nl80211.const.NL80211_CMD_TRIGGER_SCAN, 0, params); + let err = nl80211.error(); + if (err) { + warn("Unable to trigger scan on " + dev + ": " + err + "\n"); + return null; } - res = nl80211.waitfor([ + let res = nl80211.waitfor([ nl80211.const.NL80211_CMD_NEW_SCAN_RESULTS, nl80211.const.NL80211_CMD_SCAN_ABORTED ], 5000); if (!res) { - printf("Netlink error while awaiting scan results: " + nl80211.error() + "\n"); - exit(1); + warn("Netlink error while awaiting scan results on " + dev + ": " + nl80211.error() + "\n"); + return null; } else if (res.cmd == nl80211.const.NL80211_CMD_SCAN_ABORTED) { - printf("Scan aborted by kernel\n"); - exit(1); + warn("Scan aborted by kernel on " + dev + "\n"); + return null; } let scan = nl80211.request(nl80211.const.NL80211_CMD_GET_SCAN, nl80211.const.NLM_F_DUMP, { dev });