2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
13 * Original code by Andy Heffernan (ahh@juniper.net)
16 /* \summary: Pragmatic General Multicast (PGM) printer */
18 /* specification: RFC 3208
20 Plus https://dl.acm.org/doi/pdf/10.1145/347057.347390 for PGMCC,
21 whence the ACK packet type comes; there are some I-Ds for PGMCC,
22 draft-ietf-rmt-bb-pgmcc-00 through draft-ietf-rmt-bb-pgmcc-03,
23 but none of them give any description of the packet-level
24 changes to PGM, unlike the paper in question, which merely gives
25 an *insufficient* description of said changes. In particular,
26 it doesn't indicate what the packet type code for ACK is.
28 Luigi Rizzo's PGMCC code for FreeBSD, at
30 https://web.archive.org/web/20020302084503/http://info.iet.unipi.it/~luigi/pgm-code/
32 uses 0x0b (11) for ACK.
34 A capture file attached to
36 https://gitlab.com/wireshark/wireshark/-/issues/4798
38 has packets that use 0x0d for ACK, as does the Wireshark dissector
39 for PGM, and as does OpenPGM at https://github.com/steve-o/openpgm.
40 It may be that some proprietary PGMCC implementations, such as
41 SmartPGM, do so as well.
43 We use *both*, treating *either one* as a PGMCC ACK, pending
44 more information, such as an answer to
46 https://github.com/steve-o/openpgm/issues/75.
54 #include "netdissect-stdinc.h"
56 #define ND_LONGJMP_FROM_TCHECK
57 #include "netdissect.h"
59 #include "addrtoname.h"
60 #include "addrtostr.h"
68 * PGM header (RFC 3208)
71 nd_uint16_t pgm_sport
;
72 nd_uint16_t pgm_dport
;
74 nd_uint8_t pgm_options
;
77 nd_uint16_t pgm_length
;
82 nd_uint32_t pgms_trailseq
;
83 nd_uint32_t pgms_leadseq
;
84 nd_uint16_t pgms_nla_afi
;
85 nd_uint16_t pgms_reserved
;
86 /* ... uint8_t pgms_nla[0]; */
92 nd_uint16_t pgmn_source_afi
;
93 nd_uint16_t pgmn_reserved
;
94 /* ... uint8_t pgmn_source[0]; */
95 /* ... uint16_t pgmn_group_afi */
96 /* ... uint16_t pgmn_reserved2; */
97 /* ... uint8_t pgmn_group[0]; */
102 nd_uint32_t pgma_rx_max_seq
;
103 nd_uint32_t pgma_bitmap
;
108 nd_uint32_t pgmp_seq
;
109 nd_uint16_t pgmp_round
;
110 nd_uint16_t pgmp_subtype
;
111 nd_uint16_t pgmp_nla_afi
;
112 nd_uint16_t pgmp_reserved
;
113 /* ... uint8_t pgmp_nla[0]; */
118 nd_uint32_t pgmp_seq
;
119 nd_uint16_t pgmp_round
;
120 nd_uint16_t pgmp_reserved
;
125 nd_uint32_t pgmd_seq
;
126 nd_uint32_t pgmd_trailseq
;
130 typedef enum _pgm_type
{
131 PGM_SPM
= 0x00, /* source path message */
132 PGM_POLL
= 0x01, /* POLL Request */
133 PGM_POLR
= 0x02, /* POLL Response */
134 PGM_ODATA
= 0x04, /* original data */
135 PGM_RDATA
= 0x05, /* repair data */
136 PGM_NAK
= 0x08, /* NAK */
137 PGM_NULLNAK
= 0x09, /* Null NAK */
138 PGM_NCF
= 0x0a, /* NAK Confirmation */
139 PGM_ACK
= 0x0b, /* ACK for congestion control? */
140 PGM_SPMR
= 0x0c, /* SPM request */
141 PGM_ACK2
= 0x0d, /* Also ACK for congestion control? */
144 #define PGM_OPT_BIT_PRESENT 0x01
145 #define PGM_OPT_BIT_NETWORK 0x02
146 #define PGM_OPT_BIT_VAR_PKTLEN 0x40
147 #define PGM_OPT_BIT_PARITY 0x80
149 #define PGM_OPT_LENGTH 0x00
150 #define PGM_OPT_FRAGMENT 0x01
151 #define PGM_OPT_NAK_LIST 0x02
152 #define PGM_OPT_JOIN 0x03
153 #define PGM_OPT_NAK_BO_IVL 0x04
154 #define PGM_OPT_NAK_BO_RNG 0x05
156 #define PGM_OPT_REDIRECT 0x07
157 #define PGM_OPT_PARITY_PRM 0x08
158 #define PGM_OPT_PARITY_GRP 0x09
159 #define PGM_OPT_CURR_TGSIZE 0x0A
160 #define PGM_OPT_NBR_UNREACH 0x0B
161 #define PGM_OPT_PATH_NLA 0x0C
163 #define PGM_OPT_SYN 0x0D
164 #define PGM_OPT_FIN 0x0E
165 #define PGM_OPT_RST 0x0F
166 #define PGM_OPT_CR 0x10
167 #define PGM_OPT_CRQST 0x11
169 #define PGM_OPT_PGMCC_DATA 0x12
170 #define PGM_OPT_PGMCC_FEEDBACK 0x13
172 #define PGM_OPT_MASK 0x7f
174 #define PGM_OPT_END 0x80 /* end of options marker */
176 #define PGM_MIN_OPT_LEN 4
179 pgm_print(netdissect_options
*ndo
,
180 const u_char
*bp
, u_int length
,
183 const struct pgm_header
*pgm
;
185 uint8_t pgm_type_val
;
186 uint16_t sport
, dport
;
188 char nla_buf
[INET6_ADDRSTRLEN
];
189 const struct ip6_hdr
*ip6
;
190 uint8_t opt_type
, opt_len
;
191 uint32_t seq
, opts_len
, len
, offset
;
193 ndo
->ndo_protocol
= "pgm";
194 pgm
= (const struct pgm_header
*)bp
;
195 ip
= (const struct ip
*)bp2
;
197 ip6
= (const struct ip6_hdr
*)bp2
;
200 if (!ND_TTEST_2(pgm
->pgm_dport
)) {
203 GET_IP6ADDR_STRING(ip6
->ip6_src
),
204 GET_IP6ADDR_STRING(ip6
->ip6_dst
));
207 GET_IPADDR_STRING(ip
->ip_src
),
208 GET_IPADDR_STRING(ip
->ip_dst
));
210 nd_trunc_longjmp(ndo
);
213 sport
= GET_BE_U_2(pgm
->pgm_sport
);
214 dport
= GET_BE_U_2(pgm
->pgm_dport
);
217 if (GET_U_1(ip6
->ip6_nxt
) == IPPROTO_PGM
) {
218 ND_PRINT("%s.%s > %s.%s: ",
219 GET_IP6ADDR_STRING(ip6
->ip6_src
),
220 tcpport_string(ndo
, sport
),
221 GET_IP6ADDR_STRING(ip6
->ip6_dst
),
222 tcpport_string(ndo
, dport
));
224 ND_PRINT("%s > %s: ",
225 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
228 if (GET_U_1(ip
->ip_p
) == IPPROTO_PGM
) {
229 ND_PRINT("%s.%s > %s.%s: ",
230 GET_IPADDR_STRING(ip
->ip_src
),
231 tcpport_string(ndo
, sport
),
232 GET_IPADDR_STRING(ip
->ip_dst
),
233 tcpport_string(ndo
, dport
));
235 ND_PRINT("%s > %s: ",
236 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
242 ND_PRINT("PGM, length %u", GET_BE_U_2(pgm
->pgm_length
));
247 pgm_type_val
= GET_U_1(pgm
->pgm_type
);
248 ND_PRINT(" 0x%02x%02x%02x%02x%02x%02x ",
255 bp
+= sizeof(struct pgm_header
);
256 switch (pgm_type_val
) {
258 const struct pgm_spm
*spm
;
260 spm
= (const struct pgm_spm
*)bp
;
262 bp
+= sizeof(struct pgm_spm
);
264 switch (GET_BE_U_2(spm
->pgms_nla_afi
)) {
266 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
267 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
268 bp
+= sizeof(nd_ipv4
);
271 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
272 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
273 bp
+= sizeof(nd_ipv6
);
279 ND_PRINT("SPM seq %u trail %u lead %u nla %s",
280 GET_BE_U_4(spm
->pgms_seq
),
281 GET_BE_U_4(spm
->pgms_trailseq
),
282 GET_BE_U_4(spm
->pgms_leadseq
),
288 const struct pgm_poll
*pgm_poll
;
289 uint32_t ivl
, rnd
, mask
;
291 pgm_poll
= (const struct pgm_poll
*)bp
;
292 ND_TCHECK_SIZE(pgm_poll
);
293 bp
+= sizeof(struct pgm_poll
);
295 switch (GET_BE_U_2(pgm_poll
->pgmp_nla_afi
)) {
297 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
298 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
299 bp
+= sizeof(nd_ipv4
);
302 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
303 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
304 bp
+= sizeof(nd_ipv6
);
310 ivl
= GET_BE_U_4(bp
);
311 bp
+= sizeof(uint32_t);
313 rnd
= GET_BE_U_4(bp
);
314 bp
+= sizeof(uint32_t);
316 mask
= GET_BE_U_4(bp
);
317 bp
+= sizeof(uint32_t);
319 ND_PRINT("POLL seq %u round %u nla %s ivl %u rnd 0x%08x "
320 "mask 0x%08x", GET_BE_U_4(pgm_poll
->pgmp_seq
),
321 GET_BE_U_2(pgm_poll
->pgmp_round
), nla_buf
, ivl
, rnd
,
326 const struct pgm_polr
*polr_msg
;
328 polr_msg
= (const struct pgm_polr
*)bp
;
329 ND_TCHECK_SIZE(polr_msg
);
330 ND_PRINT("POLR seq %u round %u",
331 GET_BE_U_4(polr_msg
->pgmp_seq
),
332 GET_BE_U_2(polr_msg
->pgmp_round
));
333 bp
+= sizeof(struct pgm_polr
);
337 const struct pgm_data
*odata
;
339 odata
= (const struct pgm_data
*)bp
;
340 ND_PRINT("ODATA trail %u seq %u",
341 GET_BE_U_4(odata
->pgmd_trailseq
),
342 GET_BE_U_4(odata
->pgmd_seq
));
343 bp
+= sizeof(struct pgm_data
);
348 const struct pgm_data
*rdata
;
350 rdata
= (const struct pgm_data
*)bp
;
351 ND_PRINT("RDATA trail %u seq %u",
352 GET_BE_U_4(rdata
->pgmd_trailseq
),
353 GET_BE_U_4(rdata
->pgmd_seq
));
354 bp
+= sizeof(struct pgm_data
);
361 const struct pgm_nak
*nak
;
362 char source_buf
[INET6_ADDRSTRLEN
], group_buf
[INET6_ADDRSTRLEN
];
364 nak
= (const struct pgm_nak
*)bp
;
366 bp
+= sizeof(struct pgm_nak
);
369 * Skip past the source, saving info along the way
370 * and stopping if we don't have enough.
372 switch (GET_BE_U_2(nak
->pgmn_source_afi
)) {
374 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
375 addrtostr(bp
, source_buf
, sizeof(source_buf
));
376 bp
+= sizeof(nd_ipv4
);
379 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
380 addrtostr6(bp
, source_buf
, sizeof(source_buf
));
381 bp
+= sizeof(nd_ipv6
);
388 * Skip past the group, saving info along the way
389 * and stopping if we don't have enough.
391 bp
+= (2 * sizeof(uint16_t));
392 switch (GET_BE_U_2(bp
)) {
394 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
395 addrtostr(bp
, group_buf
, sizeof(group_buf
));
396 bp
+= sizeof(nd_ipv4
);
399 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
400 addrtostr6(bp
, group_buf
, sizeof(group_buf
));
401 bp
+= sizeof(nd_ipv6
);
408 * Options decoding can go here.
410 switch (pgm_type_val
) {
423 ND_PRINT("(%s -> %s), seq %u",
424 source_buf
, group_buf
, GET_BE_U_4(nak
->pgmn_seq
));
430 const struct pgm_ack
*ack
;
432 ack
= (const struct pgm_ack
*)bp
;
434 ND_PRINT("ACK seq %u",
435 GET_BE_U_4(ack
->pgma_rx_max_seq
));
436 bp
+= sizeof(struct pgm_ack
);
445 ND_PRINT("UNKNOWN type 0x%02x", pgm_type_val
);
449 if (GET_U_1(pgm
->pgm_options
) & PGM_OPT_BIT_PRESENT
) {
452 * make sure there's enough for the first option header
454 ND_TCHECK_LEN(bp
, PGM_MIN_OPT_LEN
);
457 * That option header MUST be an OPT_LENGTH option
458 * (see the first paragraph of section 9.1 in RFC 3208).
460 opt_type
= GET_U_1(bp
);
462 if ((opt_type
& PGM_OPT_MASK
) != PGM_OPT_LENGTH
) {
463 ND_PRINT("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type
& PGM_OPT_MASK
);
466 opt_len
= GET_U_1(bp
);
469 ND_PRINT("[Bad OPT_LENGTH option, length %u != 4]", opt_len
);
472 opts_len
= GET_BE_U_2(bp
);
473 bp
+= sizeof(uint16_t);
475 ND_PRINT("[Bad total option length %u < 4]", opts_len
);
478 ND_PRINT(" OPTS LEN %u", opts_len
);
482 if (opts_len
< PGM_MIN_OPT_LEN
) {
483 ND_PRINT("[Total option length leaves no room for final option]");
486 opt_type
= GET_U_1(bp
);
488 opt_len
= GET_U_1(bp
);
490 if (opt_len
< PGM_MIN_OPT_LEN
) {
491 ND_PRINT("[Bad option, length %u < %u]", opt_len
,
495 if (opts_len
< opt_len
) {
496 ND_PRINT("[Total option length leaves no room for final option]");
499 ND_TCHECK_LEN(bp
, opt_len
- 2);
501 switch (opt_type
& PGM_OPT_MASK
) {
503 #define PGM_OPT_LENGTH_LEN (2+2)
504 if (opt_len
!= PGM_OPT_LENGTH_LEN
) {
505 ND_PRINT("[Bad OPT_LENGTH option, length %u != %u]",
506 opt_len
, PGM_OPT_LENGTH_LEN
);
509 ND_PRINT(" OPTS LEN (extra?) %u", GET_BE_U_2(bp
));
511 opts_len
-= PGM_OPT_LENGTH_LEN
;
514 case PGM_OPT_FRAGMENT
:
515 #define PGM_OPT_FRAGMENT_LEN (2+2+4+4+4)
516 if (opt_len
!= PGM_OPT_FRAGMENT_LEN
) {
517 ND_PRINT("[Bad OPT_FRAGMENT option, length %u != %u]",
518 opt_len
, PGM_OPT_FRAGMENT_LEN
);
522 seq
= GET_BE_U_4(bp
);
524 offset
= GET_BE_U_4(bp
);
526 len
= GET_BE_U_4(bp
);
528 ND_PRINT(" FRAG seq %u off %u len %u", seq
, offset
, len
);
529 opts_len
-= PGM_OPT_FRAGMENT_LEN
;
532 case PGM_OPT_NAK_LIST
:
534 opt_len
-= 4; /* option header */
535 ND_PRINT(" NAK LIST");
538 ND_PRINT("[Option length not a multiple of 4]");
541 ND_PRINT(" %u", GET_BE_U_4(bp
));
549 #define PGM_OPT_JOIN_LEN (2+2+4)
550 if (opt_len
!= PGM_OPT_JOIN_LEN
) {
551 ND_PRINT("[Bad OPT_JOIN option, length %u != %u]",
552 opt_len
, PGM_OPT_JOIN_LEN
);
556 seq
= GET_BE_U_4(bp
);
558 ND_PRINT(" JOIN %u", seq
);
559 opts_len
-= PGM_OPT_JOIN_LEN
;
562 case PGM_OPT_NAK_BO_IVL
:
563 #define PGM_OPT_NAK_BO_IVL_LEN (2+2+4+4)
564 if (opt_len
!= PGM_OPT_NAK_BO_IVL_LEN
) {
565 ND_PRINT("[Bad OPT_NAK_BO_IVL option, length %u != %u]",
566 opt_len
, PGM_OPT_NAK_BO_IVL_LEN
);
570 offset
= GET_BE_U_4(bp
);
572 seq
= GET_BE_U_4(bp
);
574 ND_PRINT(" BACKOFF ivl %u ivlseq %u", offset
, seq
);
575 opts_len
-= PGM_OPT_NAK_BO_IVL_LEN
;
578 case PGM_OPT_NAK_BO_RNG
:
579 #define PGM_OPT_NAK_BO_RNG_LEN (2+2+4+4)
580 if (opt_len
!= PGM_OPT_NAK_BO_RNG_LEN
) {
581 ND_PRINT("[Bad OPT_NAK_BO_RNG option, length %u != %u]",
582 opt_len
, PGM_OPT_NAK_BO_RNG_LEN
);
586 offset
= GET_BE_U_4(bp
);
588 seq
= GET_BE_U_4(bp
);
590 ND_PRINT(" BACKOFF max %u min %u", offset
, seq
);
591 opts_len
-= PGM_OPT_NAK_BO_RNG_LEN
;
594 case PGM_OPT_REDIRECT
:
595 #define PGM_OPT_REDIRECT_FIXED_LEN (2+2+2+2)
596 if (opt_len
< PGM_OPT_REDIRECT_FIXED_LEN
) {
597 ND_PRINT("[Bad OPT_REDIRECT option, length %u < %u]",
598 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
602 nla_afnum
= GET_BE_U_2(bp
);
606 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
)) {
607 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
608 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
611 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
612 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
613 bp
+= sizeof(nd_ipv4
);
614 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
);
617 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
)) {
618 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
619 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
622 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
623 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
624 bp
+= sizeof(nd_ipv6
);
625 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
);
631 ND_PRINT(" REDIRECT %s", nla_buf
);
634 case PGM_OPT_PARITY_PRM
:
635 #define PGM_OPT_PARITY_PRM_LEN (2+2+4)
636 if (opt_len
!= PGM_OPT_PARITY_PRM_LEN
) {
637 ND_PRINT("[Bad OPT_PARITY_PRM option, length %u != %u]",
638 opt_len
, PGM_OPT_PARITY_PRM_LEN
);
642 len
= GET_BE_U_4(bp
);
644 ND_PRINT(" PARITY MAXTGS %u", len
);
645 opts_len
-= PGM_OPT_PARITY_PRM_LEN
;
648 case PGM_OPT_PARITY_GRP
:
649 #define PGM_OPT_PARITY_GRP_LEN (2+2+4)
650 if (opt_len
!= PGM_OPT_PARITY_GRP_LEN
) {
651 ND_PRINT("[Bad OPT_PARITY_GRP option, length %u != %u]",
652 opt_len
, PGM_OPT_PARITY_GRP_LEN
);
656 seq
= GET_BE_U_4(bp
);
658 ND_PRINT(" PARITY GROUP %u", seq
);
659 opts_len
-= PGM_OPT_PARITY_GRP_LEN
;
662 case PGM_OPT_CURR_TGSIZE
:
663 #define PGM_OPT_CURR_TGSIZE_LEN (2+2+4)
664 if (opt_len
!= PGM_OPT_CURR_TGSIZE_LEN
) {
665 ND_PRINT("[Bad OPT_CURR_TGSIZE option, length %u != %u]",
666 opt_len
, PGM_OPT_CURR_TGSIZE_LEN
);
670 len
= GET_BE_U_4(bp
);
672 ND_PRINT(" PARITY ATGS %u", len
);
673 opts_len
-= PGM_OPT_CURR_TGSIZE_LEN
;
676 case PGM_OPT_NBR_UNREACH
:
677 #define PGM_OPT_NBR_UNREACH_LEN (2+2)
678 if (opt_len
!= PGM_OPT_NBR_UNREACH_LEN
) {
679 ND_PRINT("[Bad OPT_NBR_UNREACH option, length %u != %u]",
680 opt_len
, PGM_OPT_NBR_UNREACH_LEN
);
684 ND_PRINT(" NBR_UNREACH");
685 opts_len
-= PGM_OPT_NBR_UNREACH_LEN
;
688 case PGM_OPT_PATH_NLA
:
689 ND_PRINT(" PATH_NLA [%u]", opt_len
);
695 #define PGM_OPT_SYN_LEN (2+2)
696 if (opt_len
!= PGM_OPT_SYN_LEN
) {
697 ND_PRINT("[Bad OPT_SYN option, length %u != %u]",
698 opt_len
, PGM_OPT_SYN_LEN
);
703 opts_len
-= PGM_OPT_SYN_LEN
;
707 #define PGM_OPT_FIN_LEN (2+2)
708 if (opt_len
!= PGM_OPT_FIN_LEN
) {
709 ND_PRINT("[Bad OPT_FIN option, length %u != %u]",
710 opt_len
, PGM_OPT_FIN_LEN
);
715 opts_len
-= PGM_OPT_FIN_LEN
;
719 #define PGM_OPT_RST_LEN (2+2)
720 if (opt_len
!= PGM_OPT_RST_LEN
) {
721 ND_PRINT("[Bad OPT_RST option, length %u != %u]",
722 opt_len
, PGM_OPT_RST_LEN
);
727 opts_len
-= PGM_OPT_RST_LEN
;
737 #define PGM_OPT_CRQST_LEN (2+2)
738 if (opt_len
!= PGM_OPT_CRQST_LEN
) {
739 ND_PRINT("[Bad OPT_CRQST option, length %u != %u]",
740 opt_len
, PGM_OPT_CRQST_LEN
);
745 opts_len
-= PGM_OPT_CRQST_LEN
;
748 case PGM_OPT_PGMCC_DATA
:
749 #define PGM_OPT_PGMCC_DATA_FIXED_LEN (2+2+4+2+2)
750 if (opt_len
< PGM_OPT_PGMCC_DATA_FIXED_LEN
) {
751 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u < %u]",
752 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
756 offset
= GET_BE_U_4(bp
);
758 nla_afnum
= GET_BE_U_2(bp
);
762 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
)) {
763 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
764 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
767 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
768 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
769 bp
+= sizeof(nd_ipv4
);
770 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
);
773 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
)) {
774 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
775 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
778 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
779 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
780 bp
+= sizeof(nd_ipv6
);
781 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
);
787 ND_PRINT(" PGMCC DATA %u %s", offset
, nla_buf
);
790 case PGM_OPT_PGMCC_FEEDBACK
:
791 #define PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN (2+2+4+2+2)
792 if (opt_len
< PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
) {
793 ND_PRINT("[Bad PGM_OPT_PGMCC_FEEDBACK option, length %u < %u]",
794 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
798 offset
= GET_BE_U_4(bp
);
800 nla_afnum
= GET_BE_U_2(bp
);
804 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
)) {
805 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
806 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
809 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
810 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
811 bp
+= sizeof(nd_ipv4
);
812 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
);
815 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
)) {
816 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
817 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
820 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
821 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
822 bp
+= sizeof(nd_ipv6
);
823 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
);
829 ND_PRINT(" PGMCC FEEDBACK %u %s", offset
, nla_buf
);
833 ND_PRINT(" OPT_%02X [%u] ", opt_type
, opt_len
);
839 if (opt_type
& PGM_OPT_END
)
844 ND_PRINT(" [%u]", length
);
845 if (ndo
->ndo_packettype
== PT_PGM_ZMTP1
&&
846 (pgm_type_val
== PGM_ODATA
|| pgm_type_val
== PGM_RDATA
))
847 zmtp1_datagram_print(ndo
, bp
,
848 GET_BE_U_2(pgm
->pgm_length
));
852 nd_print_invalid(ndo
);