summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannes <hannes>2004-06-15 09:42:40 +0000
committerhannes <hannes>2004-06-15 09:42:40 +0000
commit9974f43f2f45119ed473d9cbfc04405e38decc67 (patch)
treefccb95f7052e9d16d5af0fab54c9559090bfb568
parent9d5d809b9b1b1e9c8dac6c565cefebcd1eb30a9b (diff)
downloadtcpdump-9974f43f2f45119ed473d9cbfc04405e38decc67.tar.gz
import latest definition for Pseudowires from draft-ietf-pwe3-iana-allocation-04
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
-rw-r--r--FILES4
-rw-r--r--Makefile.in4
-rwxr-xr-xl2vpn.c58
-rwxr-xr-xl2vpn.h17
-rw-r--r--print-bgp.c23
-rw-r--r--print-ldp.c33
-rw-r--r--print-lspping.c8
7 files changed, 93 insertions, 54 deletions
diff --git a/FILES b/FILES
index 0883644b..8e399f16 100644
--- 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
diff --git a/Makefile.in b/Makefile.in
index 47f1d278..615ac764 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -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
index 00000000..a8221917
--- /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 (hannes@juniper.net)
+ */
+
+#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
index 00000000..766cda54
--- /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 (hannes@juniper.net)
+ */
+
+extern struct tok l2vpn_encaps_values[];
diff --git a/print-bgp.c b/print-bgp.c
index 1c6df3dd..4cecf317 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -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)),
diff --git a/print-ldp.c b/print-ldp.c
index c73022b5..01f476d0 100644
--- a/print-ldp.c
+++ b/print-ldp.c
@@ -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;
diff --git a/print-lspping.c b/print-lspping.c
index 50e28f2b..011229c8 100644
--- a/print-lspping.c
+++ b/print-lspping.c
@@ -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));