]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
From: Juergen Schoenwaelder <[email protected]>
[tcpdump] / tcpdump.c
index 1e8271a29108bba77210d8fd77749911b7516259..f331cf8ca0af592bad29815d2dc4c44730504269 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -24,7 +24,7 @@ static const char copyright[] =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.132 1999-10-30 05:11:23 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.136 1999-12-13 18:06:15 mcr Exp $ (LBL)";
 #endif
 
 /*
@@ -35,6 +35,10 @@ static const char rcsid[] =
  * combined efforts of Van, Steve McCanne and Craig Leres of LBL.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <sys/types.h>
 #include <sys/time.h>
 
@@ -66,6 +70,7 @@ int Oflag = 1;                        /* run filter code optimizer */
 int pflag;                     /* don't go promiscuous */
 int qflag;                     /* quick (shorter) output */
 int Rflag = 1;                 /* print sequence # field in AH/ESP*/
+int sflag = 0;                 /* use the libsmi to translate OIDs */
 int Sflag;                     /* print raw TCP sequence numbers */
 int tflag = 1;                 /* print packet arrival time */
 int vflag;                     /* verbose */
@@ -99,6 +104,12 @@ struct printer {
 static struct printer printers[] = {
        { ether_if_print,       DLT_EN10MB },
        { ether_if_print,       DLT_IEEE802 },
+#ifdef DLT_LANE8023
+       { lane_if_print,        DLT_LANE8023 },
+#endif
+#ifdef DLT_CIP
+       { cip_if_print,         DLT_CIP },
+#endif
        { sl_if_print,          DLT_SLIP },
        { sl_bsdos_if_print,    DLT_SLIP_BSDOS },
        { ppp_if_print,         DLT_PPP },
@@ -157,9 +168,13 @@ main(int argc, char **argv)
        if (abort_on_misalignment(ebuf) < 0)
                error("%s", ebuf);
 
+#ifdef LIBSMI
+       smiInit("tcpdump");
+#endif
+       
        opterr = 0;
        while (
-           (op = getopt(argc, argv, "ac:deE:fF:i:lnNOpqr:Rs:StT:vw:xY")) != EOF)
+           (op = getopt(argc, argv, "ac:deE:fF:i:lnNm:Opqr:Rs:StT:vw:xY")) != EOF)
                switch (op) {
 
                case 'a':
@@ -224,6 +239,18 @@ main(int argc, char **argv)
                        ++Nflag;
                        break;
 
+               case 'm':
+#ifdef LIBSMI
+                       if (smiLoadModule(optarg) == 0) {
+                               error("could not load MIB module %s", optarg);
+                       }
+                       sflag = 1;
+#else
+                       (void)fprintf(stderr, "%s: ignoring option `-m %s' ",
+                                     program_name, optarg);
+                       (void)fprintf(stderr, "(no libsmi support)\n");
+#endif
+                       
                case 'O':
                        Oflag = 0;
                        break;
@@ -430,7 +457,7 @@ default_print_unaligned(register const u_char *cp, register u_int length)
   putchar('\n');
   while (nshorts >= 0) {
     
-    snprintf(line+20+i*5, 7, "%02x%02x  ", cp[0], cp[1]);
+    sprintf(line+20+i*5, "%02x%02x  ", cp[0], cp[1]);
 
     if(isprint(cp[0])) {
       line[62+i*2]=cp[0];