]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Print MPLS-over-UDP. 822/head
authorsimonov-d <[email protected]>
Sat, 8 Feb 2020 19:25:38 +0000 (00:25 +0500)
committerdimmo <[email protected]>
Sat, 8 Feb 2020 19:51:39 +0000 (00:51 +0500)
print-udp.c
tests/TESTLIST
tests/mpls-over-udp-v.out [new file with mode: 0644]
tests/mpls-over-udp.out [new file with mode: 0644]
tests/mpls-over-udp.pcap [new file with mode: 0644]
udp.h

index 8c05217435a63a28228d32bcaf93a3af34e3d7c4..d130eee7752a5d1b665d8c99bf4f4513f7d36c4a 100644 (file)
@@ -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))) {
index a61fdfcfd0b9f43e2752b0d4f4753407a87fe7a5..fd08195ce1c63bc33b0b862991a612d8d364f861 100644 (file)
@@ -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 (file)
index 0000000..595aa53
--- /dev/null
@@ -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 (file)
index 0000000..d525898
--- /dev/null
@@ -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 (file)
index 0000000..5f3b33c
Binary files /dev/null and b/tests/mpls-over-udp.pcap differ
diff --git a/udp.h b/udp.h
index 0ac63387abee8ce29df321e6af4a9d45beb97690..f88641c809fb0bc8841404f66547df4f8c5171cf 100644 (file)
--- 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