From: Denis Ovsienko Date: Thu, 14 Mar 2013 17:17:53 +0000 (+0400) Subject: use existing PGM decoder for UDP-encapsulated PGM X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/ceb4c7fc1e567783133d2f61b0fdcdc2e94d1f63 use existing PGM decoder for UDP-encapsulated PGM The original PGM uses its own IP protocol number. "EPGM" or "PGM/UDP" stands for UDP-encapsulated PGM, which has no assigned UDP port number and can be decoded only by means of -T option, which now accepts "pgm" protocol type for this purpose. There is also a sample capture of EPGM now (similar to the one of native PGM, but produced using the "epgm://" protocol schema) and a respective test case. --- diff --git a/interface.h b/interface.h index ed2ab847..797e362f 100644 --- a/interface.h +++ b/interface.h @@ -74,6 +74,7 @@ extern char *strsep(char **, const char *); #define PT_RADIUS 11 /* RADIUS authentication Protocol */ #define PT_ZMTP1 12 /* ZeroMQ Message Transport Protocol 1.0 */ #define PT_VXLAN 13 /* Virtual eXtensible Local Area Network */ +#define PT_PGM 14 /* [UDP-encapsulated] Pragmatic General Multicast */ #ifndef min #define min(a,b) ((a)>(b)?(b):(a)) diff --git a/netdissect.h b/netdissect.h index da52e463..a808f2e0 100644 --- a/netdissect.h +++ b/netdissect.h @@ -183,6 +183,7 @@ struct netdissect_options { #define PT_RADIUS 11 /* RADIUS authentication Protocol */ #define PT_ZMTP1 12 /* ZeroMQ Message Transport Protocol 1.0 */ #define PT_VXLAN 13 /* Virtual eXtensible Local Area Network */ +#define PT_PGM 14 /* [UDP-encapsulated] Pragmatic General Multicast */ #ifndef min #define min(a,b) ((a)>(b)?(b):(a)) diff --git a/print-udp.c b/print-udp.c index 1f265c27..39dc5d5c 100644 --- a/print-udp.c +++ b/print-udp.c @@ -479,6 +479,11 @@ udp_print(register const u_char *bp, u_int length, udpipaddr_print(ip, sport, dport); vxlan_print((const u_char *)(up + 1), length); break; + + case PT_PGM: + udpipaddr_print(ip, sport, dport); + pgm_print(cp, length, bp2); + break; } return; } diff --git a/tcpdump.1.in b/tcpdump.1.in index cb2fbdd3..c2569db3 100644 --- a/tcpdump.1.in +++ b/tcpdump.1.in @@ -519,6 +519,7 @@ Currently known types are \fBaodv\fR (Ad-hoc On-demand Distance Vector protocol), \fBcarp\fR (Common Address Redundancy Protocol), \fBcnfp\fR (Cisco NetFlow protocol), +\fBpgm\fR (Pragmatic General Multicast), \fBradius\fR (RADIUS), \fBrpc\fR (Remote Procedure Call), \fBrtp\fR (Real-Time Applications protocol), @@ -530,6 +531,10 @@ Currently known types are \fBzmtp1\fR (ZeroMQ Message Transport Protocol 1.0) and \fBvxlan\fR (Virtual eXtensible Local Area Network). +.IP +Note that the \fBpgm\fR type above affects UDP interpretation only, the native +PGM is always recognised as IP protocol 113 regardless. UDP-encapsulated PGM is +often called "EPGM" or "PGM/UDP". .TP .B \-t \fIDon't\fP print a timestamp on each dump line. diff --git a/tcpdump.c b/tcpdump.c index a4e8bf5a..a32701cf 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -1015,6 +1015,8 @@ main(int argc, char **argv) packettype = PT_ZMTP1; else if (strcasecmp(optarg, "vxlan") == 0) packettype = PT_VXLAN; + else if (strcasecmp(optarg, "pgm") == 0) + packettype = PT_PGM; else error("unknown packet type `%s'", optarg); break; diff --git a/tests/TESTLIST b/tests/TESTLIST index 6656337e..a6effed9 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -94,6 +94,8 @@ dhcpv6-ia-ta dhcpv6-ia-ta.pcap dhcpv6-ia-ta.out -t -v zmtp1v zmtp1.pcap zmtp1.out -t -v -T zmtp1 # native PGM pgmv pgm_zmtp1.pcap pgmv.out -t -v +# UDP-encapsulated PGM +epgmv epgm_zmtp1.pcap epgmv.out -t -v -T pgm # MS NLB tests msnlb msnlb.pcap msnlb.out -t diff --git a/tests/epgm_zmtp1.pcap b/tests/epgm_zmtp1.pcap new file mode 100644 index 00000000..18835794 Binary files /dev/null and b/tests/epgm_zmtp1.pcap differ diff --git a/tests/epgmv.out b/tests/epgmv.out new file mode 100644 index 00000000..ffa1b82a --- /dev/null +++ b/tests/epgmv.out @@ -0,0 +1,30 @@ +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 471 trail 0 lead 281 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 472 trail 0 lead 281 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 473 trail 0 lead 281 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 474 trail 0 lead 281 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 475 trail 0 lead 281 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 1480) + 10.0.0.45.40251 > 239.255.0.16.5563: 39236 > 5563: PGM, length 1428 0x47e3fdad9a9c ODATA trail 0 seq 282 [1452] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 1480) + 10.0.0.45.40251 > 239.255.0.16.5563: 39236 > 5563: PGM, length 1428 0x47e3fdad9a9c ODATA trail 0 seq 283 [1452] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 173) + 10.0.0.45.40251 > 239.255.0.16.5563: 39236 > 5563: PGM, length 121 0x47e3fdad9a9c ODATA trail 0 seq 284 [145] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 476 trail 0 lead 284 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 44) + 10.0.0.45.46357 > 239.255.0.16.5563: 5563 > 39236: PGM, length 0 0x47e3fdad9a9c SPMR [16] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 477 trail 0 lead 284 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 478 trail 0 lead 284 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 479 trail 0 lead 284 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 480 trail 0 lead 284 nla 10.0.0.45 [36] +IP (tos 0xb8, ttl 16, id 0, offset 0, flags [DF], proto UDP (17), length 64) + 10.0.0.45.33280 > 239.255.0.16.5563: 39236 > 5563: PGM, length 0 0x47e3fdad9a9c SPM seq 481 trail 0 lead 284 nla 10.0.0.45 [36]