]> The Tcpdump Group git mirrors - tcpdump/commitdiff
move the SNAP OUI values out of the llc printer into
authorhannes <hannes>
Wed, 6 Apr 2005 20:09:07 +0000 (20:09 +0000)
committerhannes <hannes>
Wed, 6 Apr 2005 20:09:07 +0000 (20:09 +0000)
  the global oui.c file and make all SNAP printers use it

make the display output of the frame-relay SNAP printer consistent
  to the LLC SNAP printer (= print oui{id,name}, proto-id)

llc.h
oui.c
print-fr.c
print-llc.c

diff --git a/llc.h b/llc.h
index 5e6c74c3e87efd184dc4a332fd6c041e189fb431..738a0d9db5c4a32f0ee7916ebc3e2bd26ee0ffb2 100644 (file)
--- a/llc.h
+++ b/llc.h
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.16 2002-12-11 07:13:54 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.17 2005-04-06 20:09:07 hannes Exp $ (LBL)
  */
 
 /*
@@ -125,12 +125,6 @@ struct llc {
 #define        LLCSAP_ISONS            0xfe
 #endif
 
-#define        OUI_ENCAP_ETHER 0x000000        /* encapsulated Ethernet */
-#define        OUI_CISCO       0x00000c        /* Cisco protocols */
-#define        OUI_CISCO_90    0x0000f8        /* Cisco bridging */
-#define OUI_RFC2684    0x0080c2        /* RFC 2684 bridged Ethernet */
-#define        OUI_APPLETALK   0x080007        /* Appletalk */
-
 /*
  * PIDs for use with OUI_CISCO.
  */
diff --git a/oui.c b/oui.c
index 326b15a6ff4255665d90b70f8ffaf1762f4c3a78..f6ce2c84798c473bff65d4e42f48e0631ebcf2e7 100644 (file)
--- a/oui.c
+++ b/oui.c
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.2 2004-01-25 09:56:15 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.3 2005-04-06 20:09:07 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -28,9 +28,24 @@ static const char rcsid[] _U_ =
 
 /* FIXME complete OUI list using a script */
 
+#define        OUI_ENCAP_ETHER 0x000000        /* encapsulated Ethernet */
+#define        OUI_CISCO       0x00000c        /* Cisco protocols */
+#define        OUI_CISCO_90    0x0000f8        /* Cisco bridging */
+#define OUI_RFC2684    0x0080c2        /* RFC 2684 bridged Ethernet */
+#define        OUI_APPLETALK   0x080007        /* Appletalk */
+#define OUI_JUNIPER     0x009069        /* Juniper */
+
 struct tok oui_values[] = {
-    { 0x009069, "Juniper"},
-    { 0x00000c, "Cisco"},
+    { OUI_ENCAP_ETHER, "Ethernet" },
+    { OUI_CISCO, "Cisco" },
+    { OUI_CISCO_90, "Cisco bridged" },
+    { OUI_RFC2684, "Ethernet bridged" },
+    { OUI_APPLETALK, "Appletalk" },
+    { OUI_JUNIPER, "Juniper"},
+};
+
+static struct tok snap_oui_values[] = {
+    { 0,           NULL }
 };
 
 /* list taken from ethereal/packet-radius.c */
index f8398121934291fe89dc4ebd2bc9f137dd9c8f94..b0ffab99bedab655602cd49183f3a3f595b95ba5 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.30 2005-03-21 11:35:55 hannes Exp $ (LBL)";
+       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.31 2005-04-06 20:09:08 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -39,6 +39,7 @@ static const char rcsid[] _U_ =
 #include "ethertype.h"
 #include "nlpid.h"
 #include "extract.h"
+#include "oui.h"
 
 static void frf15_print(const u_char *, u_int);
 
@@ -269,19 +270,23 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
        case NLPID_SNAP:
                orgcode = EXTRACT_24BITS(p);
                et = EXTRACT_16BITS(p + 3);
+
+                if (eflag)
+                    (void)printf("SNAP, oui %s (0x%06x), ethertype %s (0x%04x): ",
+                                 tok2str(oui_values,"Unknown",orgcode),
+                                 orgcode,
+                                 tok2str(ethertype_values,"Unknown", et),
+                                 et);
+
                if (snap_print((const u_char *)(p + 5), length - 5,
                           caplen - 5, &extracted_ethertype, orgcode, et,
                           0) == 0) {
                        /* ether_type not known, print raw packet */
-                       if (!eflag)
+                        if (!eflag)
                             fr_hdr_print(length + hdr_len, hdr_len,
-                                            dlci, flags, nlpid);
-                       if (extracted_ethertype) {
-                               printf("(SNAP %s) ",
-                              etherproto_string(htons(extracted_ethertype)));
-                       }
+                                         dlci, flags, nlpid);
                        if (!xflag && !qflag)
-                               default_print(p - hdr_len, caplen + hdr_len);
+                            default_print(p - hdr_len, caplen + hdr_len);
                }
                break;
 
index 17d53750689d5ebb077f7c54c0a3107649fc0ef7..f1b8eb423c03c8e397b535e344228c2916e512fe 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.59 2005-01-25 16:22:57 hannes Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.60 2005-04-06 20:09:08 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -42,6 +42,7 @@ static const char rcsid[] _U_ =
 
 #include "llc.h"
 #include "ethertype.h"
+#include "oui.h"
 
 static struct tok llc_values[] = {
         { LLCSAP_NULL,     "Null" },
@@ -72,15 +73,6 @@ static struct tok cmd2str[] = {
        { 0,            NULL }
 };
 
-static struct tok snap_oui_values[] = {
-        { OUI_ENCAP_ETHER, "Ethernet" },
-        { OUI_CISCO, "Cisco" },
-        { OUI_CISCO_90, "Cisco bridged" },
-        { OUI_RFC2684, "Ethernet bridged" },
-        { OUI_APPLETALK, "Appletalk" },
-        { 0,           NULL }
-};
-
 /*
  * Returns non-zero IFF it succeeds in printing the header
  */
@@ -231,7 +223,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
 
                 if (eflag)
                     (void)printf("oui %s (0x%06x), ethertype %s (0x%04x): ",
-                                 tok2str(snap_oui_values,"Unknown",orgcode),
+                                 tok2str(oui_values,"Unknown",orgcode),
                                  orgcode,
                                  tok2str(ethertype_values,"Unknown", et),
                                  et);