Skip to content

Commit 4189fb7

Browse files
author
mcr
committed
refactored ip_print() so that chained header parser (ESP/AH) can
more easily call the inner parts.
1 parent 82b1d07 commit 4189fb7

20 files changed

+352
-236
lines changed

print-arcnet.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
#ifndef lint
2424
static const char rcsid[] _U_ =
25-
"@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.19 2004-04-30 16:42:14 mcr Exp $ (LBL)";
25+
"@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.20 2005-04-06 21:32:38 mcr Exp $ (LBL)";
2626
#endif
2727

2828
#ifdef HAVE_CONFIG_H
@@ -259,7 +259,7 @@ arcnet_encap_print(u_char arctype, const u_char *p,
259259

260260
case ARCTYPE_IP_OLD:
261261
case ARCTYPE_IP:
262-
ip_print(p, length);
262+
ip_print(gndo, p, length);
263263
return (1);
264264

265265
#ifdef INET6

print-chdlc.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#ifndef lint
2323
static const char rcsid[] _U_ =
24-
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.31 2004-03-24 00:45:39 guy Exp $ (LBL)";
24+
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32 2005-04-06 21:32:38 mcr Exp $ (LBL)";
2525
#endif
2626

2727
#ifdef HAVE_CONFIG_H
@@ -76,7 +76,7 @@ chdlc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
7676
ip = (const struct ip *)(p + CHDLC_HDRLEN);
7777
switch (proto) {
7878
case ETHERTYPE_IP:
79-
ip_print((const u_char *)ip, length);
79+
ip_print(gndo, (const u_char *)ip, length);
8080
break;
8181
#ifdef INET6
8282
case ETHERTYPE_IPV6:
@@ -182,3 +182,11 @@ chdlc_slarp_print(const u_char *cp, u_int length)
182182
trunc:
183183
printf("[|slarp]");
184184
}
185+
186+
187+
/*
188+
* Local Variables:
189+
* c-style: whitesmith
190+
* c-basic-offset: 8
191+
* End:
192+
*/

print-cip.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#ifndef lint
2424
static const char rcsid[] _U_ =
25-
"@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.24 2004-03-17 23:24:36 guy Exp $ (LBL)";
25+
"@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.25 2005-04-06 21:32:39 mcr Exp $ (LBL)";
2626
#endif
2727

2828
#ifdef HAVE_CONFIG_H
@@ -101,8 +101,16 @@ cip_if_print(const struct pcap_pkthdr *h, const u_char *p)
101101
/*
102102
* LLC header is absent; treat it as just IP.
103103
*/
104-
ip_print(p, length);
104+
ip_print(gndo, p, length);
105105
}
106106

107107
return (0);
108108
}
109+
110+
111+
/*
112+
* Local Variables:
113+
* c-style: whitesmith
114+
* c-basic-offset: 8
115+
* End:
116+
*/

print-enc.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#ifndef lint
2525
static const char rcsid[] _U_ =
26-
"@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.3 2003-11-16 09:36:20 guy Exp $ (LBL)";
26+
"@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.4 2005-04-06 21:32:39 mcr Exp $ (LBL)";
2727
#endif
2828

2929
#ifdef HAVE_CONFIG_H
@@ -71,8 +71,16 @@ enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
7171

7272
length -= ENC_HDRLEN;
7373
/* XXX - use the address family */
74-
ip_print(p + ENC_HDRLEN, length);
74+
ip_print(gndo, p + ENC_HDRLEN, length);
7575

7676
out:
7777
return (ENC_HDRLEN);
7878
}
79+
80+
81+
/*
82+
* Local Variables:
83+
* c-style: whitesmith
84+
* c-basic-offset: 8
85+
* End:
86+
*/

print-ether.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
#ifndef lint
2222
static const char rcsid[] _U_ =
23-
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.94 2005-01-25 16:22:56 hannes Exp $ (LBL)";
23+
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95 2005-04-06 21:32:39 mcr Exp $ (LBL)";
2424
#endif
2525

2626
#ifdef HAVE_CONFIG_H
@@ -202,7 +202,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
202202
switch (ether_type) {
203203

204204
case ETHERTYPE_IP:
205-
ip_print(p, length);
205+
ip_print(gndo, p, length);
206206
return (1);
207207

208208
#ifdef INET6
@@ -329,9 +329,11 @@ ether_encap_print(u_short ether_type, const u_char *p,
329329
}
330330
}
331331

332+
332333
/*
333334
* Local Variables:
334-
* c-style: bsd
335+
* c-style: whitesmith
336+
* c-basic-offset: 8
335337
* End:
336338
*/
337339

print-fr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#ifndef lint
2323
static const char rcsid[] _U_ =
24-
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.31 2005-04-06 20:09:08 hannes Exp $ (LBL)";
24+
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32 2005-04-06 21:32:39 mcr Exp $ (LBL)";
2525
#endif
2626

2727
#ifdef HAVE_CONFIG_H
@@ -253,7 +253,7 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
253253

254254
switch (nlpid) {
255255
case NLPID_IP:
256-
ip_print(p, length);
256+
ip_print(gndo, p, length);
257257
break;
258258

259259
#ifdef INET6

print-gre.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#ifndef lint
4040
static const char rcsid[] _U_ =
41-
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.27 2004-07-02 06:39:11 hannes Exp $ (LBL)";
41+
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.28 2005-04-06 21:32:39 mcr Exp $ (LBL)";
4242
#endif
4343

4444
#ifdef HAVE_CONFIG_H
@@ -206,7 +206,7 @@ gre_print_0(const u_char *bp, u_int length)
206206

207207
switch (prot) {
208208
case ETHERTYPE_IP:
209-
ip_print(bp, len);
209+
ip_print(gndo, bp, len);
210210
break;
211211
#ifdef INET6
212212
case ETHERTYPE_IPV6:

print-icmp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#ifndef lint
2323
static const char rcsid[] _U_ =
24-
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.80 2004-12-23 10:51:47 guy Exp $ (LBL)";
24+
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81 2005-04-06 21:32:40 mcr Exp $ (LBL)";
2525
#endif
2626

2727
#ifdef HAVE_CONFIG_H
@@ -527,7 +527,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
527527
(void)printf("\n\t");
528528
ip = (struct ip *)bp;
529529
snaplen = snapend - bp;
530-
ip_print(bp, EXTRACT_16BITS(&ip->ip_len));
530+
ip_print(gndo, bp, EXTRACT_16BITS(&ip->ip_len));
531531
}
532532

533533
if (vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(dp->icmp_type)) {

0 commit comments

Comments
 (0)