]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Remove #if 0 sections
authorfenner <fenner>
Fri, 15 Jun 2001 22:17:31 +0000 (22:17 +0000)
committerfenner <fenner>
Fri, 15 Jun 2001 22:17:31 +0000 (22:17 +0000)
Finish converting over to having the caller print the IP address
 (except for UDP, TCP and SCTP).  This consists mostly of removing
 places where the IP address is printed, both in the big "case"
 in ip_print() and in the individual printers.
Also fix a couple of spacing bugs.

print-egp.c
print-gre.c
print-icmp.c
print-icmp6.c
print-igrp.c
print-ip.c
print-mobile.c
print-ospf.c
print-pim.c
print-rt6.c
print-udp.c

index 9a14837431f984f9a04be06af1f30b4201c14d4d..4446974b92100fc7d8d0a5f7fc5dc51b90d90346 100644 (file)
@@ -20,7 +20,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.26 2000-09-29 04:58:36 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.27 2001-06-15 22:17:31 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -230,9 +230,7 @@ egp_print(register const u_char *bp, register u_int length,
 
        egp = (struct egp_packet *)bp;
        ip = (struct ip *)bp2;
-        (void)printf("%s > %s: egp: ",
-                    ipaddr_string(&ip->ip_src),
-                    ipaddr_string(&ip->ip_dst));
+       (void)printf("egp: ");
 
        if (egp->egp_version != EGP_VERSION) {
                printf("[version %d]", egp->egp_version);
index e5a9cbdb236a5b1cf553acabacaa5ba7cbac6905..4accdfe0fe49d787b1cb014fada5e4e4d925ea68 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.12 2001-03-13 01:03:17 fenner Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.13 2001-06-15 22:17:31 fenner Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -88,6 +88,7 @@ gre_print(const u_char *bp, u_int length)
        TCHECK(gre->proto);
        flags = EXTRACT_16BITS(&gre->flags);
        proto = EXTRACT_16BITS(&gre->proto);
+       (void)printf("gre ");
 
        if (flags) {
                /* Decode the flags */
index 38a9d7bd726560dd80eeaa0a23854dd77425d528..1ae85482a37f31675bd5c46ce0a0026085cdd67d 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.58 2001-01-28 09:53:18 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.59 2001-06-15 22:17:32 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -283,12 +283,6 @@ icmp_print(register const u_char *bp, u_int plen, register const u_char *bp2)
        ip = (struct ip *)bp2;
        str = buf;
 
-#if 0
-       (void)printf("%s > %s: ",
-               ipaddr_string(&ip->ip_src),
-               ipaddr_string(&ip->ip_dst));
-#endif
-
        TCHECK(dp->icmp_code);
        switch (dp->icmp_type) {
 
index fc52d85854123c77bd070df94b373b5f031f1548..d46094ecf125b0cc405e3942b33d418ddf35bfae 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.54 2001-06-01 23:01:04 itojun Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.55 2001-06-15 22:17:32 fenner Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -122,10 +122,6 @@ icmp6_print(const u_char *bp, const u_char *bp2)
        char buf[256];
        int icmp6len, prot;
 
-#if 0
-#define TCHECK(var) if ((u_char *)&(var) > ep - sizeof(var)) goto trunc
-#endif
-
        dp = (struct icmp6_hdr *)bp;
        ip = (struct ip6_hdr *)bp2;
        oip = (struct ip6_hdr *)(dp + 1);
@@ -138,12 +134,6 @@ icmp6_print(const u_char *bp, const u_char *bp2)
        else                    /* XXX: jumbo payload case... */
                icmp6len = snapend - bp;
 
-#if 0
-       (void)printf("%s > %s: ",
-               ip6addr_string(&ip->ip6_src),
-               ip6addr_string(&ip->ip6_dst));
-#endif
-
        TCHECK(dp->icmp6_code);
        switch (dp->icmp6_type) {
        case ICMP6_DST_UNREACH:
@@ -372,9 +362,6 @@ icmp6_print(const u_char *bp, const u_char *bp2)
        return;
 trunc:
        fputs("[|icmp6]", stdout);
-#if 0
-#undef TCHECK
-#endif
 }
 
 static struct udphdr *
index be87dba250c65f2203ee50fddb8f35d20eb9af8a..2580ca5ee05594e5b33eb73abb973b1143b556cc 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.15 2000-09-29 04:58:40 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.16 2001-06-15 22:17:32 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -92,9 +92,7 @@ igrp_print(register const u_char *bp, u_int length, register const u_char *bp2)
        hdr = (struct igrphdr *)bp;
        ip = (struct ip *)bp2;
        cp = (u_char *)(hdr + 1);
-        (void)printf("%s > %s: igrp: ",
-           ipaddr_string(&ip->ip_src),
-           ipaddr_string(&ip->ip_dst));
+        (void)printf("igrp:");
 
        /* Header */
        TCHECK(*hdr);
@@ -126,7 +124,7 @@ igrp_print(register const u_char *bp, u_int length, register const u_char *bp2)
                        igrp_entry_print((struct igrprte *)cp, 0, 1);
                        --next;
                } else {
-                       (void)printf("[extra bytes %d]", length);
+                       (void)printf(" [extra bytes %d]", length);
                        break;
                }
                cp += IGRP_RTE_SIZE;
@@ -135,5 +133,5 @@ igrp_print(register const u_char *bp, u_int length, register const u_char *bp2)
        if (nint == 0 && nsys == 0 && next == 0)
                return;
 trunc:
-       fputs("[|igrp]", stdout);
+       fputs(" [|igrp]", stdout);
 }
index 945395f311a6d3546e25dba8d20705547f5a987c..3cc07768b1cd6537671264ed52aeed5a9eeb8b5a 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.97 2001-05-29 15:35:20 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.98 2001-06-15 22:17:33 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -390,10 +390,6 @@ again:
                        break;
 
                case IPPROTO_ND:
-#if 0
-                       (void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
-                               ipaddr_string(&ip->ip_dst));
-#endif
                        (void)printf(" nd %d", len);
                        break;
 
@@ -417,12 +413,6 @@ again:
 
                case 4:
                        /* DVMRP multicast tunnel (ip-in-ip encapsulation) */
-#if 0
-                       if (vflag)
-                               (void)printf("%s > %s: ",
-                                            ipaddr_string(&ip->ip_src),
-                                            ipaddr_string(&ip->ip_dst));
-#endif
                        ip_print(cp, len);
                        if (! vflag) {
                                printf(" (ipip-proto-4)");
@@ -436,17 +426,7 @@ again:
 #endif
                case IP6PROTO_ENCAP:
                        /* ip6-in-ip encapsulation */
-#if 0
-                       if (vflag)
-                               (void)printf("%s > %s: ",
-                                            ipaddr_string(&ip->ip_src),
-                                            ipaddr_string(&ip->ip_dst));
-#endif
                        ip6_print(cp, len);
-                       if (! vflag) {
-                               printf(" (encap)");
-                               return;
-                       }
                        break;
 #endif /*INET6*/
 
@@ -455,31 +435,15 @@ again:
 #define IPPROTO_GRE 47
 #endif
                case IPPROTO_GRE:
-                       if (vflag)
-                               (void)printf("gre %s > %s: ",
-                                            ipaddr_string(&ip->ip_src),
-                                            ipaddr_string(&ip->ip_dst));
                        /* do it */
                        gre_print(cp, len);
-                       if (! vflag) {
-                               printf(" (gre encap)");
-                               return;
-                       }
                        break;
 
 #ifndef IPPROTO_MOBILE
 #define IPPROTO_MOBILE 55
 #endif
                case IPPROTO_MOBILE:
-                       if (vflag)
-                               (void)printf("mobile %s > %s: ",
-                                            ipaddr_string(&ip->ip_src),
-                                            ipaddr_string(&ip->ip_dst));
                        mobile_print(cp, len);
-                       if (! vflag) {
-                               printf(" (mobile encap)");
-                               return;
-                       }
                        break;
 
 #ifndef IPPROTO_PIM
@@ -493,18 +457,10 @@ again:
 #define IPPROTO_VRRP   112
 #endif
                case IPPROTO_VRRP:
-                       if (vflag)
-                               (void)printf("vrrp %s > %s: ",
-                                            ipaddr_string(&ip->ip_src),
-                                            ipaddr_string(&ip->ip_dst));
                        vrrp_print(cp, len, ip->ip_ttl);
                        break;
 
                default:
-#if 0
-                       (void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
-                               ipaddr_string(&ip->ip_dst));
-#endif
                        (void)printf(" ip-proto-%d %d", nh, len);
                        break;
                }
index 61582b68d51e9a52ddcfe850e847b8657785a17a..8d93bbf9cd247a9a636b868da389524ef4deb47b 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.5 2000-09-29 04:58:43 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.6 2001-06-15 22:17:33 fenner Exp $";
 #endif
 
 #include <sys/param.h>
@@ -89,6 +89,7 @@ mobile_print(const u_char *bp, u_int length)
                fputs("[|mobile]", stdout);
                return;
        }
+       fputs("mobile: ", stdout);
 
        proto = EXTRACT_16BITS(&mob->proto);
        crc =  EXTRACT_16BITS(&mob->hcheck);
index 3d67cb3ed9bb08886267f1311d438506b574d18a..098cbdf214d7735c07663e409e7ad22e651de69d 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.29 2000-09-29 04:58:45 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.30 2001-06-15 22:17:34 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -509,12 +509,6 @@ ospf_print(register const u_char *bp, register u_int length,
 
        op = (struct ospfhdr *)bp;
        ip = (struct ip *)bp2;
-       /* Print the source and destination address  */
-#if 0
-       (void) printf("%s > %s:",
-           ipaddr_string(&ip->ip_src),
-           ipaddr_string(&ip->ip_dst));
-#endif
 
         /* XXX Before we do anything else, strip off the MD5 trailer */
         TCHECK(op->ospf_authtype);
index b38fba480261888f36682b95afec5b6c7d6a71b4..6c31838acd33f78e68056e4db0f528f3122a8746 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.27 2001-05-11 02:12:32 fenner Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.28 2001-06-15 22:17:34 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -416,11 +416,6 @@ static int pimv2_addr_len;
 enum pimv2_addrtype {
        pimv2_unicast, pimv2_group, pimv2_source
 };
-#if 0
-static char *addrtypestr[] = {
-       "unicast", "group", "source"
-};
-#endif
 
 /*  0                   1                   2                   3
  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
index 0bf78b81b60c36bad9e2b69bc82b69b80fec45af..8b249788213acea2b7f45d64c2f142165fe105b7 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.17 2000-12-13 07:57:05 itojun Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.18 2001-06-15 22:17:34 fenner Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -62,12 +62,6 @@ rt6_print(register const u_char *bp, register const u_char *bp2)
        /* 'ep' points to the end of available data. */
        ep = snapend;
 
-#if 0
-       printf("%s > %s: ",
-              ip6addr_string(&ip->ip6_src),
-              ip6addr_string(&ip->ip6_dst));
-#endif
-
        TCHECK(dp->ip6r_segleft);
 
        printf("srcrt (len=%d", dp->ip6r_len);  /*)*/
index c9bb189b5014af978654bf42128edf3c8a818bb1..0d397d624e05131025ea208e60412500560831a5 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.93 2001-03-17 04:41:51 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.94 2001-06-15 22:17:34 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -570,11 +570,6 @@ udp_print(register const u_char *bp, u_int length,
                        return;
                }
        }
-#if 0
-       (void)printf("%s.%s > %s.%s:",
-               ipaddr_string(&ip->ip_src), udpport_string(sport),
-               ipaddr_string(&ip->ip_dst), udpport_string(dport));
-#else
 #ifdef INET6
        if (ip6) {
                if (ip6->ip6_nxt == IPPROTO_UDP) {
@@ -601,7 +596,6 @@ udp_print(register const u_char *bp, u_int length,
                                udpport_string(sport), udpport_string(dport));
                }
        }
-#endif
 
        if (IP_V(ip) == 4 && vflag && !fragmented) {
                int sum = up->uh_sum;