]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pgm.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-pgm.c
index c1c56932a21df2f7d56b99e81e0ee977fe695d6a..d9c1e2c2fe143e2f91f4ab14b26c6d9bc5296502 100644 (file)
 
 /* \summary: Pragmatic General Multicast (PGM) printer */
 
-#ifdef HAVE_CONFIG_H
+/* specification: RFC 3208
+
+   Plus https://dl.acm.org/doi/pdf/10.1145/347057.347390 for PGMCC,
+   whence the ACK packet type comes; there are some I-Ds for PGMCC,
+   draft-ietf-rmt-bb-pgmcc-00 through draft-ietf-rmt-bb-pgmcc-03,
+   but none of them give any description of the packet-level
+   changes to PGM, unlike the paper in question, which merely gives
+   an *insufficient* description of said changes.  In particular,
+   it doesn't indicate what the packet type code for ACK is.
+
+   Luigi Rizzo's PGMCC code for FreeBSD, at
+
+      https://web.archive.org/web/20020302084503/http://info.iet.unipi.it/~luigi/pgm-code/
+
+   uses 0x0b (11) for ACK.
+
+   A capture file attached to
+
+      https://gitlab.com/wireshark/wireshark/-/issues/4798
+
+   has packets that use 0x0d for ACK, as does the Wireshark dissector
+   for PGM, and as does OpenPGM at https://github.com/steve-o/openpgm.
+   It may be that some proprietary PGMCC implementations, such as
+   SmartPGM, do so as well.
+
+   We use *both*, treating *either one* as a PGMCC ACK, pending
+   more information, such as an answer to
+
+      https://github.com/steve-o/openpgm/issues/75.
+
+   */
+
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -96,17 +126,17 @@ struct pgm_data {
 };
 
 typedef enum _pgm_type {
-    PGM_SPM = 0,               /* source path message */
-    PGM_POLL = 1,              /* POLL Request */
-    PGM_POLR = 2,              /* POLL Response */
-    PGM_ODATA = 4,             /* original data */
-    PGM_RDATA = 5,             /* repair data */
-    PGM_NAK = 8,               /* NAK */
-    PGM_NULLNAK = 9,           /* Null NAK */
-    PGM_NCF = 10,              /* NAK Confirmation */
-    PGM_ACK = 11,              /* ACK for congestion control */
-    PGM_SPMR = 12,             /* SPM request */
-    PGM_MAX = 255
+    PGM_SPM = 0x00,            /* source path message */
+    PGM_POLL = 0x01,           /* POLL Request */
+    PGM_POLR = 0x02,           /* POLL Response */
+    PGM_ODATA = 0x04,          /* original data */
+    PGM_RDATA = 0x05,          /* repair data */
+    PGM_NAK = 0x08,            /* NAK */
+    PGM_NULLNAK = 0x09,                /* Null NAK */
+    PGM_NCF = 0x0a,            /* NAK Confirmation */
+    PGM_ACK = 0x0b,            /* ACK for congestion control? */
+    PGM_SPMR = 0x0c,           /* SPM request */
+    PGM_ACK2 = 0x0d,           /* Also ACK for congestion control? */
 } pgm_type;
 
 #define PGM_OPT_BIT_PRESENT    0x01
@@ -242,7 +272,6 @@ pgm_print(netdissect_options *ndo,
                break;
            default:
                goto invalid;
-               break;
            }
 
            ND_PRINT("SPM seq %u trail %u lead %u nla %s",
@@ -274,7 +303,6 @@ pgm_print(netdissect_options *ndo,
                break;
            default:
                goto invalid;
-               break;
            }
 
            ivl = GET_BE_U_4(bp);
@@ -352,7 +380,6 @@ pgm_print(netdissect_options *ndo,
                break;
            default:
                goto invalid;
-               break;
            }
 
            /*
@@ -373,7 +400,6 @@ pgm_print(netdissect_options *ndo,
                break;
            default:
                goto invalid;
-               break;
            }
 
            /*
@@ -397,7 +423,8 @@ pgm_print(netdissect_options *ndo,
            break;
        }
 
-       case PGM_ACK: {
+       case PGM_ACK:
+       case PGM_ACK2: {
            const struct pgm_ack *ack;
 
            ack = (const struct pgm_ack *)bp;
@@ -597,7 +624,6 @@ pgm_print(netdissect_options *ndo,
                        break;
                    default:
                        goto invalid;
-                       break;
                    }
 
                    ND_PRINT(" REDIRECT %s",  nla_buf);
@@ -659,7 +685,7 @@ pgm_print(netdissect_options *ndo,
 
                case PGM_OPT_PATH_NLA:
                    ND_PRINT(" PATH_NLA [%u]", opt_len);
-                   bp += opt_len;
+                   bp += opt_len - 2;
                    opts_len -= opt_len;
                    break;
 
@@ -701,7 +727,7 @@ pgm_print(netdissect_options *ndo,
 
                case PGM_OPT_CR:
                    ND_PRINT(" CR");
-                   bp += opt_len;
+                   bp += opt_len - 2;
                    opts_len -= opt_len;
                    break;
 
@@ -754,7 +780,6 @@ pgm_print(netdissect_options *ndo,
                        break;
                    default:
                        goto invalid;
-                       break;
                    }
 
                    ND_PRINT(" PGMCC DATA %u %s", offset, nla_buf);
@@ -797,7 +822,6 @@ pgm_print(netdissect_options *ndo,
                        break;
                    default:
                        goto invalid;
-                       break;
                    }
 
                    ND_PRINT(" PGMCC FEEDBACK %u %s", offset, nla_buf);
@@ -805,7 +829,7 @@ pgm_print(netdissect_options *ndo,
 
                default:
                    ND_PRINT(" OPT_%02X [%u] ", opt_type, opt_len);
-                   bp += opt_len;
+                   bp += opt_len - 2;
                    opts_len -= opt_len;
                    break;
                }