Bug Summary

File:extcap/wifidump.c
Warning:line 417, column 9
Opened stream never closed. Potential resource leak

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name wifidump.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-20/lib/clang/20 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-20/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-truncation -Wno-format-nonliteral -Wno-pointer-sign -std=gnu11 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /builds/wireshark/wireshark/sbout/2025-09-13-101102-3933-1 -x c /builds/wireshark/wireshark/extcap/wifidump.c
1/* wifidump.c
2 * wifidump is an extcap tool used to capture Wi-Fi frames using a remote ssh host
3 *
4 * Adapted from sshdump.
5 *
6 * Copyright 2022, Adrian Granados <[email protected]>
7 *
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <[email protected]>
10 * Copyright 1998 Gerald Combs
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 */
14
15#include "config.h"
16#define WS_LOG_DOMAIN"wifidump" "wifidump"
17
18#include <extcap/extcap-base.h>
19#include <extcap/ssh-base.h>
20#include <wsutil/interface.h>
21#include <wsutil/file_util.h>
22#include <wsutil/strtoi.h>
23#include <wsutil/filesystem.h>
24#include <wsutil/privileges.h>
25#include <wsutil/please_report_bug.h>
26#include <wsutil/wslog.h>
27
28#include <errno(*__errno_location ()).h>
29#include <string.h>
30#include <fcntl.h>
31
32#include <cli_main.h>
33
34static char* wifidump_extcap_interface;
35#define DEFAULT_WIFIDUMP_EXTCAP_INTERFACE"wifidump" "wifidump"
36
37#define WIFIDUMP_VERSION_MAJOR"1" "1"
38#define WIFIDUMP_VERSION_MINOR"0" "0"
39#define WIFIDUMP_VERSION_RELEASE"0" "0"
40
41#define SSH_READ_BLOCK_SIZE256 256
42
43enum {
44 EXTCAP_BASE_OPTIONS_ENUMEXTCAP_OPT_LIST_INTERFACES, EXTCAP_OPT_VERSION, EXTCAP_OPT_LIST_DLTS
, EXTCAP_OPT_INTERFACE, EXTCAP_OPT_CONFIG, EXTCAP_OPT_CONFIG_OPTION_NAME
, EXTCAP_OPT_CONFIG_OPTION_VALUE, EXTCAP_OPT_CLEANUP_POSTKILL
, EXTCAP_OPT_CAPTURE, EXTCAP_OPT_CAPTURE_FILTER, EXTCAP_OPT_FIFO
, EXTCAP_OPT_LOG_LEVEL, EXTCAP_OPT_LOG_FILE
,
45 OPT_HELP,
46 OPT_VERSION,
47 OPT_REMOTE_HOST,
48 OPT_REMOTE_PORT,
49 OPT_REMOTE_USERNAME,
50 OPT_REMOTE_PASSWORD,
51 OPT_REMOTE_INTERFACE,
52 OPT_REMOTE_CHANNEL_FREQUENCY,
53 OPT_REMOTE_CHANNEL_WIDTH,
54 OPT_REMOTE_FILTER,
55 OPT_SSHKEY,
56 OPT_SSHKEY_PASSPHRASE,
57 OPT_PROXYCOMMAND,
58 OPT_SSH_SHA1,
59 OPT_REMOTE_COUNT
60};
61
62static const struct ws_option longopts[] = {
63 EXTCAP_BASE_OPTIONS{ "extcap-interfaces", 0, ((void*)0), EXTCAP_OPT_LIST_INTERFACES
}, { "extcap-version", 2, ((void*)0), EXTCAP_OPT_VERSION}, { "extcap-dlts"
, 0, ((void*)0), EXTCAP_OPT_LIST_DLTS}, { "extcap-interface",
1, ((void*)0), EXTCAP_OPT_INTERFACE}, { "extcap-config", 0, (
(void*)0), EXTCAP_OPT_CONFIG}, { "extcap-config-option-name",
1, ((void*)0), EXTCAP_OPT_CONFIG_OPTION_NAME}, { "extcap-config-option-value"
, 1, ((void*)0), EXTCAP_OPT_CONFIG_OPTION_VALUE }, { "extcap-cleanup-postkill"
, 0, ((void*)0), EXTCAP_OPT_CLEANUP_POSTKILL }, { "capture", 0
, ((void*)0), EXTCAP_OPT_CAPTURE}, { "extcap-capture-filter",
1, ((void*)0), EXTCAP_OPT_CAPTURE_FILTER}, { "fifo", 1, ((void
*)0), EXTCAP_OPT_FIFO}, { "log-level", 1, ((void*)0), EXTCAP_OPT_LOG_LEVEL
}, { "log-file", 1, ((void*)0), EXTCAP_OPT_LOG_FILE}
,
64 { "help", ws_no_argument0, NULL((void*)0), OPT_HELP},
65 { "version", ws_no_argument0, NULL((void*)0), OPT_VERSION},
66 SSH_BASE_PACKET_OPTIONS{ "remote-host", 1, ((void*)0), OPT_REMOTE_HOST}, { "remote-port"
, 1, ((void*)0), OPT_REMOTE_PORT}, { "remote-username", 1, ((
void*)0), OPT_REMOTE_USERNAME}, { "remote-password", 1, ((void
*)0), OPT_REMOTE_PASSWORD}, { "remote-count", 1, ((void*)0), OPT_REMOTE_COUNT
}, { "sshkey", 1, ((void*)0), OPT_SSHKEY}, { "sshkey-passphrase"
, 1, ((void*)0), OPT_SSHKEY_PASSPHRASE}, { "proxycommand", 1,
((void*)0), OPT_PROXYCOMMAND}, { "ssh-sha1", 0, ((void*)0), OPT_SSH_SHA1
}, { "remote-interface", 1, ((void*)0), OPT_REMOTE_INTERFACE}
, { "remote-filter", 1, ((void*)0), OPT_REMOTE_FILTER}
,
67 { "remote-channel-frequency", ws_required_argument1, NULL((void*)0), OPT_REMOTE_CHANNEL_FREQUENCY},
68 { "remote-channel-width", ws_required_argument1, NULL((void*)0), OPT_REMOTE_CHANNEL_WIDTH},
69 { 0, 0, 0, 0}
70};
71
72static const char * remote_capture_functions =
73"\n"
74"function iface_down {\n"
75" local iface=$1\n"
76" sudo ip link set $iface down > /dev/null 2>&1\n"
77"}\n"
78"\n"
79"function iface_up {\n"
80" local iface=$1\n"
81" sudo ip link set $iface up > /dev/null 2>&1\n"
82"}\n"
83"\n"
84"function iface_monitor {\n"
85" local iface=$1\n"
86" sudo iw dev $iface set monitor control otherbss > /dev/null 2>&1 ||\n"
87" sudo iw dev $iface set type monitor control otherbss > /dev/null 2>&1\n"
88"}\n"
89"\n"
90"function iface_scan {\n"
91" local iface=$1\n"
92" iface_down $iface &&\n"
93" sudo iw dev $iface set type managed > /dev/null 2>&1 &&\n"
94" iface_up $iface &&\n"
95" sudo iw dev $iface scan > /dev/null 2>&1\n"
96"}\n"
97"\n"
98"function iface_config {\n"
99" local iface=$1\n"
100" local freq=$2\n"
101" local ch_width=$3\n"
102" local center_freq=$4\n"
103" if [ $freq -eq $center_freq ]; then\n"
104" sudo iw dev $1 set freq $freq $ch_width 2>&1\n"
105" else\n"
106" sudo iw dev $1 set freq $freq $ch_width $center_freq 2>&1\n"
107" fi\n"
108"}\n"
109"\n"
110"function iface_start {\n"
111" local iface=$1\n"
112" local count=$2\n"
113" local filter=\"${@:3}\"\n"
114" if [ $count -gt 0 ]; then\n"
115" sudo tcpdump -i $iface -U -w - -c $count $filter\n"
116" else\n"
117" sudo tcpdump -i $iface -U -w - $filter\n"
118" fi\n"
119"}\n"
120"\n"
121"function capture_generic {\n"
122" local iface=$1\n"
123" local freq=$2\n"
124" local ch_width=$3\n"
125" local center_freq=$4\n"
126" local count=$5\n"
127" local filter=\"${@:6}\"\n"
128" if ! { iwconfig $iface | grep Monitor > /dev/null 2>&1; }; then\n"
129" iface_down $iface &&\n"
130" iface_monitor $iface &&\n"
131" iface_up $iface\n"
132" else\n"
133" iface_monitor $iface\n"
134" fi\n"
135" iface_config $iface $freq $ch_width $center_freq &&\n"
136" iface_start $iface $count $filter\n"
137"}\n"
138"\n"
139"function capture_iwlwifi {\n"
140" local iface=$1\n"
141" local freq=$2\n"
142" local ch_width=$3\n"
143" local center_freq=$4\n"
144" local count=$5\n"
145" local filter=\"${@:6}\"\n"
146" INDEX=`sudo iw dev $iface info | grep wiphy | grep -Eo '[0-9]+'`\n"
147" sudo iw phy phy${INDEX} channels | grep $freq | grep -i disabled > /dev/null 2>&1 &&\n"
148" iface_scan $iface\n"
149" MON=${iface}mon\n"
150" sudo iw $iface interface add $MON type monitor flags none > /dev/null 2>&1\n"
151" iface_up $MON &&\n"
152" iface_down $iface &&\n"
153" iface_config $MON $freq $ch_width $center_freq &&\n"
154" iface_start $MON $count $filter\n"
155"}\n"
156"\n"
157"function capture {\n"
158" local iface=$1\n"
159" local freq=$2\n"
160" local ch_width=$3\n"
161" local center_freq=$4\n"
162" local count=$5\n"
163" local filter=\"${@:6}\"\n"
164" if [ \"$iface\" == \"auto\" ]; then\n"
165" iface=`sudo iw dev | grep -i interface | awk '{ print $2 }' | sort | head -n 1`\n"
166" fi\n"
167" local driver=`/usr/sbin/ethtool -i $iface | grep driver | awk '{ print $2 }'`\n"
168" if [ $driver = \"iwlwifi\" ]; then\n"
169" capture_iwlwifi $iface $freq $ch_width $center_freq $count $filter\n"
170" else\n"
171" capture_generic $iface $freq $ch_width $center_freq $count $filter\n"
172" fi\n"
173"}\n"
174"\n";
175
176static unsigned int wifi_freqs_2dot4_5ghz[] = {
177 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462,
178 2467, 2472, 2484,
179 5180, 5200, 5220, 5240, 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580,
180 5600, 5620, 5640, 5660, 5680, 5700, 5720, 5745, 5765, 5785, 5805, 5825,
181 0
182};
183
184static unsigned int freq_to_channel(unsigned int freq_mhz) {
185 if (freq_mhz == 2484)
186 return 14;
187 else if (freq_mhz >= 2412 && freq_mhz <= 2484)
188 return ((freq_mhz - 2412) / 5) + 1;
189 else if (freq_mhz >= 5160 && freq_mhz <= 5885)
190 return ((freq_mhz - 5180) / 5) + 36;
191 else if (freq_mhz >= 5955 && freq_mhz <= 7115)
192 return ((freq_mhz - 5955) / 5) + 1;
193 else
194 return 0;
195}
196
197static const char *freq_to_band(unsigned int freq_mhz)
198{
199 if (freq_mhz >= 2412 && freq_mhz <= 2484)
200 return "2.4 GHz";
201 else if (freq_mhz >= 5160 && freq_mhz <= 5885)
202 return "5 GHz";
203 else if (freq_mhz >= 5955 && freq_mhz <= 7115)
204 return "6 GHz";
205 else
206 return NULL((void*)0);
207}
208
209static unsigned int center_freq(unsigned int freq_mhz, unsigned int ch_width_mhz) {
210
211 unsigned int start_freq;
212
213 if (ch_width_mhz == 20) {
214 return freq_mhz;
215 }
216 else if (ch_width_mhz == 40) {
217 if (freq_mhz >= 5180 && freq_mhz <= 5720) {
218 for (start_freq = 5180; start_freq <= 5700; start_freq += ch_width_mhz) {
219 if (freq_mhz >= start_freq && freq_mhz <= (start_freq + 20))
220 return ((start_freq * 2) + 20) / 2;
221 }
222 }
223 else if (freq_mhz >= 5745 && freq_mhz <= 5765)
224 return 5755;
225 else if (freq_mhz >= 5785 && freq_mhz <= 5805)
226 return 5795;
227 else if (freq_mhz >= 5955 && freq_mhz <= 7095) {
228 for (start_freq = 5955; start_freq <= 7075; start_freq += ch_width_mhz) {
229 if (freq_mhz >= start_freq && freq_mhz <= (start_freq + 20))
230 return ((start_freq * 2) + 20) / 2;
231 }
232 }
233 }
234 else if (ch_width_mhz == 80) {
235 if (freq_mhz >= 5180 && freq_mhz <= 5660) {
236 for (start_freq = 5180; start_freq <= 5660; start_freq += ch_width_mhz) {
237 if (freq_mhz >= start_freq && freq_mhz <= (start_freq + 60))
238 return ((start_freq * 2) + 60) / 2;
239 }
240 }
241 else if (freq_mhz >= 5745 && freq_mhz <= 5805)
242 return 5775;
243 else if (freq_mhz >= 5955 && freq_mhz <= 7055) {
244 for (start_freq = 5955; start_freq <= 6995; start_freq += ch_width_mhz) {
245 if (freq_mhz >= start_freq && freq_mhz <= (start_freq + 60))
246 return ((start_freq * 2) + 60) / 2;
247 }
248 }
249 }
250 else if (ch_width_mhz == 160) {
251 if (freq_mhz >= 5180 && freq_mhz <= 5640) {
252 for (start_freq = 5180; start_freq <= 5500; start_freq += ch_width_mhz) {
253 if (freq_mhz >= start_freq && freq_mhz <= (start_freq + 140))
254 return ((start_freq * 2) + 140) / 2;
255 }
256 }
257 else if (freq_mhz >= 5955 && freq_mhz <= 7055) {
258 for (start_freq = 5955; start_freq <= 6915; start_freq += ch_width_mhz) {
259 if (freq_mhz >= start_freq && freq_mhz <= (start_freq + 140))
260 return ((start_freq * 2) + 140) / 2;
261 }
262 }
263 }
264
265 return -1;
266}
267
268static int ssh_loop_read(ssh_channel channel, FILE* fp)
269{
270 int nbytes;
271 int ret = EXIT_SUCCESS0;
272 char buffer[SSH_READ_BLOCK_SIZE256];
273
274 /* read from stdin until data are available */
275 while (ssh_channel_is_open(channel) && !ssh_channel_is_eof(channel)) {
276 nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE256, 0);
277 if (nbytes < 0) {
278 ws_warning("Error reading from channel")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 278, __func__, "Error reading from channel"); } } while (0)
;
279 goto end;
280 }
281 if (nbytes == 0) {
282 break;
283 }
284 if (fwrite(buffer, 1, nbytes, fp) != (unsigned)nbytes) {
285 ws_warning("Error writing to fifo")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 285, __func__, "Error writing to fifo"); } } while (0)
;
286 ret = EXIT_FAILURE1;
287 goto end;
288 }
289 fflush(fp);
290 }
291
292 /* read loop finished... maybe something wrong happened. Read from stderr */
293 while (ssh_channel_is_open(channel) && !ssh_channel_is_eof(channel)) {
294 nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE256, 1);
295 if (nbytes < 0) {
296 ws_warning("Error reading from channel")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 296, __func__, "Error reading from channel"); } } while (0)
;
297 goto end;
298 }
299 if (fwrite(buffer, 1, nbytes, stderrstderr) != (unsigned)nbytes) {
300 ws_warning("Error writing to stderr")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 300, __func__, "Error writing to stderr"); } } while (0)
;
301 break;
302 }
303 }
304
305end:
306 if (ssh_channel_send_eof(channel) != SSH_OK0) {
307 ws_warning("Error sending EOF in ssh channel")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 307, __func__, "Error sending EOF in ssh channel"); } } while
(0)
;
308 ret = EXIT_FAILURE1;
309 }
310 return ret;
311}
312
313static ssh_channel run_ssh_command(ssh_session sshs, const char* capture_functions,
314 const char* iface, const uint16_t channel_frequency, const uint16_t channel_width,
315 const uint16_t center_frequency, const char* cfilter, const uint32_t count)
316{
317 char* cmdline;
318 ssh_channel channel;
319 char* quoted_iface = NULL((void*)0);
320 char* quoted_filter = NULL((void*)0);
321 char* count_str = NULL((void*)0);
322 unsigned int remote_port = 22;
323
324 channel = ssh_channel_new(sshs);
325 if (!channel) {
326 ws_warning("Can't create channel")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 326, __func__, "Can't create channel"); } } while (0)
;
327 return NULL((void*)0);
328 }
329
330 if (ssh_channel_open_session(channel) != SSH_OK0) {
331 ws_warning("Can't open session")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 331, __func__, "Can't open session"); } } while (0)
;
332 ssh_channel_free(channel);
333 return NULL((void*)0);
334 }
335
336 ssh_options_get_port(sshs, &remote_port);
337
338 quoted_iface = iface ? g_shell_quote(iface) : NULL((void*)0);
339 quoted_filter = g_shell_quote(cfilter ? cfilter : "");
340 cmdline = ws_strdup_printf("%s capture %s %u %u %u %u %s",wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
341 capture_functions,wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
342 quoted_iface ? quoted_iface : "auto",wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
343 channel_frequency,wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
344 channel_width,wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
345 center_frequency,wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
346 count,wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
347 quoted_filter)wmem_strdup_printf(((void*)0), "%s capture %s %u %u %u %u %s"
, capture_functions, quoted_iface ? quoted_iface : "auto", channel_frequency
, channel_width, center_frequency, count, quoted_filter)
;
348
349 ws_debug("Running: %s", cmdline)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_DEBUG, "extcap/wifidump.c"
, 349, __func__, "Running: %s", cmdline); } } while (0)
;
350 if (ssh_channel_request_exec(channel, cmdline) != SSH_OK0) {
351 ws_warning("Can't request exec")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 351, __func__, "Can't request exec"); } } while (0)
;
352 ssh_channel_close(channel);
353 ssh_channel_free(channel);
354 channel = NULL((void*)0);
355 }
356
357 g_free(quoted_iface);
358 g_free(quoted_filter);
359 g_free(cmdline);
360 g_free(count_str);
361
362 return channel;
363}
364
365static int ssh_open_remote_connection(const ssh_params_t* params, const char* capture_functions,
366 const char* iface, const uint16_t channel_frequency, const uint16_t channel_width,
367 const uint16_t center_frequency, const char* cfilter, const uint32_t count, const char* fifo)
368{
369 ssh_session sshs = NULL((void*)0);
370 ssh_channel channel = NULL((void*)0);
371 FILE* fp = stdoutstdout;
372 int ret = EXIT_FAILURE1;
373 char* err_info = NULL((void*)0);
374
375 if (g_strcmp0(fifo, "-")) {
24
Assuming the condition is true
25
Taking true branch
376 /* Open or create the output file */
377 fp = fopen(fifo, "wb");
26
Stream opened here
27
Assuming that 'fopen' is successful
378 if (fp
27.1
'fp' is not equal to NULL
== NULL((void*)0)) {
28
Taking false branch
379 ws_warning("Error creating output file: %s (%s)", fifo, g_strerror(errno))do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 379, __func__, "Error creating output file: %s (%s)", fifo,
g_strerror((*__errno_location ()))); } } while (0)
;
380 return EXIT_FAILURE1;
381 }
382 }
383
384 sshs = create_ssh_connection(params, &err_info);
385
386 if (!sshs) {
29
Assuming 'sshs' is null
30
Taking true branch
387 ws_warning("Error creating connection.")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 387, __func__, "Error creating connection."); } } while (0)
;
31
Taking true branch
32
Loop condition is false. Exiting loop
388 goto cleanup;
33
Control jumps to line 408
389 }
390
391 channel = run_ssh_command(sshs, capture_functions, iface, channel_frequency,
392 channel_width, center_frequency, cfilter, count);
393
394 if (!channel) {
395 ws_warning("Can't run ssh command.")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 395, __func__, "Can't run ssh command."); } } while (0)
;
396 goto cleanup;
397 }
398
399 /* read from channel and write into fp */
400 if (ssh_loop_read(channel, fp) != EXIT_SUCCESS0) {
401 ws_warning("Error in read loop.")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 401, __func__, "Error in read loop."); } } while (0)
;
402 ret = EXIT_FAILURE1;
403 goto cleanup;
404 }
405
406 ret = EXIT_SUCCESS0;
407cleanup:
408 if (err_info)
34
Assuming 'err_info' is null
35
Taking false branch
409 ws_warning("%s", err_info)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 409, __func__, "%s", err_info); } } while (0)
;
410 g_free(err_info);
411
412 /* clean up and exit */
413 ssh_cleanup(&sshs, &channel);
414
415 if (g_strcmp0(fifo, "-"))
36
Assuming the condition is false
37
Taking false branch
416 fclose(fp);
417 return ret;
38
Opened stream never closed. Potential resource leak
418}
419
420static int list_config(char *interface)
421{
422 unsigned inc = 0;
423 int i, psc;
424
425 if (!interface) {
426 ws_warning("ERROR: No interface specified.")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 426, __func__, "ERROR: No interface specified."); } } while
(0)
;
427 return EXIT_FAILURE1;
428 }
429
430 if (g_strcmp0(interface, wifidump_extcap_interface)) {
431 ws_warning("ERROR: interface must be %s", wifidump_extcap_interface)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 431, __func__, "ERROR: interface must be %s", wifidump_extcap_interface
); } } while (0)
;
432 return EXIT_FAILURE1;
433 }
434
435 // Server tab
436 printf("arg {number=%u}{call=--remote-host}{display=Remote SSH server address}"
437 "{type=string}{tooltip=The remote SSH host. It can be both "
438 "an IP address or a hostname}{required=true}{group=Server}\n", inc++);
439 printf("arg {number=%u}{call=--remote-port}{display=Remote SSH server port}"
440 "{type=unsigned}{tooltip=The remote SSH host port (1-65535)}"
441 "{range=1,65535}{group=Server}\n", inc++);
442
443 // Authentication tab
444 printf("arg {number=%u}{call=--remote-username}{display=Remote SSH server username}"
445 "{type=string}{tooltip=The remote SSH username. If not provided, "
446 "the current user will be used}{group=Authentication}\n", inc++);
447 printf("arg {number=%u}{call=--remote-password}{display=Remote SSH server password}"
448 "{type=password}{tooltip=The SSH password, used when other methods (SSH agent "
449 "or key files) are unavailable.}{group=Authentication}\n", inc++);
450 printf("arg {number=%u}{call=--sshkey}{display=Path to SSH private key}"
451 "{type=fileselect}{tooltip=The path on the local filesystem of the private ssh key}"
452 "{mustexist=true}{group=Authentication}\n", inc++);
453 printf("arg {number=%u}{call=--sshkey-passphrase}{display=SSH key passphrase}"
454 "{type=password}{tooltip=Passphrase to unlock the SSH private key}{group=Authentication}\n",
455 inc++);
456 printf("arg {number=%u}{call=--ssh-sha1}{display=Support SHA-1 keys (deprecated)}"
457 "{type=boolflag}{tooltip=Support keys and key exchange algorithms using SHA-1 (deprecated)}{group=Authentication}"
458 "\n", inc++);
459
460
461 // Capture tab
462 printf("arg {number=%u}{call=--remote-interface}{display=Remote interface}"
463 "{type=string}{tooltip=The remote network interface used to capture"
464 "}{default=auto}{group=Capture}\n", inc++);
465 printf("arg {number=%u}{call=--remote-channel-frequency}{display=Remote channel}"
466 "{type=selector}{tooltip=The remote channel used to capture}{group=Capture}\n", inc);
467
468 unsigned int freq = 0;
469 for (i = 0; (freq = wifi_freqs_2dot4_5ghz[i]); i++) {
470 printf("value {arg=%u}{value=%u}{display=%s, Channel %u}\n", inc, freq, freq_to_band(freq), freq_to_channel(freq));
471 }
472
473 for (freq = 5955, psc = 3; freq <= 7115; freq += 20, psc++) {
474 printf("value {arg=%u}{value=%u}{display=%s, Channel %u%s}\n", inc, freq,
475 freq_to_band(freq), freq_to_channel(freq), (psc % 4 == 0) ? " (PSC)" : "");
476 }
477 inc++;
478
479 printf("arg {number=%u}{call=--remote-channel-width}{display=Remote channel width}"
480 "{type=selector}{tooltip=The remote channel width used to capture}"
481 "{group=Capture}\n", inc);
482 printf("value {arg=%u}{value=20}{display=20 MHz}\n", inc);
483 printf("value {arg=%u}{value=40}{display=40 MHz}\n", inc);
484 printf("value {arg=%u}{value=80}{display=80 MHz}\n", inc);
485 printf("value {arg=%u}{value=160}{display=160 MHz}\n", inc);
486 inc++;
487
488 printf("arg {number=%u}{call=--remote-filter}{display=Remote capture filter}{type=string}"
489 "{tooltip=The remote capture filter}{group=Capture}\n", inc++);
490 printf("arg {number=%u}{call=--remote-count}{display=Frames to capture}"
491 "{type=unsigned}{tooltip=The number of remote frames to capture.}"
492 "{group=Capture}\n", inc++);
493
494 extcap_config_debug(&inc);
495
496 return EXIT_SUCCESS0;
497}
498
499static char* concat_filters(const char* extcap_filter, const char* remote_filter)
500{
501 if (!extcap_filter && remote_filter)
502 return g_strdup(remote_filter)g_strdup_inline (remote_filter);
503
504 if (!remote_filter && extcap_filter)
505 return g_strdup(extcap_filter)g_strdup_inline (extcap_filter);
506
507 if (!remote_filter && !extcap_filter)
508 return NULL((void*)0);
509
510 return ws_strdup_printf("(%s) and (%s)", extcap_filter, remote_filter)wmem_strdup_printf(((void*)0), "(%s) and (%s)", extcap_filter
, remote_filter)
;
511}
512
513int main(int argc, char *argv[])
514{
515 char* err_msg;
516 int result;
517 int option_idx = 0;
518 ssh_params_t* ssh_params = ssh_params_new();
519 char* remote_interface = NULL((void*)0);
520 uint16_t remote_channel_frequency = 0;
521 uint16_t remote_channel_width = 0;
522 uint16_t remote_center_frequency = 0;
523 char* remote_filter = NULL((void*)0);
524 uint32_t count = 0;
525 int ret = EXIT_FAILURE1;
526 extcap_parameters* extcap_conf = g_new0(extcap_parameters, 1)((extcap_parameters *) g_malloc0_n ((1), sizeof (extcap_parameters
)))
;
527 char* help_url;
528 char* help_header = NULL((void*)0);
529 char* interface_description = g_strdup("Wi-Fi remote capture")g_strdup_inline ("Wi-Fi remote capture");
530
531 /* Set the program name. */
532 g_set_prgname("wifidump");
533
534 /* Initialize log handler early so we can have proper logging during startup. */
535 extcap_log_init();
536
537 wifidump_extcap_interface = g_path_get_basename(argv[0]);
538 if (g_str_has_suffix(wifidump_extcap_interface, ".exe")(__builtin_constant_p (".exe")? __extension__ ({ const char *
const __str = (wifidump_extcap_interface); const char * const
__suffix = (".exe"); gboolean __result = (0); if (__str == (
(void*)0) || __suffix == ((void*)0)) __result = (g_str_has_suffix
) (__str, __suffix); else { const size_t __str_len = strlen (
((__str) + !(__str))); const size_t __suffix_len = strlen (((
__suffix) + !(__suffix))); if (__str_len >= __suffix_len) __result
= memcmp (__str + __str_len - __suffix_len, ((__suffix) + !(
__suffix)), __suffix_len) == 0; } __result; }) : (g_str_has_suffix
) (wifidump_extcap_interface, ".exe") )
) {
1
'?' condition is true
2
Assuming '__str' is equal to null
3
Assuming the condition is false
4
Taking false branch
539 wifidump_extcap_interface[strlen(wifidump_extcap_interface) - 4] = '\0';
540 }
541
542 /*
543 * Get credential information for later use.
544 */
545 init_process_policies();
546
547 /*
548 * Attempt to get the pathname of the directory containing the
549 * executable file.
550 */
551 err_msg = configuration_init(argv[0]);
552 if (err_msg != NULL((void*)0)) {
5
Assuming 'err_msg' is equal to NULL
6
Taking false branch
553 ws_warning("Can't get pathname of directory containing the extcap program: %s.",do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 554, __func__, "Can't get pathname of directory containing the extcap program: %s."
, err_msg); } } while (0)
554 err_msg)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 554, __func__, "Can't get pathname of directory containing the extcap program: %s."
, err_msg); } } while (0)
;
555 g_free(err_msg);
556 }
557
558 help_url = data_file_url("wifidump.html");
559 extcap_base_set_util_info(extcap_conf, argv[0], WIFIDUMP_VERSION_MAJOR"1", WIFIDUMP_VERSION_MINOR"0",
560 WIFIDUMP_VERSION_RELEASE"0", help_url);
561 g_free(help_url);
562 add_libssh_info(extcap_conf);
563 if (g_strcmp0(wifidump_extcap_interface, DEFAULT_WIFIDUMP_EXTCAP_INTERFACE"wifidump")) {
7
Assuming the condition is false
8
Taking false branch
564 char* temp = interface_description;
565 interface_description = ws_strdup_printf("%s, custom version", interface_description)wmem_strdup_printf(((void*)0), "%s, custom version", interface_description
)
;
566 g_free(temp);
567 }
568 extcap_base_register_interface(extcap_conf, wifidump_extcap_interface, interface_description, 147, "Remote capture dependent DLT");
569 g_free(interface_description);
570
571 help_header = ws_strdup_printf(wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
572 " %s --extcap-interfaces\n"wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
573 " %s --extcap-interface=%s --extcap-dlts\n"wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
574 " %s --extcap-interface=%s --extcap-config\n"wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
575 " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
576 "--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
577 "--remote-channel-width 40 --fifo=FILENAME --capture\n", argv[0], argv[0], wifidump_extcap_interface, argv[0],wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
578 wifidump_extcap_interface, argv[0], wifidump_extcap_interface)wmem_strdup_printf(((void*)0), " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n"
" %s --extcap-interface=%s --extcap-config\n" " %s --extcap-interface=%s --remote-host myhost --remote-port 22222 "
"--remote-username myuser --remote-interface wlan0 --remote-channel-frequency 5180 "
"--remote-channel-width 40 --fifo=FILENAME --capture\n", argv
[0], argv[0], wifidump_extcap_interface, argv[0], wifidump_extcap_interface
, argv[0], wifidump_extcap_interface)
;
579 extcap_help_add_header(extcap_conf, help_header);
580 g_free(help_header);
581 extcap_help_add_option(extcap_conf, "--help", "print this help");
582 extcap_help_add_option(extcap_conf, "--version", "print the version");
583 extcap_help_add_option(extcap_conf, "--remote-host <host>", "the remote SSH host");
584 extcap_help_add_option(extcap_conf, "--remote-port <port>", "the remote SSH port");
585 extcap_help_add_option(extcap_conf, "--remote-username <username>", "the remote SSH username");
586 extcap_help_add_option(extcap_conf, "--remote-password <password>", "the remote SSH password. If not specified, ssh-agent and ssh-key are used");
587 extcap_help_add_option(extcap_conf, "--sshkey <public key path>", "the path of the ssh key");
588 extcap_help_add_option(extcap_conf, "--sshkey-passphrase <public key passphrase>", "the passphrase to unlock public ssh");
589 extcap_help_add_option(extcap_conf, "--ssh-sha1", "support keys and key exchange using SHA-1 (deprecated)");
590 extcap_help_add_option(extcap_conf, "--remote-interface <iface>", "the remote capture interface");
591 extcap_help_add_option(extcap_conf, "--remote-channel-frequency <channel_frequency>", "the remote channel frequency in MHz");
592 extcap_help_add_option(extcap_conf, "--remote-channel-width <channel_width>", "the remote channel width in MHz");
593 extcap_help_add_option(extcap_conf, "--remote-filter <filter>", "a filter for remote capture");
594 extcap_help_add_option(extcap_conf, "--remote-count <count>", "the number of frames to capture");
595
596 ws_opterr = 0;
597 ws_optind = 0;
598
599 if (argc == 1) {
9
Assuming 'argc' is not equal to 1
10
Taking false branch
600 extcap_help_print(extcap_conf);
601 goto end;
602 }
603
604 while ((result = ws_getopt_long(argc, argv, ":", longopts, &option_idx)) != -1) {
11
Assuming the condition is false
12
Loop condition is false. Execution continues on line 700
605
606 switch (result) {
607
608 case OPT_HELP:
609 extcap_help_print(extcap_conf);
610 ret = EXIT_SUCCESS0;
611 goto end;
612
613 case OPT_VERSION:
614 extcap_version_print(extcap_conf);
615 ret = EXIT_SUCCESS0;
616 goto end;
617
618 case OPT_REMOTE_HOST:
619 g_free(ssh_params->host);
620 ssh_params->host = g_strdup(ws_optarg)g_strdup_inline (ws_optarg);
621 break;
622
623 case OPT_REMOTE_PORT:
624 if (!ws_strtou16(ws_optarg, NULL((void*)0), &ssh_params->port) || ssh_params->port == 0) {
625 ws_warning("Invalid port: %s", ws_optarg)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 625, __func__, "Invalid port: %s", ws_optarg); } } while (0
)
;
626 goto end;
627 }
628 break;
629
630 case OPT_REMOTE_USERNAME:
631 g_free(ssh_params->username);
632 ssh_params->username = g_strdup(ws_optarg)g_strdup_inline (ws_optarg);
633 break;
634
635 case OPT_REMOTE_PASSWORD:
636 g_free(ssh_params->password);
637 ssh_params->password = g_strdup(ws_optarg)g_strdup_inline (ws_optarg);
638 memset(ws_optarg, 'X', strlen(ws_optarg));
639 break;
640
641 case OPT_SSHKEY:
642 g_free(ssh_params->sshkey_path);
643 ssh_params->sshkey_path = g_strdup(ws_optarg)g_strdup_inline (ws_optarg);
644 break;
645
646 case OPT_SSHKEY_PASSPHRASE:
647 g_free(ssh_params->sshkey_passphrase);
648 ssh_params->sshkey_passphrase = g_strdup(ws_optarg)g_strdup_inline (ws_optarg);
649 memset(ws_optarg, 'X', strlen(ws_optarg));
650 break;
651
652 case OPT_SSH_SHA1:
653 ssh_params->ssh_sha1 = true1;
654 break;
655
656 case OPT_REMOTE_INTERFACE:
657 g_free(remote_interface);
658 remote_interface = g_strdup(ws_optarg)g_strdup_inline (ws_optarg);
659 break;
660
661 case OPT_REMOTE_CHANNEL_FREQUENCY:
662 if (!ws_strtou16(ws_optarg, NULL((void*)0), &remote_channel_frequency)) {
663 ws_warning("Invalid channel frequency: %s", ws_optarg)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 663, __func__, "Invalid channel frequency: %s", ws_optarg);
} } while (0)
;
664 goto end;
665 }
666 break;
667
668 case OPT_REMOTE_CHANNEL_WIDTH:
669 if (!ws_strtou16(ws_optarg, NULL((void*)0), &remote_channel_width)) {
670 ws_warning("Invalid channel width: %s", ws_optarg)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 670, __func__, "Invalid channel width: %s", ws_optarg); } }
while (0)
;
671 goto end;
672 }
673 break;
674
675 case OPT_REMOTE_FILTER:
676 g_free(remote_filter);
677 remote_filter = g_strdup(ws_optarg)g_strdup_inline (ws_optarg);
678 break;
679
680 case OPT_REMOTE_COUNT:
681 if (!ws_strtou32(ws_optarg, NULL((void*)0), &count)) {
682 ws_warning("Invalid value for count: %s", ws_optarg)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 682, __func__, "Invalid value for count: %s", ws_optarg); }
} while (0)
;
683 goto end;
684 }
685 break;
686
687 case ':':
688 /* missing option argument */
689 ws_warning("Option '%s' requires an argument", argv[ws_optind - 1])do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 689, __func__, "Option '%s' requires an argument", argv[ws_optind
- 1]); } } while (0)
;
690 break;
691
692 default:
693 if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, ws_optarg)) {
694 ws_warning("Invalid option: %s", argv[ws_optind - 1])do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 694, __func__, "Invalid option: %s", argv[ws_optind - 1]); }
} while (0)
;
695 goto end;
696 }
697 }
698 }
699
700 extcap_cmdline_debug(argv, argc);
701
702 if (extcap_base_handle_interface(extcap_conf)) {
13
Assuming the condition is false
14
Taking false branch
703 ret = EXIT_SUCCESS0;
704 goto end;
705 }
706
707 if (extcap_conf->show_config) {
15
Assuming field 'show_config' is 0
16
Taking false branch
708 ret = list_config(extcap_conf->interface);
709 goto end;
710 }
711
712 err_msg = ws_init_sockets();
713 if (err_msg != NULL((void*)0)) {
17
Assuming 'err_msg' is equal to NULL
18
Taking false branch
714 ws_warning("ERROR: %s", err_msg)do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 714, __func__, "ERROR: %s", err_msg); } } while (0)
;
715 g_free(err_msg);
716 ws_warning("%s", please_report_bug())do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 716, __func__, "%s", please_report_bug()); } } while (0)
;
717 goto end;
718 }
719
720 if (extcap_conf->capture) {
19
Assuming field 'capture' is not equal to 0
20
Taking true branch
721 char* filter;
722
723 if (!ssh_params->host) {
21
Assuming field 'host' is non-null
22
Taking false branch
724 ws_warning("Missing parameter: --remote-host")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_WARNING, "extcap/wifidump.c"
, 724, __func__, "Missing parameter: --remote-host"); } } while
(0)
;
725 goto end;
726 }
727 remote_center_frequency = center_freq(remote_channel_frequency, remote_channel_width);
728 filter = concat_filters(extcap_conf->capture_filter, remote_filter);
729 ssh_params_set_log_level(ssh_params, extcap_conf->debug);
730 ret = ssh_open_remote_connection(ssh_params, remote_capture_functions,
23
Calling 'ssh_open_remote_connection'
731 remote_interface, remote_channel_frequency, remote_channel_width, remote_center_frequency,
732 filter, count, extcap_conf->fifo);
733 g_free(filter);
734 } else {
735 ws_debug("You should not come here... maybe some parameter missing?")do { if (1) { ws_log_full("wifidump", LOG_LEVEL_DEBUG, "extcap/wifidump.c"
, 735, __func__, "You should not come here... maybe some parameter missing?"
); } } while (0)
;
736 ret = EXIT_FAILURE1;
737 }
738
739end:
740 /* clean up stuff */
741 ssh_params_free(ssh_params);
742 g_free(remote_interface);
743 g_free(remote_filter);
744 extcap_base_cleanup(&extcap_conf);
745 return ret;
746}
747
748/*
749 * Editor modelines - https://www.wireshark.org/tools/modelines.html
750 *
751 * Local variables:
752 * c-basic-offset: 8
753 * tab-width: 8
754 * indent-tabs-mode: t
755 * End:
756 *
757 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
758 * :indentSize=8:tabSize=8:noTabs=false:
759 */