Lines 48-53
Link Here
|
48 |
int pflag = 0; /* don't put the interface into promiscuous mode */ |
48 |
int pflag = 0; /* don't put the interface into promiscuous mode */ |
49 |
int kflag = 1; /* disable keyboard input checking */ |
49 |
int kflag = 1; /* disable keyboard input checking */ |
50 |
int eflag = 0; /* show ethernet traffic rather than ip */ |
50 |
int eflag = 0; /* show ethernet traffic rather than ip */ |
|
|
51 |
struct t_entry t_mask; /* traffic mask */ |
51 |
|
52 |
|
52 |
/* global variables */ |
53 |
/* global variables */ |
53 |
char *program_name; /* myself */ |
54 |
char *program_name; /* myself */ |
Lines 78-83
Link Here
|
78 |
extern int abort_on_misalignment(); |
79 |
extern int abort_on_misalignment(); |
79 |
extern pcap_handler lookup_if(); |
80 |
extern pcap_handler lookup_if(); |
80 |
|
81 |
|
|
|
82 |
t_mask.src.s_addr = 0xffffffff; /* all bits valid */ |
83 |
t_mask.dst.s_addr = 0xffffffff; /* all bits valid */ |
84 |
t_mask.sport = 0xffff; /* all bits valid */ |
85 |
t_mask.dport = 0xffff; /* all bits valid */ |
86 |
t_mask.proto = 0xffff; /* all bits valid */ |
87 |
|
81 |
cnt = -1; |
88 |
cnt = -1; |
82 |
device_name = NULL; |
89 |
device_name = NULL; |
83 |
infile = NULL; |
90 |
infile = NULL; |
Lines 94-100
Link Here
|
94 |
|
87 |
|
95 |
if (abort_on_misalignment(ebuf) < 0) error(0, ebuf); |
88 |
if (abort_on_misalignment(ebuf) < 0) error(0, ebuf); |
96 |
|
89 |
|
97 |
while ((op = getopt(argc, argv, "c:CefF:i:knNOpr:t:vh?")) != EOF) |
90 |
while ((op = getopt(argc, argv, "c:CefF:i:kmnNOpr:t:vh?")) != EOF) |
98 |
switch (op) { |
91 |
switch (op) { |
99 |
case 'C': |
92 |
case 'C': |
100 |
#ifdef HAVE_SLCURSES |
93 |
#ifdef HAVE_SLCURSES |
Lines 114-119
Link Here
|
114 |
break; |
121 |
break; |
115 |
case 'k': |
122 |
case 'k': |
116 |
kflag = 0; |
123 |
kflag = 0; |
|
|
124 |
break; |
125 |
case 'm': |
126 |
fprintf(stderr, "option m %d %d\n", optind, argc); |
127 |
t_mask.src.s_addr = 0; |
128 |
t_mask.dst.s_addr = 0; |
129 |
t_mask.sport = 0; |
130 |
t_mask.dport = 0; |
131 |
t_mask.proto = 0; |
132 |
for (;optind + 1 <= argc;) { |
133 |
char *s = argv[optind]; |
134 |
u_int32_t arg = 0xffffffff; |
135 |
int save=optind; |
136 |
|
137 |
optind++; |
138 |
if (optind + 1 <= argc && |
139 |
isdigit(*(argv[optind])) ) { |
140 |
arg = strtol(argv[optind], NULL, 0); |
141 |
optind++; |
142 |
} |
143 |
fprintf(stderr, "-m %s 0x%x\n", s, arg); |
144 |
|
145 |
if (!strcmp(s, "src-ip")) |
146 |
t_mask.src.s_addr = arg; |
147 |
else if (!strcmp(s, "dst-ip")) |
148 |
t_mask.dst.s_addr = arg; |
149 |
else if (!strcmp(s, "src-port")) |
150 |
t_mask.sport = (u_short)(arg); |
151 |
else if (!strcmp(s, "dst-port")) |
152 |
t_mask.dport = (u_short)(arg); |
153 |
else if (!strcmp(s, "proto")) |
154 |
t_mask.proto = arg; |
155 |
else { |
156 |
optind = save; |
157 |
break; |
158 |
} |
159 |
} |
117 |
break; |
160 |
break; |
118 |
case 'n': |
161 |
case 'n': |
119 |
++nflag; |
162 |
++nflag; |