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
);
280 ND_PRINT("SPM seq %u trail %u lead %u nla %s",
281 GET_BE_U_4(spm
->pgms_seq
),
282 GET_BE_U_4(spm
->pgms_trailseq
),
283 GET_BE_U_4(spm
->pgms_leadseq
),
289 const struct pgm_poll
*pgm_poll
;
290 uint32_t ivl
, rnd
, mask
;
292 pgm_poll
= (const struct pgm_poll
*)bp
;
293 ND_TCHECK_SIZE(pgm_poll
);
294 bp
+= sizeof(struct pgm_poll
);
296 switch (GET_BE_U_2(pgm_poll
->pgmp_nla_afi
)) {
298 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
299 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
300 bp
+= sizeof(nd_ipv4
);
303 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
304 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
305 bp
+= sizeof(nd_ipv6
);
312 ivl
= GET_BE_U_4(bp
);
313 bp
+= sizeof(uint32_t);
315 rnd
= GET_BE_U_4(bp
);
316 bp
+= sizeof(uint32_t);
318 mask
= GET_BE_U_4(bp
);
319 bp
+= sizeof(uint32_t);
321 ND_PRINT("POLL seq %u round %u nla %s ivl %u rnd 0x%08x "
322 "mask 0x%08x", GET_BE_U_4(pgm_poll
->pgmp_seq
),
323 GET_BE_U_2(pgm_poll
->pgmp_round
), nla_buf
, ivl
, rnd
,
328 const struct pgm_polr
*polr_msg
;
330 polr_msg
= (const struct pgm_polr
*)bp
;
331 ND_TCHECK_SIZE(polr_msg
);
332 ND_PRINT("POLR seq %u round %u",
333 GET_BE_U_4(polr_msg
->pgmp_seq
),
334 GET_BE_U_2(polr_msg
->pgmp_round
));
335 bp
+= sizeof(struct pgm_polr
);
339 const struct pgm_data
*odata
;
341 odata
= (const struct pgm_data
*)bp
;
342 ND_PRINT("ODATA trail %u seq %u",
343 GET_BE_U_4(odata
->pgmd_trailseq
),
344 GET_BE_U_4(odata
->pgmd_seq
));
345 bp
+= sizeof(struct pgm_data
);
350 const struct pgm_data
*rdata
;
352 rdata
= (const struct pgm_data
*)bp
;
353 ND_PRINT("RDATA trail %u seq %u",
354 GET_BE_U_4(rdata
->pgmd_trailseq
),
355 GET_BE_U_4(rdata
->pgmd_seq
));
356 bp
+= sizeof(struct pgm_data
);
363 const struct pgm_nak
*nak
;
364 char source_buf
[INET6_ADDRSTRLEN
], group_buf
[INET6_ADDRSTRLEN
];
366 nak
= (const struct pgm_nak
*)bp
;
368 bp
+= sizeof(struct pgm_nak
);
371 * Skip past the source, saving info along the way
372 * and stopping if we don't have enough.
374 switch (GET_BE_U_2(nak
->pgmn_source_afi
)) {
376 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
377 addrtostr(bp
, source_buf
, sizeof(source_buf
));
378 bp
+= sizeof(nd_ipv4
);
381 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
382 addrtostr6(bp
, source_buf
, sizeof(source_buf
));
383 bp
+= sizeof(nd_ipv6
);
391 * Skip past the group, saving info along the way
392 * and stopping if we don't have enough.
394 bp
+= (2 * sizeof(uint16_t));
395 switch (GET_BE_U_2(bp
)) {
397 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
398 addrtostr(bp
, group_buf
, sizeof(group_buf
));
399 bp
+= sizeof(nd_ipv4
);
402 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
403 addrtostr6(bp
, group_buf
, sizeof(group_buf
));
404 bp
+= sizeof(nd_ipv6
);
412 * Options decoding can go here.
414 switch (pgm_type_val
) {
427 ND_PRINT("(%s -> %s), seq %u",
428 source_buf
, group_buf
, GET_BE_U_4(nak
->pgmn_seq
));
434 const struct pgm_ack
*ack
;
436 ack
= (const struct pgm_ack
*)bp
;
438 ND_PRINT("ACK seq %u",
439 GET_BE_U_4(ack
->pgma_rx_max_seq
));
440 bp
+= sizeof(struct pgm_ack
);
449 ND_PRINT("UNKNOWN type 0x%02x", pgm_type_val
);
453 if (GET_U_1(pgm
->pgm_options
) & PGM_OPT_BIT_PRESENT
) {
456 * make sure there's enough for the first option header
458 ND_TCHECK_LEN(bp
, PGM_MIN_OPT_LEN
);
461 * That option header MUST be an OPT_LENGTH option
462 * (see the first paragraph of section 9.1 in RFC 3208).
464 opt_type
= GET_U_1(bp
);
466 if ((opt_type
& PGM_OPT_MASK
) != PGM_OPT_LENGTH
) {
467 ND_PRINT("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type
& PGM_OPT_MASK
);
470 opt_len
= GET_U_1(bp
);
473 ND_PRINT("[Bad OPT_LENGTH option, length %u != 4]", opt_len
);
476 opts_len
= GET_BE_U_2(bp
);
477 bp
+= sizeof(uint16_t);
479 ND_PRINT("[Bad total option length %u < 4]", opts_len
);
482 ND_PRINT(" OPTS LEN %u", opts_len
);
486 if (opts_len
< PGM_MIN_OPT_LEN
) {
487 ND_PRINT("[Total option length leaves no room for final option]");
490 opt_type
= GET_U_1(bp
);
492 opt_len
= GET_U_1(bp
);
494 if (opt_len
< PGM_MIN_OPT_LEN
) {
495 ND_PRINT("[Bad option, length %u < %u]", opt_len
,
499 if (opts_len
< opt_len
) {
500 ND_PRINT("[Total option length leaves no room for final option]");
503 ND_TCHECK_LEN(bp
, opt_len
- 2);
505 switch (opt_type
& PGM_OPT_MASK
) {
507 #define PGM_OPT_LENGTH_LEN (2+2)
508 if (opt_len
!= PGM_OPT_LENGTH_LEN
) {
509 ND_PRINT("[Bad OPT_LENGTH option, length %u != %u]",
510 opt_len
, PGM_OPT_LENGTH_LEN
);
513 ND_PRINT(" OPTS LEN (extra?) %u", GET_BE_U_2(bp
));
515 opts_len
-= PGM_OPT_LENGTH_LEN
;
518 case PGM_OPT_FRAGMENT
:
519 #define PGM_OPT_FRAGMENT_LEN (2+2+4+4+4)
520 if (opt_len
!= PGM_OPT_FRAGMENT_LEN
) {
521 ND_PRINT("[Bad OPT_FRAGMENT option, length %u != %u]",
522 opt_len
, PGM_OPT_FRAGMENT_LEN
);
526 seq
= GET_BE_U_4(bp
);
528 offset
= GET_BE_U_4(bp
);
530 len
= GET_BE_U_4(bp
);
532 ND_PRINT(" FRAG seq %u off %u len %u", seq
, offset
, len
);
533 opts_len
-= PGM_OPT_FRAGMENT_LEN
;
536 case PGM_OPT_NAK_LIST
:
538 opt_len
-= 4; /* option header */
539 ND_PRINT(" NAK LIST");
542 ND_PRINT("[Option length not a multiple of 4]");
545 ND_PRINT(" %u", GET_BE_U_4(bp
));
553 #define PGM_OPT_JOIN_LEN (2+2+4)
554 if (opt_len
!= PGM_OPT_JOIN_LEN
) {
555 ND_PRINT("[Bad OPT_JOIN option, length %u != %u]",
556 opt_len
, PGM_OPT_JOIN_LEN
);
560 seq
= GET_BE_U_4(bp
);
562 ND_PRINT(" JOIN %u", seq
);
563 opts_len
-= PGM_OPT_JOIN_LEN
;
566 case PGM_OPT_NAK_BO_IVL
:
567 #define PGM_OPT_NAK_BO_IVL_LEN (2+2+4+4)
568 if (opt_len
!= PGM_OPT_NAK_BO_IVL_LEN
) {
569 ND_PRINT("[Bad OPT_NAK_BO_IVL option, length %u != %u]",
570 opt_len
, PGM_OPT_NAK_BO_IVL_LEN
);
574 offset
= GET_BE_U_4(bp
);
576 seq
= GET_BE_U_4(bp
);
578 ND_PRINT(" BACKOFF ivl %u ivlseq %u", offset
, seq
);
579 opts_len
-= PGM_OPT_NAK_BO_IVL_LEN
;
582 case PGM_OPT_NAK_BO_RNG
:
583 #define PGM_OPT_NAK_BO_RNG_LEN (2+2+4+4)
584 if (opt_len
!= PGM_OPT_NAK_BO_RNG_LEN
) {
585 ND_PRINT("[Bad OPT_NAK_BO_RNG option, length %u != %u]",
586 opt_len
, PGM_OPT_NAK_BO_RNG_LEN
);
590 offset
= GET_BE_U_4(bp
);
592 seq
= GET_BE_U_4(bp
);
594 ND_PRINT(" BACKOFF max %u min %u", offset
, seq
);
595 opts_len
-= PGM_OPT_NAK_BO_RNG_LEN
;
598 case PGM_OPT_REDIRECT
:
599 #define PGM_OPT_REDIRECT_FIXED_LEN (2+2+2+2)
600 if (opt_len
< PGM_OPT_REDIRECT_FIXED_LEN
) {
601 ND_PRINT("[Bad OPT_REDIRECT option, length %u < %u]",
602 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
606 nla_afnum
= GET_BE_U_2(bp
);
610 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
)) {
611 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
612 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
615 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
616 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
617 bp
+= sizeof(nd_ipv4
);
618 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
);
621 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
)) {
622 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
623 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
626 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
627 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
628 bp
+= sizeof(nd_ipv6
);
629 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
);
636 ND_PRINT(" REDIRECT %s", nla_buf
);
639 case PGM_OPT_PARITY_PRM
:
640 #define PGM_OPT_PARITY_PRM_LEN (2+2+4)
641 if (opt_len
!= PGM_OPT_PARITY_PRM_LEN
) {
642 ND_PRINT("[Bad OPT_PARITY_PRM option, length %u != %u]",
643 opt_len
, PGM_OPT_PARITY_PRM_LEN
);
647 len
= GET_BE_U_4(bp
);
649 ND_PRINT(" PARITY MAXTGS %u", len
);
650 opts_len
-= PGM_OPT_PARITY_PRM_LEN
;
653 case PGM_OPT_PARITY_GRP
:
654 #define PGM_OPT_PARITY_GRP_LEN (2+2+4)
655 if (opt_len
!= PGM_OPT_PARITY_GRP_LEN
) {
656 ND_PRINT("[Bad OPT_PARITY_GRP option, length %u != %u]",
657 opt_len
, PGM_OPT_PARITY_GRP_LEN
);
661 seq
= GET_BE_U_4(bp
);
663 ND_PRINT(" PARITY GROUP %u", seq
);
664 opts_len
-= PGM_OPT_PARITY_GRP_LEN
;
667 case PGM_OPT_CURR_TGSIZE
:
668 #define PGM_OPT_CURR_TGSIZE_LEN (2+2+4)
669 if (opt_len
!= PGM_OPT_CURR_TGSIZE_LEN
) {
670 ND_PRINT("[Bad OPT_CURR_TGSIZE option, length %u != %u]",
671 opt_len
, PGM_OPT_CURR_TGSIZE_LEN
);
675 len
= GET_BE_U_4(bp
);
677 ND_PRINT(" PARITY ATGS %u", len
);
678 opts_len
-= PGM_OPT_CURR_TGSIZE_LEN
;
681 case PGM_OPT_NBR_UNREACH
:
682 #define PGM_OPT_NBR_UNREACH_LEN (2+2)
683 if (opt_len
!= PGM_OPT_NBR_UNREACH_LEN
) {
684 ND_PRINT("[Bad OPT_NBR_UNREACH option, length %u != %u]",
685 opt_len
, PGM_OPT_NBR_UNREACH_LEN
);
689 ND_PRINT(" NBR_UNREACH");
690 opts_len
-= PGM_OPT_NBR_UNREACH_LEN
;
693 case PGM_OPT_PATH_NLA
:
694 ND_PRINT(" PATH_NLA [%u]", opt_len
);
700 #define PGM_OPT_SYN_LEN (2+2)
701 if (opt_len
!= PGM_OPT_SYN_LEN
) {
702 ND_PRINT("[Bad OPT_SYN option, length %u != %u]",
703 opt_len
, PGM_OPT_SYN_LEN
);
708 opts_len
-= PGM_OPT_SYN_LEN
;
712 #define PGM_OPT_FIN_LEN (2+2)
713 if (opt_len
!= PGM_OPT_FIN_LEN
) {
714 ND_PRINT("[Bad OPT_FIN option, length %u != %u]",
715 opt_len
, PGM_OPT_FIN_LEN
);
720 opts_len
-= PGM_OPT_FIN_LEN
;
724 #define PGM_OPT_RST_LEN (2+2)
725 if (opt_len
!= PGM_OPT_RST_LEN
) {
726 ND_PRINT("[Bad OPT_RST option, length %u != %u]",
727 opt_len
, PGM_OPT_RST_LEN
);
732 opts_len
-= PGM_OPT_RST_LEN
;
742 #define PGM_OPT_CRQST_LEN (2+2)
743 if (opt_len
!= PGM_OPT_CRQST_LEN
) {
744 ND_PRINT("[Bad OPT_CRQST option, length %u != %u]",
745 opt_len
, PGM_OPT_CRQST_LEN
);
750 opts_len
-= PGM_OPT_CRQST_LEN
;
753 case PGM_OPT_PGMCC_DATA
:
754 #define PGM_OPT_PGMCC_DATA_FIXED_LEN (2+2+4+2+2)
755 if (opt_len
< PGM_OPT_PGMCC_DATA_FIXED_LEN
) {
756 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u < %u]",
757 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
761 offset
= GET_BE_U_4(bp
);
763 nla_afnum
= GET_BE_U_2(bp
);
767 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
)) {
768 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
769 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
772 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
773 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
774 bp
+= sizeof(nd_ipv4
);
775 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
);
778 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
)) {
779 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
780 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
783 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
784 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
785 bp
+= sizeof(nd_ipv6
);
786 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
);
793 ND_PRINT(" PGMCC DATA %u %s", offset
, nla_buf
);
796 case PGM_OPT_PGMCC_FEEDBACK
:
797 #define PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN (2+2+4+2+2)
798 if (opt_len
< PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
) {
799 ND_PRINT("[Bad PGM_OPT_PGMCC_FEEDBACK option, length %u < %u]",
800 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
804 offset
= GET_BE_U_4(bp
);
806 nla_afnum
= GET_BE_U_2(bp
);
810 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
)) {
811 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
812 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
815 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
816 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
817 bp
+= sizeof(nd_ipv4
);
818 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
);
821 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
)) {
822 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
823 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
826 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
827 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
828 bp
+= sizeof(nd_ipv6
);
829 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
);
836 ND_PRINT(" PGMCC FEEDBACK %u %s", offset
, nla_buf
);
840 ND_PRINT(" OPT_%02X [%u] ", opt_type
, opt_len
);
846 if (opt_type
& PGM_OPT_END
)
851 ND_PRINT(" [%u]", length
);
852 if (ndo
->ndo_packettype
== PT_PGM_ZMTP1
&&
853 (pgm_type_val
== PGM_ODATA
|| pgm_type_val
== PGM_RDATA
))
854 zmtp1_datagram_print(ndo
, bp
,
855 GET_BE_U_2(pgm
->pgm_length
));
859 nd_print_invalid(ndo
);