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

(-)tcpdump-fanf/VERSION (-1 / +1 lines)
Line 1 Link Here
1
3.4
1
3.4f2
(-)tcpdump-fanf/interface.h (+1 lines)
Lines 45-50 Link Here
45
extern int tflag;		/* print packet arrival time */
45
extern int tflag;		/* print packet arrival time */
46
extern int vflag;		/* verbose */
46
extern int vflag;		/* verbose */
47
extern int xflag;		/* print packet in hex */
47
extern int xflag;		/* print packet in hex */
48
extern int zflag;		/* print packet in ascii */
48
49
49
extern int packettype;		/* as specified by -T */
50
extern int packettype;		/* as specified by -T */
50
#define PT_VAT		1	/* Visual Audio Tool */
51
#define PT_VAT		1	/* Visual Audio Tool */
(-)tcpdump-fanf/print-atm.c (-1 / +3 lines)
Lines 151-162 Link Here
151
			       p[0], p[1], p[2], /* dsap/ssap/ctrl */
151
			       p[0], p[1], p[2], /* dsap/ssap/ctrl */
152
			       p[3], p[4], p[5], /* manufacturer's code */
152
			       p[3], p[4], p[5], /* manufacturer's code */
153
			       ethertype);
153
			       ethertype);
154
		if (!xflag && !qflag)
154
		if (!xflag && !qflag && !zflag)
155
		    /* default_print(p, caplen); */
155
		    /* default_print(p, caplen); */
156
		    llc_print(p-8,length+8,caplen+8,"000000","000000");
156
		    llc_print(p-8,length+8,caplen+8,"000000","000000");
157
	}
157
	}
158
	if (xflag)
158
	if (xflag)
159
		default_print(p, caplen);
159
		default_print(p, caplen);
160
	if (zflag)
161
		ascii_print(p, caplen);
160
 out:
162
 out:
161
	putchar('\n');
163
	putchar('\n');
162
}
164
}
(-)tcpdump-fanf/print-ether.c (-2 / +4 lines)
Lines 126-143 Link Here
126
				printf("(LLC %s) ",
126
				printf("(LLC %s) ",
127
			       etherproto_string(htons(extracted_ethertype)));
127
			       etherproto_string(htons(extracted_ethertype)));
128
			}
128
			}
129
			if (!xflag && !qflag)
129
			if (!xflag && !qflag && !zflag)
130
				default_print(p, caplen);
130
				default_print(p, caplen);
131
		}
131
		}
132
	} else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
132
	} else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
133
		/* ether_type not known, print raw packet */
133
		/* ether_type not known, print raw packet */
134
		if (!eflag)
134
		if (!eflag)
135
			ether_print((u_char *)ep, length + sizeof(*ep));
135
			ether_print((u_char *)ep, length + sizeof(*ep));
136
		if (!xflag && !qflag)
136
		if (!xflag && !qflag && !zflag)
137
			default_print(p, caplen);
137
			default_print(p, caplen);
138
	}
138
	}
139
	if (xflag)
139
	if (xflag)
140
		default_print(p, caplen);
140
		default_print(p, caplen);
141
	if (zflag)
142
		ascii_print(p, caplen);
141
 out:
143
 out:
142
	putchar('\n');
144
	putchar('\n');
143
}
145
}
(-)tcpdump-fanf/print-fddi.c (-2 / +4 lines)
Lines 318-324 Link Here
318
				printf("(LLC %s) ",
318
				printf("(LLC %s) ",
319
			etherproto_string(htons(extracted_ethertype)));
319
			etherproto_string(htons(extracted_ethertype)));
320
			}
320
			}
321
			if (!xflag && !qflag)
321
			if (!xflag && !qflag && !zflag)
322
				default_print(p, caplen);
322
				default_print(p, caplen);
323
		}
323
		}
324
	} else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT)
324
	} else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT)
Lines 327-337 Link Here
327
		/* Some kinds of FDDI packet we cannot handle intelligently */
327
		/* Some kinds of FDDI packet we cannot handle intelligently */
328
		if (!eflag)
328
		if (!eflag)
329
			fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
329
			fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
330
		if (!xflag && !qflag)
330
		if (!xflag && !qflag && !zflag)
331
			default_print(p, caplen);
331
			default_print(p, caplen);
332
	}
332
	}
333
	if (xflag)
333
	if (xflag)
334
		default_print(p, caplen);
334
		default_print(p, caplen);
335
	if (zflag)
336
		ascii_print(p, caplen);
335
out:
337
out:
336
	putchar('\n');
338
	putchar('\n');
337
}
339
}
(-)tcpdump-fanf/print-fr.c (-1 / +4 lines)
Lines 240-252 Link Here
240
	default:
240
	default:
241
		if(!eflag)
241
		if(!eflag)
242
			fr_hdlc_print(p, length);
242
			fr_hdlc_print(p, length);
243
		if(!xflag)
243
		if(!xflag && !zflag)
244
			default_print((const u_char *)(p + LAYER2_LEN(p)),
244
			default_print((const u_char *)(p + LAYER2_LEN(p)),
245
					caplen - LAYER2_LEN(p));
245
					caplen - LAYER2_LEN(p));
246
	}
246
	}
247
247
248
	if (xflag)
248
	if (xflag)
249
		default_print((const u_char *)(p + LAYER2_LEN(p)),
249
		default_print((const u_char *)(p + LAYER2_LEN(p)),
250
				caplen - LAYER2_LEN(p));
251
	if (zflag)
252
		ascii_print((const u_char *)(p + LAYER2_LEN(p)),
250
				caplen - LAYER2_LEN(p));
253
				caplen - LAYER2_LEN(p));
251
out:
254
out:
252
	putchar('\n');
255
	putchar('\n');
(-)tcpdump-fanf/print-null.c (+2 lines)
Lines 118-123 Link Here
118
118
119
	if (xflag)
119
	if (xflag)
120
		default_print((const u_char *)ip, caplen - NULL_HDRLEN);
120
		default_print((const u_char *)ip, caplen - NULL_HDRLEN);
121
	if (zflag)
122
		ascii_print((const u_char *)ip, caplen - NULL_HDRLEN);
121
	putchar('\n');
123
	putchar('\n');
122
}
124
}
123
125
(-)tcpdump-fanf/print-ppp.c (-1 / +6 lines)
Lines 521-527 Link Here
521
	default:
521
	default:
522
		if(!eflag)
522
		if(!eflag)
523
			ppp_hdlc_print(p, length);
523
			ppp_hdlc_print(p, length);
524
		if(!xflag)
524
		if(!xflag && !zflag)
525
			default_print((const u_char *)(p + PPP_HDRLEN),
525
			default_print((const u_char *)(p + PPP_HDRLEN),
526
					caplen - PPP_HDRLEN);
526
					caplen - PPP_HDRLEN);
527
	}
527
	}
Lines 529-534 Link Here
529
	if (xflag)
529
	if (xflag)
530
		default_print((const u_char *)(p + PPP_HDRLEN),
530
		default_print((const u_char *)(p + PPP_HDRLEN),
531
				caplen - PPP_HDRLEN);
531
				caplen - PPP_HDRLEN);
532
	if (zflag)
533
		ascii_print((const u_char *)(p + PPP_HDRLEN),
534
				caplen - PPP_HDRLEN);
532
out:
535
out:
533
	putchar('\n');
536
	putchar('\n');
534
}
537
}
Lines 606-611 Link Here
606
609
607
	if (xflag)
610
	if (xflag)
608
		default_print((const u_char *)p, caplen - hdrlength);
611
		default_print((const u_char *)p, caplen - hdrlength);
612
	if (zflag)
613
		ascii_print((const u_char *)p, caplen - hdrlength);
609
out:
614
out:
610
	putchar('\n');
615
	putchar('\n');
611
}
616
}
(-)tcpdump-fanf/print-raw.c (+2 lines)
Lines 84-88 Link Here
84
84
85
	if (xflag)
85
	if (xflag)
86
		default_print(p, caplen);
86
		default_print(p, caplen);
87
	if (zflag)
88
		ascii_print(p, caplen);
87
	putchar('\n');
89
	putchar('\n');
88
}
90
}
(-)tcpdump-fanf/print-sl.c (+4 lines)
Lines 108-113 Link Here
108
108
109
	if (xflag)
109
	if (xflag)
110
		default_print((u_char *)ip, caplen - SLIP_HDRLEN);
110
		default_print((u_char *)ip, caplen - SLIP_HDRLEN);
111
	if (zflag)
112
		ascii_print((u_char *)ip, caplen - SLIP_HDRLEN);
111
 out:
113
 out:
112
	putchar('\n');
114
	putchar('\n');
113
}
115
}
Lines 147-152 Link Here
147
149
148
	if (xflag)
150
	if (xflag)
149
		default_print((u_char *)ip, caplen - SLIP_HDRLEN);
151
		default_print((u_char *)ip, caplen - SLIP_HDRLEN);
152
	if (zflag)
153
		ascii_print((u_char *)ip, caplen - SLIP_HDRLEN);
150
 out:
154
 out:
151
	putchar('\n');
155
	putchar('\n');
152
}
156
}
(-)tcpdump-fanf/print-token.c (-1 / +3 lines)
Lines 155-165 Link Here
155
			printf("(LLC %s) ",
155
			printf("(LLC %s) ",
156
		       etherproto_string(htons(extracted_ethertype)));
156
		       etherproto_string(htons(extracted_ethertype)));
157
		}
157
		}
158
		if (!xflag && !qflag)
158
		if (!xflag && !qflag && !zflag)
159
			default_print(p, caplen);
159
			default_print(p, caplen);
160
	}
160
	}
161
	if (xflag)
161
	if (xflag)
162
		default_print(p, caplen);
162
		default_print(p, caplen);
163
	if (zflag)
164
		ascii_print(p, caplen);
163
 out:
165
 out:
164
	putchar('\n');
166
	putchar('\n');
165
}
167
}
(-)tcpdump-fanf/tcpdump.1 (+6 lines)
Lines 215-220 Link Here
215
The smaller of the entire packet or
215
The smaller of the entire packet or
216
.I snaplen
216
.I snaplen
217
bytes will be printed.
217
bytes will be printed.
218
.TP
219
.B \-z
220
Print each packet (minus its link level header) in ascii.
221
The smaller of the entire packet or
222
.I snaplen
223
bytes will be printed.
218
.IP "\fI expression\fP"
224
.IP "\fI expression\fP"
219
.RS
225
.RS
220
selects which packets will be dumped.  If no \fIexpression\fP
226
selects which packets will be dumped.  If no \fIexpression\fP
(-)tcpdump-fanf/tcpdump.c (-1 / +42 lines)
Lines 46-51 Link Here
46
#include <stdlib.h>
46
#include <stdlib.h>
47
#include <string.h>
47
#include <string.h>
48
#include <unistd.h>
48
#include <unistd.h>
49
#include <ctype.h>
49
50
50
#include "interface.h"
51
#include "interface.h"
51
#include "addrtoname.h"
52
#include "addrtoname.h"
Lines 66-71 Link Here
66
int tflag = 1;			/* print packet arrival time */
67
int tflag = 1;			/* print packet arrival time */
67
int vflag;			/* verbose */
68
int vflag;			/* verbose */
68
int xflag;			/* print packet in hex */
69
int xflag;			/* print packet in hex */
70
int zflag;			/* print packet in ascii */
69
71
70
int packettype;
72
int packettype;
71
73
Lines 149-155 Link Here
149
151
150
	opterr = 0;
152
	opterr = 0;
151
	while (
153
	while (
152
	    (op = getopt(argc, argv, "ac:defF:i:lnNOpqr:s:StT:vw:xY")) != EOF)
154
	    (op = getopt(argc, argv, "ac:defF:i:lnNOpqr:s:StT:vw:xYz")) != EOF)
153
		switch (op) {
155
		switch (op) {
154
156
155
		case 'a':
157
		case 'a':
Lines 263-268 Link Here
263
			++xflag;
265
			++xflag;
264
			break;
266
			break;
265
267
268
		case 'z':
269
			++zflag;
270
			break;
271
266
		default:
272
		default:
267
			usage();
273
			usage();
268
			/* NOTREACHED */
274
			/* NOTREACHED */
Lines 408-413 Link Here
408
 *
414
 *
409
 * (BTW, please don't send us patches to print the packet out in ascii)
415
 * (BTW, please don't send us patches to print the packet out in ascii)
410
 */
416
 */
417
/*
418
 * The developers of tcpdump are fascist bastards.
419
 * (And fuckwits, too. (void)printf("foo")? Bunch of arse.
420
 * They should be writing if (printf("foo") < 0)
421
 * { perror("stdout"); exit(EXIT_FAILURE); }
422
 */
411
void
423
void
412
default_print(register const u_char *bp, register u_int length)
424
default_print(register const u_char *bp, register u_int length)
413
{
425
{
Lines 432-437 Link Here
432
			(void)printf("\n\t\t\t");
444
			(void)printf("\n\t\t\t");
433
		(void)printf(" %02x", *(u_char *)sp);
445
		(void)printf(" %02x", *(u_char *)sp);
434
	}
446
	}
447
}
448
449
/*
450
 * print the packet out in ascii
451
 */
452
void
453
ascii_print(register const u_char *bp, register int length)
454
{
455
	register u_int i, j;
456
457
	for (i = 0; i < length; i += 16, bp += 16) {
458
		fputs("\n ", stdout);
459
		for (j = 0; j < 16; j++) {
460
			if (i + j < length)
461
				printf(" %02X", bp[j]);
462
			else
463
				printf("   ");
464
			if (j % 4 == 3)
465
				fputs("  ", stdout);
466
		}
467
		fputs("  ", stdout);
468
		for (j = 0; j < 16; j++) {
469
			if (i + j < length)
470
				putchar(isprint(bp[j]) ? bp[j] : '.');
471
			if (j % 4 == 3)
472
				putchar(' ');
473
		}
474
	}
475
	putchar('\n');
435
}
476
}
436
477
437
__dead void
478
__dead void

Return to bug 13781