]> The Tcpdump Group git mirrors - tcpdump/commitdiff
import latest definition for Pseudowires from draft-ietf-pwe3-iana-allocation-04
authorhannes <hannes>
Tue, 15 Jun 2004 09:42:40 +0000 (09:42 +0000)
committerhannes <hannes>
Tue, 15 Jun 2004 09:42:40 +0000 (09:42 +0000)
  and put it to its new home l2vpn.{c|h}
rework bgp, ldp, lsp-ping to use the common l2vpn_encaps tokenlist
update FILES list to acommodate the recent file additions

FILES
Makefile.in
l2vpn.c [new file with mode: 0755]
l2vpn.h [new file with mode: 0755]
print-bgp.c
print-ldp.c
print-lspping.c

diff --git a/FILES b/FILES
index 0883644b5b03fd3542f3276a99da6f9ebdb6c708..8e399f164f0026bf3dfc73116e143a78c497df6d 100644 (file)
--- a/FILES
+++ b/FILES
@@ -20,6 +20,7 @@ atm.h
 atmuni31.h
 bootp.h
 bpf_dump.c
+bgp.h
 chdlc.h
 config.guess
 config.h.in
@@ -51,6 +52,8 @@ ipsec_doi.h
 ipx.h
 isakmp.h
 l2tp.h
+l2vpn.c
+l2vpn.h
 lane.h
 lbl/os-osf4.h
 lbl/os-solaris2.h
@@ -80,6 +83,7 @@ missing/strlcat.c
 missing/strlcpy.c
 missing/strsep.c
 mkdep
+mpls.h
 nameser.h
 netbios.h
 nfs.h
index 47f1d278e6198bb085bcf9e49465f24a20845f2b..615ac7641934aa50b35f649f4f1b4f9176bb41d4 100644 (file)
@@ -17,7 +17,7 @@
 #  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 #
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.287 2004-06-06 19:20:04 hannes Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.288 2004-06-15 09:45:41 hannes Exp $ (LBL)
 
 #
 # Various configurable paths (remember to edit Makefile.in, not Makefile)
@@ -65,7 +65,7 @@ INSTALL_DATA = @INSTALL_DATA@
        @rm -f $@
        $(CC) $(CFLAGS) -c $(srcdir)/$*.c
 
-CSRC = addrtoname.c gmpls.c oui.c gmt2local.c ipproto.c machdep.c parsenfsfh.c \
+CSRC = addrtoname.c gmpls.c oui.c gmt2local.c ipproto.c l2vpn.c machdep.c parsenfsfh.c \
        print-802_11.c print-ap1394.c print-ah.c print-arcnet.c \
        print-aodv.c print-arp.c print-ascii.c print-atalk.c print-atm.c \
        print-beep.c print-bfd.c print-bgp.c print-bootp.c print-cdp.c \
diff --git a/l2vpn.c b/l2vpn.c
new file mode 100755 (executable)
index 0000000..a822191
--- /dev/null
+++ b/l2vpn.c
@@ -0,0 +1,58 @@
+/* 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * Original code by Hannes Gredler ([email protected])
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/l2vpn.c,v 1.1 2004-06-15 09:42:40 hannes Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+#include "interface.h"
+#include "l2vpn.h"
+
+/* draft-ietf-pwe3-iana-allocation-04 */
+struct tok l2vpn_encaps_values[] = {
+    { 0x00, "Reserved"},
+    { 0x01, "Frame Relay"},
+    { 0x02, "ATM AAL5 VCC transport"},
+    { 0x03, "ATM transparent cell transport"}, 
+    { 0x04, "Ethernet VLAN"}, 
+    { 0x05, "Ethernet"}, 
+    { 0x06, "Cisco-HDLC"}, 
+    { 0x07, "PPP"}, 
+    { 0x08, "SONET/SDH Circuit Emulation Service over MPLS"}, 
+    { 0x09, "ATM n-to-one VCC cell transport"}, 
+    { 0x0a, "ATM n-to-one VPC cell transport"}, 
+    { 0x0b, "IP Layer2 Transport"}, 
+    { 0x0c, "ATM one-to-one VCC Cell Mode"}, 
+    { 0x0d, "ATM one-to-one VPC Cell Mode"},
+    { 0x0e, "ATM AAL5 PDU VCC transport"},
+    { 0x0f, "Frame-Relay Port mode"},
+    { 0x10, "SONET/SDH Circuit Emulation over Packet"},
+    { 0x11, "Structure-agnostic E1 over Packet"},
+    { 0x12, "Structure-agnostic T1 (DS1) over Packet"},
+    { 0x13, "Structure-agnostic E3 over Packet"},
+    { 0x14, "Structure-agnostic T3 (DS3) over Packet"},
+    { 0x15, "CESoPSN basic mode"},
+    { 0x16, "TDMoIP basic mode"},
+    { 0x17, "CESoPSN TDM with CAS"},
+    { 0x18, "TDMoIP TDM with CAS"},
+    { 0x40, "IP-interworking"}, 
+    { 0, NULL}
+};
diff --git a/l2vpn.h b/l2vpn.h
new file mode 100755 (executable)
index 0000000..766cda5
--- /dev/null
+++ b/l2vpn.h
@@ -0,0 +1,17 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/l2vpn.h,v 1.1 2004-06-15 09:42:41 hannes Exp $ (LBL) */
+/* 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * Original code by Hannes Gredler ([email protected])
+ */
+
+extern struct tok l2vpn_encaps_values[];
index 1c6df3dd52876938ad42f8c59274f8013099d764..4cecf3176886e27915471423e5ccfc99725ca747 100644 (file)
@@ -36,7 +36,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.86 2004-06-12 08:52:21 hannes Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.87 2004-06-15 09:42:41 hannes Exp $";
 #endif
 
 #include <tcpdump-stdinc.h>
@@ -49,6 +49,7 @@ static const char rcsid[] _U_ =
 #include "addrtoname.h"
 #include "extract.h"
 #include "bgp.h"
+#include "l2vpn.h"
 
 struct bgp {
        u_int8_t bgp_marker[16];
@@ -444,24 +445,6 @@ static struct tok bgp_extd_comm_ospf_rtype_values[] = {
   { 0, NULL },
 };
 
-struct tok bgp_l2vpn_encaps_values[] = {
-    { 0,                      "Reserved"},
-    { 1,                      "Frame Relay"},
-    { 2,                      "ATM AAL5 VCC transport"},
-    { 3,                      "ATM transparent cell transport"}, 
-    { 4,                      "Ethernet VLAN"}, 
-    { 5,                      "Ethernet"}, 
-    { 6,                      "Cisco-HDLC"}, 
-    { 7,                      "PPP"}, 
-    { 8,                      "CEM"}, 
-    { 9,                      "ATM VCC cell transport"}, 
-    { 10,                     "ATM VPC cell transport"}, 
-    { 11,                     "MPLS"}, 
-    { 12,                     "VPLS"}, 
-    { 64,                     "IP-interworking"}, 
-    { 0, NULL},
-};
-
 int
 decode_prefix4(const u_char *pptr, char *buf, u_int buflen)
 {
@@ -1462,7 +1445,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                         break;
                     case BGP_EXT_COM_L2INFO:
                         printf(": %s Control Flags [0x%02x]:MTU %u",
-                               tok2strbuf(bgp_l2vpn_encaps_values,
+                               tok2strbuf(l2vpn_encaps_values,
                                          "unknown encaps",
                                          *(tptr+2),
                                          tokbuf, sizeof(tokbuf)),
index c73022b576627167fc1a845ae019b076b38bf7ba..01f476d0ff481b0208cdd938636642b14996265e 100644 (file)
@@ -16,7 +16,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.7 2004-05-27 21:20:50 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.8 2004-06-15 09:42:42 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -34,6 +34,8 @@ static const char rcsid[] _U_ =
 #include "extract.h"
 #include "addrtoname.h"
 
+#include "l2vpn.h"
+
 /*
  * ldp common header
  *
@@ -185,33 +187,6 @@ static const struct tok ldp_fec_values[] = {
     { 0, NULL}
 };
 
-/* From draft-martini-l2circuit-trans-mpls-13.txt */
-#define LDP_MARTINI_VCTYPE_FR_DLCI     0x0001
-#define LDP_MARTINI_VCTYPE_ATM_AAL5    0x0002
-#define LDP_MARTINI_VCTYPE_ATM_CELL    0x0003
-#define LDP_MARTINI_VCTYPE_ETH_VLAN    0x0004
-#define LDP_MARTINI_VCTYPE_ETHERNET    0x0005
-#define LDP_MARTINI_VCTYPE_HDLC                0x0006
-#define LDP_MARTINI_VCTYPE_PPP         0x0007
-#define LDP_MARTINI_VCTYPE_CEM         0x0008
-#define LDP_MARTINI_VCTYPE_ATM_VCC     0x0009
-#define LDP_MARTINI_VCTYPE_ATM_VPC     0x000A
-
-/* Overlaps print-bgp.c bgp_l2vpn_encaps_values */
-static const struct tok ldp_vctype_values[] = {
-    { LDP_MARTINI_VCTYPE_FR_DLCI,      "Frame Relay DLCI" },
-    { LDP_MARTINI_VCTYPE_ATM_AAL5,     "ATM AAL5 VCC transport" },
-    { LDP_MARTINI_VCTYPE_ATM_CELL,     "ATM transparent cell transport" },
-    { LDP_MARTINI_VCTYPE_ETH_VLAN,     "Ethernet VLAN" },
-    { LDP_MARTINI_VCTYPE_ETHERNET,     "Ethernet" },
-    { LDP_MARTINI_VCTYPE_HDLC,         "HDLC" },
-    { LDP_MARTINI_VCTYPE_PPP,          "PPP" },
-    { LDP_MARTINI_VCTYPE_CEM,          "SONET/SDH Circuit Emulation Service" },
-    { LDP_MARTINI_VCTYPE_ATM_VCC,      "ATM VCC cell transport" },
-    { LDP_MARTINI_VCTYPE_ATM_VPC,      "ATM VPC cell transport" },
-    { 0, NULL}
-};
-
 /* RFC1700 address family numbers, same definition in print-bgp.c */
 #define AFNUM_INET     1
 #define AFNUM_INET6    2
@@ -350,7 +325,7 @@ ldp_tlv_print(register const u_char *tptr) {
            break;
        case LDP_FEC_MARTINI_VC:
            printf(": %s, %scontrol word, VC %u",
-                  tok2str(ldp_vctype_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff),
+                  tok2str(l2vpn_encaps_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff),
                   EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ",
                   EXTRACT_32BITS(tptr+7));
            break;
index 50e28f2b8ca0468d1391cad76f8ffb0a71db3bce..011229c87166dce13c42f1635a17b251041e0e62 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.7 2004-06-15 08:17:19 hannes Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.8 2004-06-15 09:42:42 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -31,7 +31,9 @@ static const char rcsid[] _U_ =
 #include "interface.h"
 #include "extract.h"
 #include "addrtoname.h"
+
 #include "bgp.h"
+#include "l2vpn.h"
 
 /*
  * LSPPING common header
@@ -619,7 +621,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
                            bgp_vpn_rd_print(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
                            EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ce_id),
                            EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ce_id),
-                           tok2str(bgp_l2vpn_encaps_values,
+                           tok2str(l2vpn_encaps_values,
                                    "unknown",
                                    EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
                            EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation));
@@ -634,7 +636,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
                            ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
                            ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
                            EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->vc_id),
-                           tok2str(bgp_l2vpn_encaps_values, /* FIXME are the L2 encaps codepoints of BGP == LDP ??? */
+                           tok2str(l2vpn_encaps_values,
                                    "unknown",
                                    EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
                            EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation));