]> The Tcpdump Group git mirrors - tcpdump/commitdiff
PGM: POLL and POLR packets were flip-flopped
authorBryce Wood <[email protected]>
Sat, 8 Jun 2019 19:06:59 +0000 (19:06 +0000)
committerfxlb <[email protected]>
Tue, 11 Jun 2019 07:40:52 +0000 (09:40 +0200)
Refer to RFC 3208 (Appendix D).

print-pgm.c

index 306c50d03ee91c6446071944c1fc06bc425b977e..a7ac64a8379d767067abba4593fb1c2279cf0a6e 100644 (file)
@@ -74,17 +74,17 @@ struct pgm_ack {
 struct pgm_poll {
     nd_uint32_t        pgmp_seq;
     nd_uint16_t        pgmp_round;
+    nd_uint16_t        pgmp_subtype;
+    nd_uint16_t        pgmp_nla_afi;
     nd_uint16_t        pgmp_reserved;
+    /* ... uint8_t     pgmp_nla[0]; */
     /* ... options */
 };
 
 struct pgm_polr {
     nd_uint32_t        pgmp_seq;
     nd_uint16_t        pgmp_round;
-    nd_uint16_t        pgmp_subtype;
-    nd_uint16_t        pgmp_nla_afi;
     nd_uint16_t        pgmp_reserved;
-    /* ... uint8_t     pgmp_nla[0]; */
     /* ... options */
 };
 
@@ -253,25 +253,14 @@ pgm_print(netdissect_options *ndo,
        }
 
        case PGM_POLL: {
-           const struct pgm_poll *poll_msg;
-
-           poll_msg = (const struct pgm_poll *)(pgm + 1);
-           ND_TCHECK_SIZE(poll_msg);
-           ND_PRINT("POLL seq %u round %u",
-                        GET_BE_U_4(poll_msg->pgmp_seq),
-                        GET_BE_U_2(poll_msg->pgmp_round));
-           bp = (const u_char *) (poll_msg + 1);
-           break;
-       }
-       case PGM_POLR: {
-           const struct pgm_polr *polr;
+           const struct pgm_poll *poll;
            uint32_t ivl, rnd, mask;
 
-           polr = (const struct pgm_polr *)(pgm + 1);
-           ND_TCHECK_SIZE(polr);
-           bp = (const u_char *) (polr + 1);
+           poll = (const struct pgm_poll *)(pgm + 1);
+           ND_TCHECK_SIZE(poll);
+           bp = (const u_char *) (poll + 1);
 
-           switch (GET_BE_U_2(polr->pgmp_nla_afi)) {
+           switch (GET_BE_U_2(poll->pgmp_nla_afi)) {
            case AFNUM_INET:
                ND_TCHECK_LEN(bp, sizeof(nd_ipv4));
                addrtostr(bp, nla_buf, sizeof(nla_buf));
@@ -299,12 +288,23 @@ pgm_print(netdissect_options *ndo,
            mask = GET_BE_U_4(bp);
            bp += sizeof(uint32_t);
 
-           ND_PRINT("POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
-                        "mask 0x%08x", GET_BE_U_4(polr->pgmp_seq),
-                        GET_BE_U_2(polr->pgmp_round), nla_buf, ivl, rnd,
+           ND_PRINT("POLL seq %u round %u nla %s ivl %u rnd 0x%08x "
+                        "mask 0x%08x", GET_BE_U_4(poll->pgmp_seq),
+                        GET_BE_U_2(poll->pgmp_round), nla_buf, ivl, rnd,
                         mask);
            break;
        }
+       case PGM_POLR: {
+           const struct pgm_polr *polr_msg;
+
+           polr_msg = (const struct pgm_polr *)(pgm + 1);
+           ND_TCHECK_SIZE(polr_msg);
+           ND_PRINT("POLR seq %u round %u",
+                        GET_BE_U_4(polr_msg->pgmp_seq),
+                        GET_BE_U_2(polr_msg->pgmp_round));
+           bp = (const u_char *) (polr_msg + 1);
+           break;
+       }
        case PGM_ODATA: {
            const struct pgm_data *odata;