summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonov-d <simonov-d@yandex-team.ru>2020-02-09 00:25:38 +0500
committerdimmo <dimmoborgir@gmail.com>2020-02-09 00:51:39 +0500
commit5bf990afe24ee42dd2a2c1a5be9a9ab59ac59a5a (patch)
tree6f859a06988eec4294fb8e4a3731c19dddd6a976
parent59cad18b62c33b93ce2a6386941cb6b16b044bab (diff)
downloadtcpdump-5bf990afe24ee42dd2a2c1a5be9a9ab59ac59a5a.tar.gz
Print MPLS-over-UDP.
-rw-r--r--print-udp.c2
-rw-r--r--tests/TESTLIST2
-rw-r--r--tests/mpls-over-udp-v.out8
-rw-r--r--tests/mpls-over-udp.out2
-rw-r--r--tests/mpls-over-udp.pcapbin0 -> 316 bytes
-rw-r--r--udp.h3
6 files changed, 17 insertions, 0 deletions
diff --git a/print-udp.c b/print-udp.c
index 8c052174..d130eee7 100644
--- a/print-udp.c
+++ b/print-udp.c
@@ -716,6 +716,8 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
vxlan_gpe_print(ndo, (const u_char *)(up + 1), length);
else if (IS_SRC_OR_DST_PORT(ZEP_PORT))
zep_print(ndo, (const u_char *)(up + 1), length);
+ else if (IS_SRC_OR_DST_PORT(MPLS_PORT))
+ mpls_print(ndo, (const u_char *)(up + 1), length);
else if (ND_TTEST_1(((const struct LAP *)cp)->type) &&
GET_U_1(((const struct LAP *)cp)->type) == lapDDP &&
(atalk_port(sport) || atalk_port(dport))) {
diff --git a/tests/TESTLIST b/tests/TESTLIST
index a61fdfcf..fd08195c 100644
--- a/tests/TESTLIST
+++ b/tests/TESTLIST
@@ -76,6 +76,8 @@ lspping-fec-rsvp-v lspping-fec-rsvp.pcap lspping-fec-rsvp-v.out -v
lspping-fec-rsvp-vv lspping-fec-rsvp.pcap lspping-fec-rsvp-vv.out -vv
mpls-traceroute mpls-traceroute.pcap mpls-traceroute.out
mpls-traceroute-v mpls-traceroute.pcap mpls-traceroute-v.out -v
+mpls-over-udp mpls-over-udp.pcap mpls-over-udp.out
+mpls-over-udp-v mpls-over-udp.pcap mpls-over-udp-v.out -v
# OSPF tests
ospf-gmpls ospf-gmpls.pcap ospf-gmpls.out -v
diff --git a/tests/mpls-over-udp-v.out b/tests/mpls-over-udp-v.out
new file mode 100644
index 00000000..595aa53e
--- /dev/null
+++ b/tests/mpls-over-udp-v.out
@@ -0,0 +1,8 @@
+ 1 19:10:12.233047 IP (tos 0x0, ttl 64, id 26479, offset 0, flags [none], proto UDP (17), length 116)
+ 10.100.12.170.58699 > 10.100.13.157.6635: MPLS (label 21, exp 0, [S], ttl 63)
+ IP (tos 0x0, ttl 63, id 26479, offset 0, flags [DF], proto ICMP (1), length 84)
+ 10.3.0.10 > 10.1.0.10: ICMP echo request, id 42731, seq 16, length 64
+ 2 19:10:12.233101 IP (tos 0x0, ttl 64, id 46612, offset 0, flags [none], proto UDP (17), length 116)
+ 10.100.13.157.51348 > 10.100.12.170.6635: MPLS (label 46, exp 0, [S], ttl 63)
+ IP (tos 0x0, ttl 63, id 46612, offset 0, flags [none], proto ICMP (1), length 84)
+ 10.1.0.10 > 10.3.0.10: ICMP echo reply, id 42731, seq 16, length 64
diff --git a/tests/mpls-over-udp.out b/tests/mpls-over-udp.out
new file mode 100644
index 00000000..d5258980
--- /dev/null
+++ b/tests/mpls-over-udp.out
@@ -0,0 +1,2 @@
+ 1 19:10:12.233047 IP 10.100.12.170.58699 > 10.100.13.157.6635: MPLS (label 21, exp 0, [S], ttl 63) IP 10.3.0.10 > 10.1.0.10: ICMP echo request, id 42731, seq 16, length 64
+ 2 19:10:12.233101 IP 10.100.13.157.51348 > 10.100.12.170.6635: MPLS (label 46, exp 0, [S], ttl 63) IP 10.1.0.10 > 10.3.0.10: ICMP echo reply, id 42731, seq 16, length 64
diff --git a/tests/mpls-over-udp.pcap b/tests/mpls-over-udp.pcap
new file mode 100644
index 00000000..5f3b33c6
--- /dev/null
+++ b/tests/mpls-over-udp.pcap
Binary files differ
diff --git a/udp.h b/udp.h
index 0ac63387..f88641c8 100644
--- a/udp.h
+++ b/udp.h
@@ -203,6 +203,9 @@ struct udphdr {
#ifndef SFLOW_PORT
#define SFLOW_PORT 6343 /* https://sflow.org/developers/specifications.php */
#endif
+#ifndef MPLS_PORT
+#define MPLS_PORT 6635 /* RFC 7510 */
+#endif
#ifndef BABEL_PORT
#define BABEL_PORT 6696 /* RFC 6126 errata */
#endif