View | Details | Raw Unified | Return to bug 51002
Collapse All | Expand All

(-)display.c (+8 lines)
Lines 54-59 Link Here
54
static int l_nflag, l_eflag;
54
static int l_nflag, l_eflag;
55
static int n_entries;
55
static int n_entries;
56
static int err_pos;
56
static int err_pos;
57
extern struct t_entry t_mask;  /* traffic mask */
57
58
58
void
59
void
59
init_display(reinit)
60
init_display(reinit)
Lines 282-287 Link Here
282
	packets_total++;
284
	packets_total++;
283
	bytes_total += e->bytes;
285
	bytes_total += e->bytes;
284
	j = page * page_size;
286
	j = page * page_size;
287
288
	e->src.s_addr &= t_mask.src.s_addr;
289
	e->dst.s_addr &= t_mask.dst.s_addr;
290
	e->sport &= t_mask.sport;
291
	e->dport &= t_mask.dport;
292
	e->proto &= t_mask.proto;
293
285
	for (i = 0; i < n_entry; i++) {
294
	for (i = 0; i < n_entry; i++) {
286
		if (memcmp(&e->eh, &entries[i].eh, sizeof(e->eh)) == 0 &&
295
		if (memcmp(&e->eh, &entries[i].eh, sizeof(e->eh)) == 0 &&
287
		    e->src.s_addr == entries[i].src.s_addr &&
296
		    e->src.s_addr == entries[i].src.s_addr &&
(-)trafshow.c (-1 / +44 lines)
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;
(-)trafshow.1 (+8 lines)
Lines 42-47 Link Here
42
.B \-k
42
.B \-k
43
Disable input keyboard checking. It is intended to avoid loss of packets.
43
Disable input keyboard checking. It is intended to avoid loss of packets.
44
.TP
44
.TP
45
.B \-m
46
[src-ip M] [dst-ip M] [src-port M] [dst-port M] [proto M]
47
.br
48
Mask the specified field with mask M (which should be specified
49
as an hex number e.g. 0xffff0000) before further processing
50
of the packet. This allows to aggregate traffic in the display
51
to ease analysis.
52
.TP
45
.B \-n
53
.B \-n
46
Don't convert host addresses and port numbers to names.
54
Don't convert host addresses and port numbers to names.
47
.TP
55
.TP

Return to bug 51002