forked from br101/horst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
792 lines (647 loc) · 19.3 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
/* horst - Highly Optimized Radio Scanning Tool
*
* Copyright (C) 2005-2014 Bruno Randolf ([email protected])
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#include <errno.h>
#include <err.h>
#include <sys/socket.h>
#include "main.h"
#include "util.h"
#include "capture.h"
#include "protocol_parser.h"
#include "network.h"
#include "display.h"
#include "wlan_util.h"
#include "ieee80211_util.h"
#include "control.h"
#include "channel.h"
#include "node.h"
#include "essid.h"
#include "conf_options.h"
struct list_head nodes;
struct essid_meta_info essids;
struct history hist;
struct statistics stats;
struct channel_info spectrum[MAX_CHANNELS];
struct node_names_info node_names;
struct config conf;
struct timeval the_time;
int mon; /* monitoring socket */
static FILE* DF = NULL;
/* receive packet buffer
*
* due to the way we receive packets the network (TCP connection) we have to
* expect the reception of partial packet as well as the reception of several
* packets at one. thus we implement a buffered receive where partially received
* data stays in the buffer.
*
* we need two buffers: one for packet capture or receiving from the server and
* another one for data the clients sends to the server.
*
* not sure if this is also an issue with local packet capture, but it is not
* implemented there.
*
* size: max 80211 frame (2312) + space for prism2 header (144)
* or radiotap header (usually only 26) + some extra */
static unsigned char buffer[2312 + 200];
static size_t buflen;
/* for packets from client to server */
static unsigned char cli_buffer[500];
static size_t cli_buflen;
/* for select */
static fd_set read_fds;
static fd_set write_fds;
static fd_set excpt_fds;
static volatile sig_atomic_t is_sigint_caught;
void __attribute__ ((format (printf, 1, 2)))
printlog(const char *fmt, ...)
{
char buf[128];
va_list ap;
va_start(ap, fmt);
vsnprintf(&buf[1], 127, fmt, ap);
va_end(ap);
if (conf.quiet || conf.debug || !conf.display_initialized)
printf("%s\n", &buf[1]);
else {
/* fix up string for display log */
buf[0] = '\n';
display_log(buf);
}
}
static void
update_history(struct packet_info* p)
{
if (p->phy_signal == 0)
return;
hist.signal[hist.index] = p->phy_signal;
hist.rate[hist.index] = p->phy_rate;
hist.type[hist.index] = (p->phy_flags & PHY_FLAG_BADFCS) ? 1 : p->wlan_type;
hist.retry[hist.index] = p->wlan_retry;
hist.index++;
if (hist.index == MAX_HISTORY)
hist.index = 0;
}
static void
update_statistics(struct packet_info* p)
{
int type = (p->phy_flags & PHY_FLAG_BADFCS) ? 1 : p->wlan_type;
if (p->phy_rate_idx == 0)
return;
stats.packets++;
stats.bytes += p->wlan_len;
if (p->wlan_retry)
stats.retries++;
if (p->phy_rate_idx > 0 && p->phy_rate_idx < MAX_RATES) {
stats.duration += p->pkt_duration;
stats.packets_per_rate[p->phy_rate_idx]++;
stats.bytes_per_rate[p->phy_rate_idx] += p->wlan_len;
stats.duration_per_rate[p->phy_rate_idx] += p->pkt_duration;
}
if (type >= 0 && type < MAX_FSTYPE) {
stats.packets_per_type[type]++;
stats.bytes_per_type[type] += p->wlan_len;
if (p->phy_rate_idx > 0 && p->phy_rate_idx < MAX_RATES)
stats.duration_per_type[type] += p->pkt_duration;
}
}
static void
update_spectrum(struct packet_info* p, struct node_info* n)
{
struct channel_info* chan;
struct chan_node* cn;
if (p->pkt_chan_idx < 0)
return; /* chan not found */
chan = &spectrum[p->pkt_chan_idx];
chan->signal = p->phy_signal;
chan->packets++;
chan->bytes += p->wlan_len;
chan->durations += p->pkt_duration;
ewma_add(&chan->signal_avg, -chan->signal);
if (!n) {
DEBUG("spec no node\n");
return;
}
/* add node to channel if not already there */
list_for_each(&chan->nodes, cn, chan_list) {
if (cn->node == n) {
DEBUG("SPEC node found %p\n", cn->node);
break;
}
}
if (cn->node != n) {
DEBUG("SPEC node adding %p\n", n);
cn = malloc(sizeof(struct chan_node));
cn->node = n;
cn->chan = chan;
ewma_init(&cn->sig_avg, 1024, 8);
list_add_tail(&chan->nodes, &cn->chan_list);
list_add_tail(&n->on_channels, &cn->node_list);
chan->num_nodes++;
n->num_on_channels++;
}
/* keep signal of this node as seen on this channel */
cn->sig = p->phy_signal;
ewma_add(&cn->sig_avg, -cn->sig);
cn->packets++;
}
void
update_spectrum_durations(void)
{
/* also if channel was not changed, keep stats only for every channel_time.
* display code uses durations_last to get a more stable view */
if (conf.channel_idx >= 0) {
spectrum[conf.channel_idx].durations_last =
spectrum[conf.channel_idx].durations;
spectrum[conf.channel_idx].durations = 0;
ewma_add(&spectrum[conf.channel_idx].durations_avg,
spectrum[conf.channel_idx].durations_last);
}
}
static void
write_to_file(struct packet_info* p)
{
char buf[40];
int i;
struct tm* ltm = localtime(&the_time.tv_sec);
//timestamp, e.g. 2015-05-16 15:05:44.338806
i = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ltm);
snprintf(buf+i, sizeof(buf)-i, ".%06ld", the_time.tv_usec);
fprintf(DF, "%s, ", buf);
fprintf(DF, "%s, %s, ",
get_packet_type_name(p->wlan_type), ether_sprintf(p->wlan_src));
fprintf(DF, "%s, ", ether_sprintf(p->wlan_dst));
fprintf(DF, "%s, ", ether_sprintf(p->wlan_bssid));
fprintf(DF, "%x, %d, %d, %d, %d, ",
p->pkt_types, p->phy_signal, p->wlan_len, p->phy_rate, p->phy_freq);
fprintf(DF, "%016llx, ", (unsigned long long)p->wlan_tsf);
fprintf(DF, "%s, %d, %d, %d, %d, %d, ",
p->wlan_essid, p->wlan_mode, p->wlan_channel,
p->wlan_wep, p->wlan_wpa, p->wlan_rsn);
fprintf(DF, "%s, %s\n", ip_sprintf(p->ip_src), ip_sprintf(p->ip_dst));
fflush(DF);
}
/* return 1 if packet is filtered */
static int
filter_packet(struct packet_info* p)
{
int i;
if (conf.filter_off)
return 0;
if (conf.filter_pkt != PKT_TYPE_ALL && (p->pkt_types & ~conf.filter_pkt)) {
stats.filtered_packets++;
return 1;
}
/* cannot trust anything if FCS is bad */
if (p->phy_flags & PHY_FLAG_BADFCS)
return 0;
if (conf.filter_mode != WLAN_MODE_ALL && ((p->wlan_mode & ~conf.filter_mode) || p->wlan_mode == 0)) {
/* this also filters out packets where we cannot associate a mode (ACK, RTS/CTS) */
stats.filtered_packets++;
return 1;
}
if (MAC_NOT_EMPTY(conf.filterbssid) &&
memcmp(p->wlan_bssid, conf.filterbssid, MAC_LEN) != 0) {
stats.filtered_packets++;
return 1;
}
if (conf.do_macfilter) {
for (i = 0; i < MAX_FILTERMAC; i++) {
if (MAC_NOT_EMPTY(p->wlan_src) &&
conf.filtermac_enabled[i] &&
memcmp(p->wlan_src, conf.filtermac[i], MAC_LEN) == 0) {
return 0;
}
}
stats.filtered_packets++;
return 1;
}
return 0;
}
void
fixup_packet_channel(struct packet_info* p) {
int i = -1;
/* get channel index for packet */
if (p->phy_freq) {
i = channel_find_index_from_freq(p->phy_freq);
}
/* if not found from pkt, best guess from config but it might be
* unknown (-1) too */
if (i < 0)
p->pkt_chan_idx = conf.channel_idx;
else
p->pkt_chan_idx = i;
/* wlan_channel is only known for beacons and probe response,
* otherwise we set it from the physical channel */
if (p->wlan_channel == 0 && p->pkt_chan_idx >= 0)
p->wlan_channel = channel_get_chan_from_idx(p->pkt_chan_idx);
/* if current channel is unknown (this is a mac80211 bug), guess it from
* the packet */
if (conf.channel_idx < 0 && p->pkt_chan_idx >= 0)
conf.channel_idx = p->pkt_chan_idx;
}
void
handle_packet(struct packet_info* p)
{
struct node_info* n = NULL;
/* filter on server side only */
if (!conf.serveraddr[0] != '\0' && filter_packet(p)) {
if (!conf.quiet && !conf.paused && !conf.debug)
update_display_clock();
return;
}
fixup_packet_channel(p);
if (cli_fd != -1)
net_send_packet(p);
if (conf.dumpfile[0] != '\0' && !conf.paused && DF != NULL)
write_to_file(p);
if (conf.paused)
return;
DEBUG("handle %s\n", get_packet_type_name(p->wlan_type));
if (!(p->phy_flags & PHY_FLAG_BADFCS)) {
/* we can't trust any fields except phy_* of packets with bad FCS,
* so we can't do all this here */
n = node_update(p);
if (n)
p->wlan_retries = n->wlan_retries_last;
p->pkt_duration = ieee80211_frame_duration(
p->phy_flags & PHY_FLAG_MODE_MASK,
p->wlan_len, p->phy_rate,
p->phy_flags & PHY_FLAG_SHORTPRE,
0 /*shortslot*/, p->wlan_type,
p->wlan_qos_class,
p->wlan_retries);
}
update_history(p);
update_statistics(p);
update_spectrum(p, n);
update_essids(p, n);
if (!conf.quiet && !conf.debug)
update_display(p);
}
static void
local_receive_packet(int fd, unsigned char* buffer, size_t bufsize)
{
int len;
struct packet_info p;
DEBUG("\n===============================================================================\n");
len = recv_packet(fd, buffer, bufsize);
#if DO_DEBUG
if (conf.debug) {
dump_packet(buffer, len);
DEBUG("\n");
}
#endif
memset(&p, 0, sizeof(p));
if (!parse_packet(buffer, len, &p)) {
DEBUG("parsing failed\n");
return;
}
handle_packet(&p);
}
static void
receive_any(const sigset_t *const waitmask)
{
int ret, mfd;
long usecs;
struct timespec ts;
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
FD_ZERO(&excpt_fds);
if (!conf.quiet && !conf.debug)
FD_SET(0, &read_fds);
FD_SET(mon, &read_fds);
if (srv_fd != -1)
FD_SET(srv_fd, &read_fds);
if (cli_fd != -1)
FD_SET(cli_fd, &read_fds);
if (ctlpipe != -1)
FD_SET(ctlpipe, &read_fds);
usecs = max(0, min(channel_get_remaining_dwell_time(), 1000000));
ts.tv_sec = usecs / 1000000;
ts.tv_nsec = usecs % 1000000 * 1000;
mfd = max(mon, srv_fd);
mfd = max(mfd, ctlpipe);
mfd = max(mfd, cli_fd) + 1;
ret = pselect(mfd, &read_fds, &write_fds, &excpt_fds, &ts, waitmask);
if (ret == -1 && errno == EINTR) /* interrupted */
return;
if (ret == 0) { /* timeout */
if (!conf.quiet && !conf.debug)
update_display_clock();
return;
}
else if (ret < 0) /* error */
err(1, "select()");
/* stdin */
if (FD_ISSET(0, &read_fds) && !conf.quiet && !conf.debug)
handle_user_input();
/* local packet or client */
if (FD_ISSET(mon, &read_fds)) {
if (conf.serveraddr[0] != '\0')
net_receive(mon, buffer, &buflen, sizeof(buffer));
else
local_receive_packet(mon, buffer, sizeof(buffer));
}
/* server */
if (srv_fd > -1 && FD_ISSET(srv_fd, &read_fds))
net_handle_server_conn();
/* from client to server */
if (cli_fd > -1 && FD_ISSET(cli_fd, &read_fds))
net_receive(cli_fd, cli_buffer, &cli_buflen, sizeof(cli_buffer));
/* named pipe */
if (ctlpipe > -1 && FD_ISSET(ctlpipe, &read_fds))
control_receive_command();
}
void
free_lists(void)
{
int i;
struct essid_info *e, *f;
struct node_info *ni, *mi;
struct chan_node *cn, *cn2;
/* free node list */
list_for_each_safe(&nodes, ni, mi, list) {
DEBUG("free node %s\n", ether_sprintf(ni->last_pkt.wlan_src));
list_del(&ni->list);
free(ni);
}
/* free essids */
list_for_each_safe(&essids.list, e, f, list) {
DEBUG("free essid '%s'\n", e->essid);
list_del(&e->list);
free(e);
}
/* free channel nodes */
for (i = 0; i < conf.num_channels; i++) {
list_for_each_safe(&spectrum[i].nodes, cn, cn2, chan_list) {
DEBUG("free chan_node %p\n", cn);
list_del(&cn->chan_list);
cn->chan->num_nodes--;
free(cn);
}
}
}
static void
finish_all(void)
{
free_lists();
if (!conf.serveraddr[0] != '\0')
close_packet_socket(mon, conf.ifname);
if (DF != NULL) {
fclose(DF);
DF = NULL;
}
if (conf.allow_control)
control_finish();
if (!conf.debug)
net_finish();
if (!conf.quiet && !conf.debug)
finish_display();
}
static void
exit_handler(void)
{
finish_all();
}
static void
sigint_handler(__attribute__((unused)) int sig)
{
/* Only set an atomic flag here to keep processing in the interrupt
* context as minimal as possible (at least all unsafe functions are
* prohibited, see signal(7)). The flag is handled in the mainloop. */
is_sigint_caught = 1;
}
static void
sigpipe_handler(__attribute__((unused)) int sig)
{
/* ignore signal here - we will handle it after write failed */
}
void
init_spectrum(void)
{
int i;
for (i = 0; i < conf.num_channels && i < MAX_CHANNELS; i++) {
list_head_init(&spectrum[i].nodes);
ewma_init(&spectrum[i].signal_avg, 1024, 8);
ewma_init(&spectrum[i].durations_avg, 1024, 8);
}
}
static void
mac_name_file_read(const char* filename) {
FILE* fp;
char line[255];
char macs[18];
char name[18];
int idx = 0;
int n;
if ((fp = fopen(filename, "r")) == NULL) {
printlog("Could not open mac name file '%s'", filename);
return;
}
while (fgets(line, sizeof(line), fp) != NULL) {
// first try dnsmasq dhcp.leases format
n = sscanf(line, "%*s %17s %*s %17s", macs, name);
if (n < 2) // if not MAC name
n = sscanf(line, "%17s %17s", macs, name);
if (n == 2) {
convert_string_to_mac(macs, node_names.entry[idx].mac);
strncpy(node_names.entry[idx].name, name, MAX_NODE_NAME_LEN);
idx++;
}
}
fclose(fp);
node_names.count = idx;
for (n = 0; n < node_names.count; n++) {
printf("MAC %s = %s\n", ether_sprintf(node_names.entry[n].mac),
node_names.entry[n].name );
}
}
const char* mac_name_lookup(const unsigned char* mac, int shorten_mac) {
int i;
if (conf.mac_name_lookup) {
for (i = 0; i < node_names.count; i++) {
if (memcmp(node_names.entry[i].mac, mac, MAC_LEN) == 0)
return node_names.entry[i].name;
}
}
return shorten_mac ? ether_sprintf_short(mac) : ether_sprintf(mac);
}
int
main(int argc, char** argv)
{
sigset_t workmask;
sigset_t waitmask;
struct sigaction sigint_action;
struct sigaction sigpipe_action;
list_head_init(&essids.list);
list_head_init(&nodes);
config_parse_file_and_cmdline(argc, argv);
sigint_action.sa_handler = sigint_handler;
sigemptyset(&sigint_action.sa_mask);
sigint_action.sa_flags = 0;
sigaction(SIGINT, &sigint_action, NULL);
sigaction(SIGTERM, &sigint_action, NULL);
sigaction(SIGHUP, &sigint_action, NULL);
sigpipe_action.sa_handler = sigpipe_handler;
sigaction(SIGPIPE, &sigpipe_action, NULL);
atexit(exit_handler);
gettimeofday(&stats.stats_time, NULL);
gettimeofday(&the_time, NULL);
conf.channel_idx = -1;
if (conf.mac_name_lookup)
mac_name_file_read(conf.mac_name_file);
if (conf.allow_control) {
printlog("Allowing control socket '%s'", conf.control_pipe);
control_init_pipe();
}
if (conf.serveraddr[0] != '\0')
mon = net_open_client_socket(conf.serveraddr, conf.port);
else {
mon = open_packet_socket(conf.ifname, conf.recv_buffer_size);
if (mon <= 0)
err(1, "Couldn't open packet socket");
conf.arphrd = device_get_hwinfo(mon, conf.ifname, conf.my_mac_addr);
if (conf.arphrd != ARPHRD_IEEE80211_PRISM &&
conf.arphrd != ARPHRD_IEEE80211_RADIOTAP) {
printf("You need to put your interface into monitor mode!\n");
printf("(e.g. 'iw %s interface add mon0 type monitor' and 'horst -i mon0')\n", conf.ifname);
exit(1);
}
channel_init();
init_spectrum();
}
if (!conf.quiet && !conf.debug)
init_display();
if (conf.serveraddr[0] == '\0' && conf.port && conf.allow_client)
net_init_server_socket(conf.port);
/* Race-free signal handling:
* 1. block all handled signals while working (with workmask)
* 2. receive signals *only* while waiting in pselect() (with waitmask)
* 3. switch between these two masks atomically with pselect()
*/
if (sigemptyset(&workmask) == -1 ||
sigaddset(&workmask, SIGINT) == -1 ||
sigaddset(&workmask, SIGHUP) == -1 ||
sigaddset(&workmask, SIGTERM) == -1 ||
sigprocmask(SIG_BLOCK, &workmask, &waitmask) == -1)
err(1, "failed to block signals: %m");
for ( /* ever */ ;;)
{
receive_any(&waitmask);
if (is_sigint_caught)
exit(1);
gettimeofday(&the_time, NULL);
timeout_nodes();
if (conf.serveraddr[0] == '\0') { /* server */
if (!conf.paused && channel_auto_change()) {
net_send_channel_config();
update_spectrum_durations();
if (!conf.quiet && !conf.debug)
update_display(NULL);
}
}
}
/* will never */
return 0;
}
void
main_pause(int pause)
{
conf.paused = pause;
printlog(conf.paused ? "- PAUSED -" : "- RESUME -");
}
void main_reset()
{
if (!conf.quiet && !conf.debug)
display_clear();
printlog("- RESET -");
free_lists();
essids.split_active = 0;
essids.split_essid = NULL;
memset(&hist, 0, sizeof(hist));
memset(&stats, 0, sizeof(stats));
memset(&spectrum, 0, sizeof(spectrum));
init_spectrum();
gettimeofday(&stats.stats_time, NULL);
}
void
dumpfile_open(const char* name)
{
if (DF != NULL) {
fclose(DF);
DF = NULL;
}
if (name == NULL || strlen(name) == 0) {
printlog("- Not writing outfile");
conf.dumpfile[0] = '\0';
return;
}
strncpy(conf.dumpfile, name, MAX_CONF_VALUE_LEN);
DF = fopen(conf.dumpfile, "w");
if (DF == NULL)
err(1, "Couldn't open dump file");
fprintf(DF, "TIME, WLAN TYPE, MAC SRC, MAC DST, BSSID, PACKET TYPES, SIGNAL, ");
fprintf(DF, "LENGTH, PHY RATE, FREQUENCY, TSF, ESSID, MODE, CHANNEL, ");
fprintf(DF, "WEP, WPA1, RSN (WPA2), IP SRC, IP DST\n");
printlog("- Writing to outfile %s", conf.dumpfile);
}
#if 0
void print_rate_duration_table(void)
{
int i;
printf("LEN\t1M l\t1M s\t2M l\t2M s\t5.5M l\t5.5M s\t11M l\t11M s\t");
printf("6M\t9\t12M\t18M\t24M\t36M\t48M\t54M\n");
for (i=10; i<=2304; i+=10) {
printf("%d:\t%d\t%d\t", i,
ieee80211_frame_duration(PHY_FLAG_G, i, 10, 0, 0, IEEE80211_FTYPE_DATA, 0, 0),
ieee80211_frame_duration(PHY_FLAG_G, i, 10, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
printf("%d\t%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 20, 0, 0, IEEE80211_FTYPE_DATA, 0, 0),
ieee80211_frame_duration(PHY_FLAG_G, i, 20, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
printf("%d\t%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 55, 0, 0, IEEE80211_FTYPE_DATA, 0, 0),
ieee80211_frame_duration(PHY_FLAG_G, i, 55, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
printf("%d\t%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 110, 0, 0, IEEE80211_FTYPE_DATA, 0, 0),
ieee80211_frame_duration(PHY_FLAG_G, i, 110, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
printf("%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 60, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
printf("%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 90, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
printf("%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 120, 1, 0, IEEE80211_FTYPE_DATA, 0, 0)),
printf("%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 180, 1, 0, IEEE80211_FTYPE_DATA, 0, 0)),
printf("%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 240, 1, 0, IEEE80211_FTYPE_DATA, 0, 0)),
printf("%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 360, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
printf("%d\t",
ieee80211_frame_duration(PHY_FLAG_G, i, 480, 1, 0, IEEE80211_FTYPE_DATA, 0, 0)),
printf("%d\n",
ieee80211_frame_duration(PHY_FLAG_G, i, 540, 1, 0, IEEE80211_FTYPE_DATA, 0, 0));
}
}
#endif