From: mcr Date: Wed, 6 Apr 2005 21:32:38 +0000 (+0000) Subject: refactored ip_print() so that chained header parser (ESP/AH) can X-Git-Tag: tcpdump-3.9.1~169 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/4189fb7df651e5742b15488d2f59dae5f526e82b refactored ip_print() so that chained header parser (ESP/AH) can more easily call the inner parts. --- diff --git a/print-arcnet.c b/print-arcnet.c index 1515d2d6..48a43030 100644 --- a/print-arcnet.c +++ b/print-arcnet.c @@ -22,7 +22,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.19 2004-04-30 16:42:14 mcr Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.20 2005-04-06 21:32:38 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -259,7 +259,7 @@ arcnet_encap_print(u_char arctype, const u_char *p, case ARCTYPE_IP_OLD: case ARCTYPE_IP: - ip_print(p, length); + ip_print(gndo, p, length); return (1); #ifdef INET6 diff --git a/print-chdlc.c b/print-chdlc.c index ec5855a2..41d94141 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.31 2004-03-24 00:45:39 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32 2005-04-06 21:32:38 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -76,7 +76,7 @@ chdlc_if_print(const struct pcap_pkthdr *h, register const u_char *p) ip = (const struct ip *)(p + CHDLC_HDRLEN); switch (proto) { case ETHERTYPE_IP: - ip_print((const u_char *)ip, length); + ip_print(gndo, (const u_char *)ip, length); break; #ifdef INET6 case ETHERTYPE_IPV6: @@ -182,3 +182,11 @@ chdlc_slarp_print(const u_char *cp, u_int length) trunc: printf("[|slarp]"); } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-cip.c b/print-cip.c index d7dd85af..3a7d33a5 100644 --- a/print-cip.c +++ b/print-cip.c @@ -22,7 +22,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.24 2004-03-17 23:24:36 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.25 2005-04-06 21:32:39 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -101,8 +101,16 @@ cip_if_print(const struct pcap_pkthdr *h, const u_char *p) /* * LLC header is absent; treat it as just IP. */ - ip_print(p, length); + ip_print(gndo, p, length); } return (0); } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-enc.c b/print-enc.c index e3c2ad73..605ca33d 100644 --- a/print-enc.c +++ b/print-enc.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.3 2003-11-16 09:36:20 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.4 2005-04-06 21:32:39 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -71,8 +71,16 @@ enc_if_print(const struct pcap_pkthdr *h, register const u_char *p) length -= ENC_HDRLEN; /* XXX - use the address family */ - ip_print(p + ENC_HDRLEN, length); + ip_print(gndo, p + ENC_HDRLEN, length); out: return (ENC_HDRLEN); } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-ether.c b/print-ether.c index 0df63fd5..a12e7b05 100644 --- a/print-ether.c +++ b/print-ether.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.94 2005-01-25 16:22:56 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95 2005-04-06 21:32:39 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -202,7 +202,7 @@ ether_encap_print(u_short ether_type, const u_char *p, switch (ether_type) { case ETHERTYPE_IP: - ip_print(p, length); + ip_print(gndo, p, length); return (1); #ifdef INET6 @@ -329,9 +329,11 @@ ether_encap_print(u_short ether_type, const u_char *p, } } + /* * Local Variables: - * c-style: bsd + * c-style: whitesmith + * c-basic-offset: 8 * End: */ diff --git a/print-fr.c b/print-fr.c index b0ffab99..d1825354 100644 --- a/print-fr.c +++ b/print-fr.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.31 2005-04-06 20:09:08 hannes Exp $ (LBL)"; + "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32 2005-04-06 21:32:39 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -253,7 +253,7 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p) switch (nlpid) { case NLPID_IP: - ip_print(p, length); + ip_print(gndo, p, length); break; #ifdef INET6 diff --git a/print-gre.c b/print-gre.c index ed4c957b..55f0e9d1 100644 --- a/print-gre.c +++ b/print-gre.c @@ -38,7 +38,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.27 2004-07-02 06:39:11 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.28 2005-04-06 21:32:39 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -206,7 +206,7 @@ gre_print_0(const u_char *bp, u_int length) switch (prot) { case ETHERTYPE_IP: - ip_print(bp, len); + ip_print(gndo, bp, len); break; #ifdef INET6 case ETHERTYPE_IPV6: diff --git a/print-icmp.c b/print-icmp.c index 22882460..862b095a 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.80 2004-12-23 10:51:47 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81 2005-04-06 21:32:40 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -527,7 +527,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented) (void)printf("\n\t"); ip = (struct ip *)bp; snaplen = snapend - bp; - ip_print(bp, EXTRACT_16BITS(&ip->ip_len)); + ip_print(gndo, bp, EXTRACT_16BITS(&ip->ip_len)); } if (vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(dp->icmp_type)) { diff --git a/print-ip.c b/print-ip.c index b05088d3..84465326 100644 --- a/print-ip.c +++ b/print-ip.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.147 2005-01-21 08:02:06 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.148 2005-04-06 21:33:02 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -356,31 +356,187 @@ static struct tok ip_frag_values[] = { { 0, NULL } }; +struct ip_print_demux_state { + const struct ip *ip; + const u_char *cp; + u_int hlen, len, off; + u_char nh; + int advance; +}; + +static void +ip_print_demux(netdissect_options *ndo, + struct ip_print_demux_state *ipds) +{ + struct protoent *proto; + +again: + switch (ipds->nh) { + + case IPPROTO_AH: + ipds->nh = *ipds->cp; + ipds->advance = ah_print(ipds->cp); + if (ipds->advance <= 0) + break; + ipds->cp += ipds->advance; + ipds->len -= ipds->advance; + goto again; + + case IPPROTO_ESP: + { + int enh, padlen; + ipds->advance = esp_print(ndo, ipds->cp, ipds->len, + (const u_char *)ipds->ip, + &enh, &padlen); + if (ipds->advance <= 0) + break; + ipds->cp += ipds->advance; + ipds->len -= ipds->advance + padlen; + ipds->nh = enh & 0xff; + goto again; + } + + case IPPROTO_IPCOMP: + { + int enh; + ipds->advance = ipcomp_print(ipds->cp, &enh); + if (ipds->advance <= 0) + break; + ipds->cp += ipds->advance; + ipds->len -= ipds->advance; + ipds->nh = enh & 0xff; + goto again; + } + + case IPPROTO_SCTP: + sctp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len); + break; + + case IPPROTO_TCP: + tcp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip, + (ipds->off &~ 0x6000)); + break; + + case IPPROTO_UDP: + udp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip, + (ipds->off &~ 0x6000)); + break; + + case IPPROTO_ICMP: + /* pass on the MF bit plus the offset to detect fragments */ + icmp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip, + (ipds->off & 0x3fff)); + break; + + case IPPROTO_PIGP: + /* + * XXX - the current IANA protocol number assignments + * page lists 9 as "any private interior gateway + * (used by Cisco for their IGRP)" and 88 as + * "EIGRP" from Cisco. + * + * Recent BSD headers define + * IP_PROTO_PIGP as 9 and IP_PROTO_IGRP as 88. + * We define IP_PROTO_PIGP as 9 and + * IP_PROTO_EIGRP as 88; those names better + * match was the current protocol number + * assignments say. + */ + igrp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip); + break; + + case IPPROTO_EIGRP: + eigrp_print(ipds->cp, ipds->len); + break; + + case IPPROTO_ND: + ND_PRINT((ndo, " nd %d", ipds->len)); + break; + + case IPPROTO_EGP: + egp_print(ipds->cp, ipds->len); + break; + + case IPPROTO_OSPF: + ospf_print(ipds->cp, ipds->len, (const u_char *)ipds->ip); + break; + + case IPPROTO_IGMP: + igmp_print(ipds->cp, ipds->len); + break; + + case IPPROTO_IPV4: + /* DVMRP multicast tunnel (ip-in-ip encapsulation) */ + ip_print(gndo, ipds->cp, ipds->len); + if (! vflag) { + ND_PRINT((ndo, " (ipip-proto-4)")); + return; + } + break; + +#ifdef INET6 + case IPPROTO_IPV6: + /* ip6-in-ip encapsulation */ + ip6_print(ipds->cp, ipds->len); + break; +#endif /*INET6*/ + + case IPPROTO_RSVP: + rsvp_print(ipds->cp, ipds->len); + break; + + case IPPROTO_GRE: + /* do it */ + gre_print(ipds->cp, ipds->len); + break; + + case IPPROTO_MOBILE: + mobile_print(ipds->cp, ipds->len); + break; + + case IPPROTO_PIM: + pim_print(ipds->cp, ipds->len); + break; + + case IPPROTO_VRRP: + vrrp_print(ipds->cp, ipds->len, ipds->ip->ip_ttl); + break; + + default: + if ((proto = getprotobynumber(ipds->nh)) != NULL) + ND_PRINT((ndo, " %s", proto->p_name)); + else + ND_PRINT((ndo, " ip-proto-%d", ipds->nh)); + ND_PRINT((ndo, " %d", ipds->len)); + break; + } +} + + /* * print an IP datagram. */ void -ip_print(register const u_char *bp, register u_int length) +ip_print(netdissect_options *ndo, + const u_char *bp, + u_int length) { - register const struct ip *ip; - register u_int hlen, len, off; + struct ip_print_demux_state ipd; + struct ip_print_demux_state *ipds=&ipd; const u_char *ipend; - register const u_char *cp; - u_char nh; - int advance; - struct protoent *proto; u_int16_t sum, ip_sum; + struct protoent *proto; - ip = (const struct ip *)bp; - if (IP_V(ip) != 4) { /* print version if != 4 */ - printf("IP%u ", IP_V(ip)); - if (IP_V(ip) == 6) + ipds->ip = (const struct ip *)bp; + if (IP_V(ipds->ip) != 4) { /* print version if != 4 */ + printf("IP%u ", IP_V(ipds->ip)); + if (IP_V(ipds->ip) == 6) printf(", wrong link-layer encapsulation"); } else if (!eflag) printf("IP "); - if ((u_char *)(ip + 1) > snapend) { + if ((u_char *)(ipds->ip + 1) > snapend) { printf("[|ip]"); return; } @@ -388,28 +544,28 @@ ip_print(register const u_char *bp, register u_int length) (void)printf("truncated-ip %u", length); return; } - hlen = IP_HL(ip) * 4; - if (hlen < sizeof (struct ip)) { - (void)printf("bad-hlen %u", hlen); + ipds->hlen = IP_HL(ipds->ip) * 4; + if (ipds->hlen < sizeof (struct ip)) { + (void)printf("bad-hlen %u", ipds->hlen); return; } - len = EXTRACT_16BITS(&ip->ip_len); - if (length < len) + ipds->len = EXTRACT_16BITS(&ipds->ip->ip_len); + if (length < ipds->len) (void)printf("truncated-ip - %u bytes missing! ", - len - length); - if (len < hlen) { + ipds->len - length); + if (ipds->len < ipds->hlen) { #ifdef GUESS_TSO - if (len) { - (void)printf("bad-len %u", len); + if (ipds->len) { + (void)printf("bad-len %u", ipds->len); return; } else { /* we guess that it is a TSO send */ - len = length; + ipds->len = length; } #else - (void)printf("bad-len %u", len); + (void)printf("bad-len %u", ipds->len); return; #endif /* GUESS_TSO */ } @@ -417,19 +573,19 @@ ip_print(register const u_char *bp, register u_int length) /* * Cut off the snapshot length to the end of the IP payload. */ - ipend = bp + len; + ipend = bp + ipds->len; if (ipend < snapend) snapend = ipend; - len -= hlen; + ipds->len -= ipds->hlen; - off = EXTRACT_16BITS(&ip->ip_off); + ipds->off = EXTRACT_16BITS(&ipds->ip->ip_off); if (vflag) { - (void)printf("(tos 0x%x", (int)ip->ip_tos); + (void)printf("(tos 0x%x", (int)ipds->ip->ip_tos); /* ECN bits */ - if (ip->ip_tos & 0x03) { - switch (ip->ip_tos & 0x03) { + if (ipds->ip->ip_tos & 0x03) { + switch (ipds->ip->ip_tos & 0x03) { case 1: (void)printf(",ECT(1)"); break; @@ -441,8 +597,8 @@ ip_print(register const u_char *bp, register u_int length) } } - if (ip->ip_ttl >= 1) - (void)printf(", ttl %3u", ip->ip_ttl); + if (ipds->ip->ip_ttl >= 1) + (void)printf(", ttl %3u", ipds->ip->ip_ttl); /* * for the firewall guys, print id, offset. @@ -451,24 +607,24 @@ ip_print(register const u_char *bp, register u_int length) */ (void)printf(", id %u, offset %u, flags [%s], proto: %s (%u)", - EXTRACT_16BITS(&ip->ip_id), - (off & 0x1fff) * 8, - bittok2str(ip_frag_values, "none", off & 0xe000 ), - tok2str(ipproto_values,"unknown",ip->ip_p), - ip->ip_p); + EXTRACT_16BITS(&ipds->ip->ip_id), + (ipds->off & 0x1fff) * 8, + bittok2str(ip_frag_values, "none", ipds->off&0xe000 ), + tok2str(ipproto_values,"unknown",ipds->ip->ip_p), + ipds->ip->ip_p); - (void)printf(", length: %u", EXTRACT_16BITS(&ip->ip_len)); + (void)printf(", length: %u", EXTRACT_16BITS(&ipds->ip->ip_len)); - if ((hlen - sizeof(struct ip)) > 0) { + if ((ipds->hlen - sizeof(struct ip)) > 0) { printf(", options ( "); - ip_optprint((u_char *)(ip + 1), hlen - sizeof(struct ip)); + ip_optprint((u_char *)(ipds->ip + 1), ipds->hlen - sizeof(struct ip)); printf(" )"); } - if ((u_char *)ip + hlen <= snapend) { - sum = in_cksum((const u_short *)ip, hlen, 0); + if ((u_char *)ipds->ip + ipds->hlen <= snapend) { + sum = in_cksum((const u_short *)ipds->ip, ipds->hlen, 0); if (sum != 0) { - ip_sum = EXTRACT_16BITS(&ip->ip_sum); + ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum); (void)printf(", bad cksum %x (->%x)!", ip_sum, in_cksum_shouldbe(ip_sum, sum)); } @@ -481,150 +637,17 @@ ip_print(register const u_char *bp, register u_int length) * If this is fragment zero, hand it to the next higher * level protocol. */ - if ((off & 0x1fff) == 0) { - cp = (const u_char *)ip + hlen; - nh = ip->ip_p; - - if (nh != IPPROTO_TCP && nh != IPPROTO_UDP && - nh != IPPROTO_SCTP) { - (void)printf("%s > %s: ", ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); - } -again: - switch (nh) { - - case IPPROTO_AH: - nh = *cp; - advance = ah_print(cp); - if (advance <= 0) - break; - cp += advance; - len -= advance; - goto again; - - case IPPROTO_ESP: - { - int enh, padlen; - advance = esp_print(gndo, cp, len, (const u_char *)ip, &enh, &padlen); - if (advance <= 0) - break; - cp += advance; - len -= advance + padlen; - nh = enh & 0xff; - goto again; - } - - case IPPROTO_IPCOMP: - { - int enh; - advance = ipcomp_print(cp, &enh); - if (advance <= 0) - break; - cp += advance; - len -= advance; - nh = enh & 0xff; - goto again; - } - - case IPPROTO_SCTP: - sctp_print(cp, (const u_char *)ip, len); - break; - - case IPPROTO_TCP: - tcp_print(cp, len, (const u_char *)ip, (off &~ 0x6000)); - break; - - case IPPROTO_UDP: - udp_print(cp, len, (const u_char *)ip, (off &~ 0x6000)); - break; - - case IPPROTO_ICMP: - /* pass on the MF bit plus the offset to detect fragments */ - icmp_print(cp, len, (const u_char *)ip, (off & 0x3fff)); - break; - - case IPPROTO_PIGP: - /* - * XXX - the current IANA protocol number assignments - * page lists 9 as "any private interior gateway - * (used by Cisco for their IGRP)" and 88 as - * "EIGRP" from Cisco. - * - * Recent BSD headers define - * IP_PROTO_PIGP as 9 and IP_PROTO_IGRP as 88. - * We define IP_PROTO_PIGP as 9 and - * IP_PROTO_EIGRP as 88; those names better - * match was the current protocol number - * assignments say. - */ - igrp_print(cp, len, (const u_char *)ip); - break; - - case IPPROTO_EIGRP: - eigrp_print(cp, len); - break; - - case IPPROTO_ND: - (void)printf(" nd %d", len); - break; - - case IPPROTO_EGP: - egp_print(cp, len); - break; - - case IPPROTO_OSPF: - ospf_print(cp, len, (const u_char *)ip); - break; - - case IPPROTO_IGMP: - igmp_print(cp, len); - break; - - case IPPROTO_IPV4: - /* DVMRP multicast tunnel (ip-in-ip encapsulation) */ - ip_print(cp, len); - if (! vflag) { - printf(" (ipip-proto-4)"); - return; - } - break; - -#ifdef INET6 - case IPPROTO_IPV6: - /* ip6-in-ip encapsulation */ - ip6_print(cp, len); - break; -#endif /*INET6*/ - - case IPPROTO_RSVP: - rsvp_print(cp, len); - break; - - case IPPROTO_GRE: - /* do it */ - gre_print(cp, len); - break; - - case IPPROTO_MOBILE: - mobile_print(cp, len); - break; - - case IPPROTO_PIM: - pim_print(cp, len); - break; - - case IPPROTO_VRRP: - vrrp_print(cp, len, ip->ip_ttl); - break; - - default: - if ((proto = getprotobynumber(nh)) != NULL) - (void)printf(" %s", proto->p_name); - else - (void)printf(" ip-proto-%d", nh); - printf(" %d", len); - break; + if ((ipds->off & 0x1fff) == 0) { + ipds->cp = (const u_char *)ipds->ip + ipds->hlen; + ipds->nh = ipds->ip->ip_p; + + if (ipds->nh != IPPROTO_TCP && ipds->nh != IPPROTO_UDP && + ipds->nh != IPPROTO_SCTP) { + (void)printf("%s > %s: ", + ipaddr_string(&ipds->ip->ip_src), + ipaddr_string(&ipds->ip->ip_dst)); } + ip_print_demux(ndo, ipds); } else { /* Ultra quiet now means that all this stuff should be suppressed */ if (qflag > 1) return; @@ -634,13 +657,13 @@ again: * next level protocol header. print the ip addr * and the protocol. */ - if (off & 0x1fff) { - (void)printf("%s > %s:", ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); - if ((proto = getprotobynumber(ip->ip_p)) != NULL) + if (ipds->off & 0x1fff) { + (void)printf("%s > %s:", ipaddr_string(&ipds->ip->ip_src), + ipaddr_string(&ipds->ip->ip_dst)); + if ((proto = getprotobynumber(ipds->ip->ip_p)) != NULL) (void)printf(" %s", proto->p_name); else - (void)printf(" ip-proto-%d", ip->ip_p); + (void)printf(" ip-proto-%d", ipds->ip->ip_p); } } } @@ -658,7 +681,7 @@ ipN_print(register const u_char *bp, register u_int length) memcpy (&hdr, (char *)ip, 4); switch (IP_V(&hdr)) { case 4: - ip_print (bp, length); + ip_print (gndo, bp, length); return; #ifdef INET6 case 6: diff --git a/print-ip6.c b/print-ip6.c index f174888a..05db9d97 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.46 2004-09-29 16:49:32 hannes Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47 2005-04-06 21:32:40 mcr Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -201,7 +201,7 @@ ip6_print(register const u_char *bp, register u_int length) return; case IPPROTO_IPV4: - ip_print(cp, len); + ip_print(gndo, cp, len); return; case IPPROTO_NONE: diff --git a/print-isoclns.c b/print-isoclns.c index 5eba78c5..106e9d53 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.132 2005-04-02 18:32:41 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133 2005-04-06 21:32:40 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -594,7 +594,7 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen) break; case NLPID_IP: - ip_print(p+1, length-1); + ip_print(gndo, p+1, length-1); break; #ifdef INET6 @@ -2437,3 +2437,11 @@ osi_cksum(const u_int8_t *tptr, u_int len) } return (c0 | c1); } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-juniper.c b/print-juniper.c index d90bce80..80c9e88a 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -15,7 +15,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.7 2005-01-27 18:30:36 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8 2005-04-06 21:32:41 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -337,8 +337,8 @@ ip_heuristic_guess(register const u_char *p, u_int length) { case 0x4d: case 0x4e: case 0x4f: - ip_print(p, length); - break; + ip_print(gndo, p, length); + break; #ifdef INET6 case 0x60: case 0x61: @@ -399,3 +399,11 @@ juniper_parse_header (const u_char *p, u_int8_t *direction, u_int length) { } return 1; /* everything went ok so far. continue parsing */ } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-llc.c b/print-llc.c index f1b8eb42..52250f2f 100644 --- a/print-llc.c +++ b/print-llc.c @@ -24,7 +24,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.60 2005-04-06 20:09:08 hannes Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61 2005-04-06 21:32:41 mcr Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -131,7 +131,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, } if (llc.ssap == LLCSAP_IP && llc.dsap == LLCSAP_IP) { - ip_print(p+4, length-4); + ip_print(gndo, p+4, length-4); return (1); } @@ -438,3 +438,11 @@ snap_print(const u_char *p, u_int length, u_int caplen, } return (0); } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-mpls.c b/print-mpls.c index a6de5cf1..a2043eac 100644 --- a/print-mpls.c +++ b/print-mpls.c @@ -28,7 +28,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.12 2004-06-14 14:47:58 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.13 2005-04-06 21:32:41 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -86,7 +86,7 @@ mpls_print(const u_char *bp, u_int length) switch (MPLS_LABEL(v)) { case 0: /* IPv4 explicit NULL label */ case 3: /* IPv4 implicit NULL label */ - ip_print(p, length - (p - bp)); + ip_print(gndo, p, length - (p - bp)); break; #ifdef INET6 case 2: /* IPv6 explicit NULL label */ @@ -122,7 +122,7 @@ mpls_print(const u_char *bp, u_int length) case 0x4f: if (vflag>0) { printf("\n\t"); - ip_print(p, length - (p - bp)); + ip_print(gndo, p, length - (p - bp)); } else printf(", IP, length: %u",length); break; @@ -170,3 +170,11 @@ mpls_print(const u_char *bp, u_int length) trunc: printf("[|MPLS]"); } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-msdp.c b/print-msdp.c index 50d445e5..a228ab7c 100644 --- a/print-msdp.c +++ b/print-msdp.c @@ -17,7 +17,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-msdp.c,v 1.6 2003-11-16 09:36:29 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-msdp.c,v 1.7 2005-04-06 21:32:41 mcr Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -70,7 +70,7 @@ msdp_print(const unsigned char *sp, u_int length) (void)printf(" [w/data]"); if (vflag > 1) { (void)printf(" "); - ip_print(sp + *sp * 12 + 8 - 3, + ip_print(gndo, sp + *sp * 12 + 8 - 3, len - (*sp * 12 + 8)); } } @@ -99,3 +99,10 @@ msdp_print(const unsigned char *sp, u_int length) trunc: (void)printf(" [|msdp]"); } + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-null.c b/print-null.c index cfb431e5..bfdf3e41 100644 --- a/print-null.c +++ b/print-null.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.52 2004-03-17 23:24:38 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53 2005-04-06 21:32:41 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -163,7 +163,7 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p) switch (family) { case BSD_AF_INET: - ip_print(p, length); + ip_print(gndo, p, length); break; #ifdef INET6 @@ -197,3 +197,9 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p) return (NULL_HDRLEN); } +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-pflog.c b/print-pflog.c index 463cd18b..6cd004cc 100644 --- a/print-pflog.c +++ b/print-pflog.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.12 2004-04-02 06:48:10 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.13 2005-04-06 21:32:41 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -136,7 +136,7 @@ pflog_if_print(const struct pcap_pkthdr *h, register const u_char *p) #if OPENBSD_AF_INET != AF_INET case OPENBSD_AF_INET: /* XXX: read pcap files */ #endif - ip_print(p, length); + ip_print(gndo, p, length); break; #ifdef INET6 @@ -161,3 +161,10 @@ trunc: printf("[|pflog]"); return (hdrlen); } + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-pim.c b/print-pim.c index 82c19f2a..18c6da4d 100644 --- a/print-pim.c +++ b/print-pim.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.44 2004-09-29 16:49:31 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45 2005-04-06 21:32:42 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -743,7 +743,7 @@ pimv2_print(register const u_char *bp, register u_int len) switch (IP_V(ip)) { case 4: /* IPv4 */ printf(" "); - ip_print(bp, len); + ip_print(gndo, bp, len); break; #ifdef INET6 case 6: /* IPv6 */ @@ -1062,3 +1062,10 @@ pimv2_print(register const u_char *bp, register u_int len) trunc: (void)printf("[|pim]"); } + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-ppp.c b/print-ppp.c index 43fddfa2..84429012 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.107 2005-01-25 16:27:56 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.108 2005-04-06 21:32:42 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -1149,8 +1149,8 @@ ppp_hdlc(const u_char *p, int length) switch (proto) { case PPP_IP: - ip_print(b+1, t - b - 1); - goto cleanup; + ip_print(gndo, b+1, t - b - 1); + goto cleanup; #ifdef INET6 case PPP_IPV6: ip6_print(b+1, t - b - 1); @@ -1213,7 +1213,7 @@ handle_ppp(u_int proto, const u_char *p, int length) case ETHERTYPE_IP: /*XXX*/ case PPP_VJNC: case PPP_IP: - ip_print(p, length); + ip_print(gndo, p, length); break; #ifdef INET6 case ETHERTYPE_IPV6: /*XXX*/ @@ -1597,3 +1597,11 @@ printx: #endif /* __bsdi__ */ return (hdrlength); } + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ diff --git a/print-sl.c b/print-sl.c index dbe423da..f00d3943 100644 --- a/print-sl.c +++ b/print-sl.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.64 2003-11-16 09:36:36 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.65 2005-04-06 21:32:42 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -69,7 +69,7 @@ sl_if_print(const struct pcap_pkthdr *h, const u_char *p) switch (IP_V(ip)) { case 4: - ip_print((u_char *)ip, length); + ip_print(gndo, (u_char *)ip, length); break; #ifdef INET6 case 6: @@ -104,7 +104,7 @@ sl_bsdos_if_print(const struct pcap_pkthdr *h, const u_char *p) sliplink_print(p, ip, length); #endif - ip_print((u_char *)ip, length); + ip_print(gndo, (u_char *)ip, length); return (SLIP_HDRLEN); }