aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 26026caf00..cbe4d98a73 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4464,7 +4464,18 @@ set_80211_channel(const char *iface, const char *opt)
gchar **options = NULL;
options = g_strsplit_set(opt, ",", 4);
- for (args = 0; options[args]; args++);
+ for (args = 0; options[args]; args++)
+ ;
+
+ ret = ws80211_init();
+ if (ret != WS80211_INIT_OK) {
+ if (ret == WS80211_INIT_NOT_SUPPORTED)
+ cmdarg_err("Setting 802.11 channels is not supported on this platform");
+ else
+ cmdarg_err("Failed to init ws80211: %s", g_strerror(abs(ret)));
+ ret = 2;
+ goto out;
+ }
if (options[0])
freq = get_nonzero_guint32(options[0], "802.11 channel frequency");
@@ -4484,12 +4495,6 @@ set_80211_channel(const char *iface, const char *opt)
if (args >= 3 && options[3])
center_freq2 = get_nonzero_guint32(options[3], "VHT center frequency 2");
- ret = ws80211_init();
- if (ret) {
- cmdarg_err("%d: Failed to init ws80211: %s\n", abs(ret), g_strerror(abs(ret)));
- ret = 2;
- goto out;
- }
ret = ws80211_set_freq(iface, freq, type, center_freq1, center_freq2);
if (ret) {