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.
52 #include "netdissect-stdinc.h"
54 #define ND_LONGJMP_FROM_TCHECK
55 #include "netdissect.h"
57 #include "addrtoname.h"
58 #include "addrtostr.h"
66 * PGM header (RFC 3208)
69 nd_uint16_t pgm_sport
;
70 nd_uint16_t pgm_dport
;
72 nd_uint8_t pgm_options
;
75 nd_uint16_t pgm_length
;
80 nd_uint32_t pgms_trailseq
;
81 nd_uint32_t pgms_leadseq
;
82 nd_uint16_t pgms_nla_afi
;
83 nd_uint16_t pgms_reserved
;
84 /* ... uint8_t pgms_nla[0]; */
90 nd_uint16_t pgmn_source_afi
;
91 nd_uint16_t pgmn_reserved
;
92 /* ... uint8_t pgmn_source[0]; */
93 /* ... uint16_t pgmn_group_afi */
94 /* ... uint16_t pgmn_reserved2; */
95 /* ... uint8_t pgmn_group[0]; */
100 nd_uint32_t pgma_rx_max_seq
;
101 nd_uint32_t pgma_bitmap
;
106 nd_uint32_t pgmp_seq
;
107 nd_uint16_t pgmp_round
;
108 nd_uint16_t pgmp_subtype
;
109 nd_uint16_t pgmp_nla_afi
;
110 nd_uint16_t pgmp_reserved
;
111 /* ... uint8_t pgmp_nla[0]; */
116 nd_uint32_t pgmp_seq
;
117 nd_uint16_t pgmp_round
;
118 nd_uint16_t pgmp_reserved
;
123 nd_uint32_t pgmd_seq
;
124 nd_uint32_t pgmd_trailseq
;
128 typedef enum _pgm_type
{
129 PGM_SPM
= 0x00, /* source path message */
130 PGM_POLL
= 0x01, /* POLL Request */
131 PGM_POLR
= 0x02, /* POLL Response */
132 PGM_ODATA
= 0x04, /* original data */
133 PGM_RDATA
= 0x05, /* repair data */
134 PGM_NAK
= 0x08, /* NAK */
135 PGM_NULLNAK
= 0x09, /* Null NAK */
136 PGM_NCF
= 0x0a, /* NAK Confirmation */
137 PGM_ACK
= 0x0b, /* ACK for congestion control? */
138 PGM_SPMR
= 0x0c, /* SPM request */
139 PGM_ACK2
= 0x0d, /* Also ACK for congestion control? */
142 #define PGM_OPT_BIT_PRESENT 0x01
143 #define PGM_OPT_BIT_NETWORK 0x02
144 #define PGM_OPT_BIT_VAR_PKTLEN 0x40
145 #define PGM_OPT_BIT_PARITY 0x80
147 #define PGM_OPT_LENGTH 0x00
148 #define PGM_OPT_FRAGMENT 0x01
149 #define PGM_OPT_NAK_LIST 0x02
150 #define PGM_OPT_JOIN 0x03
151 #define PGM_OPT_NAK_BO_IVL 0x04
152 #define PGM_OPT_NAK_BO_RNG 0x05
154 #define PGM_OPT_REDIRECT 0x07
155 #define PGM_OPT_PARITY_PRM 0x08
156 #define PGM_OPT_PARITY_GRP 0x09
157 #define PGM_OPT_CURR_TGSIZE 0x0A
158 #define PGM_OPT_NBR_UNREACH 0x0B
159 #define PGM_OPT_PATH_NLA 0x0C
161 #define PGM_OPT_SYN 0x0D
162 #define PGM_OPT_FIN 0x0E
163 #define PGM_OPT_RST 0x0F
164 #define PGM_OPT_CR 0x10
165 #define PGM_OPT_CRQST 0x11
167 #define PGM_OPT_PGMCC_DATA 0x12
168 #define PGM_OPT_PGMCC_FEEDBACK 0x13
170 #define PGM_OPT_MASK 0x7f
172 #define PGM_OPT_END 0x80 /* end of options marker */
174 #define PGM_MIN_OPT_LEN 4
177 pgm_print(netdissect_options
*ndo
,
178 const u_char
*bp
, u_int length
,
181 const struct pgm_header
*pgm
;
183 uint8_t pgm_type_val
;
184 uint16_t sport
, dport
;
186 char nla_buf
[INET6_ADDRSTRLEN
];
187 const struct ip6_hdr
*ip6
;
188 uint8_t opt_type
, opt_len
;
189 uint32_t seq
, opts_len
, len
, offset
;
191 ndo
->ndo_protocol
= "pgm";
192 pgm
= (const struct pgm_header
*)bp
;
193 ip
= (const struct ip
*)bp2
;
195 ip6
= (const struct ip6_hdr
*)bp2
;
198 if (!ND_TTEST_2(pgm
->pgm_dport
)) {
201 GET_IP6ADDR_STRING(ip6
->ip6_src
),
202 GET_IP6ADDR_STRING(ip6
->ip6_dst
));
205 GET_IPADDR_STRING(ip
->ip_src
),
206 GET_IPADDR_STRING(ip
->ip_dst
));
208 nd_trunc_longjmp(ndo
);
211 sport
= GET_BE_U_2(pgm
->pgm_sport
);
212 dport
= GET_BE_U_2(pgm
->pgm_dport
);
215 if (GET_U_1(ip6
->ip6_nxt
) == IPPROTO_PGM
) {
216 ND_PRINT("%s.%s > %s.%s: ",
217 GET_IP6ADDR_STRING(ip6
->ip6_src
),
218 tcpport_string(ndo
, sport
),
219 GET_IP6ADDR_STRING(ip6
->ip6_dst
),
220 tcpport_string(ndo
, dport
));
222 ND_PRINT("%s > %s: ",
223 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
226 if (GET_U_1(ip
->ip_p
) == IPPROTO_PGM
) {
227 ND_PRINT("%s.%s > %s.%s: ",
228 GET_IPADDR_STRING(ip
->ip_src
),
229 tcpport_string(ndo
, sport
),
230 GET_IPADDR_STRING(ip
->ip_dst
),
231 tcpport_string(ndo
, dport
));
233 ND_PRINT("%s > %s: ",
234 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
240 ND_PRINT("PGM, length %u", GET_BE_U_2(pgm
->pgm_length
));
245 pgm_type_val
= GET_U_1(pgm
->pgm_type
);
246 ND_PRINT(" 0x%02x%02x%02x%02x%02x%02x ",
253 bp
+= sizeof(struct pgm_header
);
254 switch (pgm_type_val
) {
256 const struct pgm_spm
*spm
;
258 spm
= (const struct pgm_spm
*)bp
;
260 bp
+= sizeof(struct pgm_spm
);
262 switch (GET_BE_U_2(spm
->pgms_nla_afi
)) {
264 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
265 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
266 bp
+= sizeof(nd_ipv4
);
269 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
270 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
271 bp
+= sizeof(nd_ipv6
);
277 ND_PRINT("SPM seq %u trail %u lead %u nla %s",
278 GET_BE_U_4(spm
->pgms_seq
),
279 GET_BE_U_4(spm
->pgms_trailseq
),
280 GET_BE_U_4(spm
->pgms_leadseq
),
286 const struct pgm_poll
*pgm_poll
;
287 uint32_t ivl
, rnd
, mask
;
289 pgm_poll
= (const struct pgm_poll
*)bp
;
290 ND_TCHECK_SIZE(pgm_poll
);
291 bp
+= sizeof(struct pgm_poll
);
293 switch (GET_BE_U_2(pgm_poll
->pgmp_nla_afi
)) {
295 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
296 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
297 bp
+= sizeof(nd_ipv4
);
300 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
301 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
302 bp
+= sizeof(nd_ipv6
);
308 ivl
= GET_BE_U_4(bp
);
309 bp
+= sizeof(uint32_t);
311 rnd
= GET_BE_U_4(bp
);
312 bp
+= sizeof(uint32_t);
314 mask
= GET_BE_U_4(bp
);
315 bp
+= sizeof(uint32_t);
317 ND_PRINT("POLL seq %u round %u nla %s ivl %u rnd 0x%08x "
318 "mask 0x%08x", GET_BE_U_4(pgm_poll
->pgmp_seq
),
319 GET_BE_U_2(pgm_poll
->pgmp_round
), nla_buf
, ivl
, rnd
,
324 const struct pgm_polr
*polr_msg
;
326 polr_msg
= (const struct pgm_polr
*)bp
;
327 ND_TCHECK_SIZE(polr_msg
);
328 ND_PRINT("POLR seq %u round %u",
329 GET_BE_U_4(polr_msg
->pgmp_seq
),
330 GET_BE_U_2(polr_msg
->pgmp_round
));
331 bp
+= sizeof(struct pgm_polr
);
335 const struct pgm_data
*odata
;
337 odata
= (const struct pgm_data
*)bp
;
338 ND_PRINT("ODATA trail %u seq %u",
339 GET_BE_U_4(odata
->pgmd_trailseq
),
340 GET_BE_U_4(odata
->pgmd_seq
));
341 bp
+= sizeof(struct pgm_data
);
346 const struct pgm_data
*rdata
;
348 rdata
= (const struct pgm_data
*)bp
;
349 ND_PRINT("RDATA trail %u seq %u",
350 GET_BE_U_4(rdata
->pgmd_trailseq
),
351 GET_BE_U_4(rdata
->pgmd_seq
));
352 bp
+= sizeof(struct pgm_data
);
359 const struct pgm_nak
*nak
;
360 char source_buf
[INET6_ADDRSTRLEN
], group_buf
[INET6_ADDRSTRLEN
];
362 nak
= (const struct pgm_nak
*)bp
;
364 bp
+= sizeof(struct pgm_nak
);
367 * Skip past the source, saving info along the way
368 * and stopping if we don't have enough.
370 switch (GET_BE_U_2(nak
->pgmn_source_afi
)) {
372 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
373 addrtostr(bp
, source_buf
, sizeof(source_buf
));
374 bp
+= sizeof(nd_ipv4
);
377 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
378 addrtostr6(bp
, source_buf
, sizeof(source_buf
));
379 bp
+= sizeof(nd_ipv6
);
386 * Skip past the group, saving info along the way
387 * and stopping if we don't have enough.
389 bp
+= (2 * sizeof(uint16_t));
390 switch (GET_BE_U_2(bp
)) {
392 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
393 addrtostr(bp
, group_buf
, sizeof(group_buf
));
394 bp
+= sizeof(nd_ipv4
);
397 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
398 addrtostr6(bp
, group_buf
, sizeof(group_buf
));
399 bp
+= sizeof(nd_ipv6
);
406 * Options decoding can go here.
408 switch (pgm_type_val
) {
421 ND_PRINT("(%s -> %s), seq %u",
422 source_buf
, group_buf
, GET_BE_U_4(nak
->pgmn_seq
));
428 const struct pgm_ack
*ack
;
430 ack
= (const struct pgm_ack
*)bp
;
432 ND_PRINT("ACK seq %u",
433 GET_BE_U_4(ack
->pgma_rx_max_seq
));
434 bp
+= sizeof(struct pgm_ack
);
443 ND_PRINT("UNKNOWN type 0x%02x", pgm_type_val
);
447 if (GET_U_1(pgm
->pgm_options
) & PGM_OPT_BIT_PRESENT
) {
450 * make sure there's enough for the first option header
452 ND_TCHECK_LEN(bp
, PGM_MIN_OPT_LEN
);
455 * That option header MUST be an OPT_LENGTH option
456 * (see the first paragraph of section 9.1 in RFC 3208).
458 opt_type
= GET_U_1(bp
);
460 if ((opt_type
& PGM_OPT_MASK
) != PGM_OPT_LENGTH
) {
461 ND_PRINT("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type
& PGM_OPT_MASK
);
464 opt_len
= GET_U_1(bp
);
467 ND_PRINT("[Bad OPT_LENGTH option, length %u != 4]", opt_len
);
470 opts_len
= GET_BE_U_2(bp
);
471 bp
+= sizeof(uint16_t);
473 ND_PRINT("[Bad total option length %u < 4]", opts_len
);
476 ND_PRINT(" OPTS LEN %u", opts_len
);
480 if (opts_len
< PGM_MIN_OPT_LEN
) {
481 ND_PRINT("[Total option length leaves no room for final option]");
484 opt_type
= GET_U_1(bp
);
486 opt_len
= GET_U_1(bp
);
488 if (opt_len
< PGM_MIN_OPT_LEN
) {
489 ND_PRINT("[Bad option, length %u < %u]", opt_len
,
493 if (opts_len
< opt_len
) {
494 ND_PRINT("[Total option length leaves no room for final option]");
497 ND_TCHECK_LEN(bp
, opt_len
- 2);
499 switch (opt_type
& PGM_OPT_MASK
) {
501 #define PGM_OPT_LENGTH_LEN (2+2)
502 if (opt_len
!= PGM_OPT_LENGTH_LEN
) {
503 ND_PRINT("[Bad OPT_LENGTH option, length %u != %u]",
504 opt_len
, PGM_OPT_LENGTH_LEN
);
507 ND_PRINT(" OPTS LEN (extra?) %u", GET_BE_U_2(bp
));
509 opts_len
-= PGM_OPT_LENGTH_LEN
;
512 case PGM_OPT_FRAGMENT
:
513 #define PGM_OPT_FRAGMENT_LEN (2+2+4+4+4)
514 if (opt_len
!= PGM_OPT_FRAGMENT_LEN
) {
515 ND_PRINT("[Bad OPT_FRAGMENT option, length %u != %u]",
516 opt_len
, PGM_OPT_FRAGMENT_LEN
);
520 seq
= GET_BE_U_4(bp
);
522 offset
= GET_BE_U_4(bp
);
524 len
= GET_BE_U_4(bp
);
526 ND_PRINT(" FRAG seq %u off %u len %u", seq
, offset
, len
);
527 opts_len
-= PGM_OPT_FRAGMENT_LEN
;
530 case PGM_OPT_NAK_LIST
:
532 opt_len
-= 4; /* option header */
533 ND_PRINT(" NAK LIST");
536 ND_PRINT("[Option length not a multiple of 4]");
539 ND_PRINT(" %u", GET_BE_U_4(bp
));
547 #define PGM_OPT_JOIN_LEN (2+2+4)
548 if (opt_len
!= PGM_OPT_JOIN_LEN
) {
549 ND_PRINT("[Bad OPT_JOIN option, length %u != %u]",
550 opt_len
, PGM_OPT_JOIN_LEN
);
554 seq
= GET_BE_U_4(bp
);
556 ND_PRINT(" JOIN %u", seq
);
557 opts_len
-= PGM_OPT_JOIN_LEN
;
560 case PGM_OPT_NAK_BO_IVL
:
561 #define PGM_OPT_NAK_BO_IVL_LEN (2+2+4+4)
562 if (opt_len
!= PGM_OPT_NAK_BO_IVL_LEN
) {
563 ND_PRINT("[Bad OPT_NAK_BO_IVL option, length %u != %u]",
564 opt_len
, PGM_OPT_NAK_BO_IVL_LEN
);
568 offset
= GET_BE_U_4(bp
);
570 seq
= GET_BE_U_4(bp
);
572 ND_PRINT(" BACKOFF ivl %u ivlseq %u", offset
, seq
);
573 opts_len
-= PGM_OPT_NAK_BO_IVL_LEN
;
576 case PGM_OPT_NAK_BO_RNG
:
577 #define PGM_OPT_NAK_BO_RNG_LEN (2+2+4+4)
578 if (opt_len
!= PGM_OPT_NAK_BO_RNG_LEN
) {
579 ND_PRINT("[Bad OPT_NAK_BO_RNG option, length %u != %u]",
580 opt_len
, PGM_OPT_NAK_BO_RNG_LEN
);
584 offset
= GET_BE_U_4(bp
);
586 seq
= GET_BE_U_4(bp
);
588 ND_PRINT(" BACKOFF max %u min %u", offset
, seq
);
589 opts_len
-= PGM_OPT_NAK_BO_RNG_LEN
;
592 case PGM_OPT_REDIRECT
:
593 #define PGM_OPT_REDIRECT_FIXED_LEN (2+2+2+2)
594 if (opt_len
< PGM_OPT_REDIRECT_FIXED_LEN
) {
595 ND_PRINT("[Bad OPT_REDIRECT option, length %u < %u]",
596 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
600 nla_afnum
= GET_BE_U_2(bp
);
604 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
)) {
605 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
606 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
609 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
610 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
611 bp
+= sizeof(nd_ipv4
);
612 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
);
615 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
)) {
616 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
617 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
620 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
621 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
622 bp
+= sizeof(nd_ipv6
);
623 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
);
629 ND_PRINT(" REDIRECT %s", nla_buf
);
632 case PGM_OPT_PARITY_PRM
:
633 #define PGM_OPT_PARITY_PRM_LEN (2+2+4)
634 if (opt_len
!= PGM_OPT_PARITY_PRM_LEN
) {
635 ND_PRINT("[Bad OPT_PARITY_PRM option, length %u != %u]",
636 opt_len
, PGM_OPT_PARITY_PRM_LEN
);
640 len
= GET_BE_U_4(bp
);
642 ND_PRINT(" PARITY MAXTGS %u", len
);
643 opts_len
-= PGM_OPT_PARITY_PRM_LEN
;
646 case PGM_OPT_PARITY_GRP
:
647 #define PGM_OPT_PARITY_GRP_LEN (2+2+4)
648 if (opt_len
!= PGM_OPT_PARITY_GRP_LEN
) {
649 ND_PRINT("[Bad OPT_PARITY_GRP option, length %u != %u]",
650 opt_len
, PGM_OPT_PARITY_GRP_LEN
);
654 seq
= GET_BE_U_4(bp
);
656 ND_PRINT(" PARITY GROUP %u", seq
);
657 opts_len
-= PGM_OPT_PARITY_GRP_LEN
;
660 case PGM_OPT_CURR_TGSIZE
:
661 #define PGM_OPT_CURR_TGSIZE_LEN (2+2+4)
662 if (opt_len
!= PGM_OPT_CURR_TGSIZE_LEN
) {
663 ND_PRINT("[Bad OPT_CURR_TGSIZE option, length %u != %u]",
664 opt_len
, PGM_OPT_CURR_TGSIZE_LEN
);
668 len
= GET_BE_U_4(bp
);
670 ND_PRINT(" PARITY ATGS %u", len
);
671 opts_len
-= PGM_OPT_CURR_TGSIZE_LEN
;
674 case PGM_OPT_NBR_UNREACH
:
675 #define PGM_OPT_NBR_UNREACH_LEN (2+2)
676 if (opt_len
!= PGM_OPT_NBR_UNREACH_LEN
) {
677 ND_PRINT("[Bad OPT_NBR_UNREACH option, length %u != %u]",
678 opt_len
, PGM_OPT_NBR_UNREACH_LEN
);
682 ND_PRINT(" NBR_UNREACH");
683 opts_len
-= PGM_OPT_NBR_UNREACH_LEN
;
686 case PGM_OPT_PATH_NLA
:
687 ND_PRINT(" PATH_NLA [%u]", opt_len
);
693 #define PGM_OPT_SYN_LEN (2+2)
694 if (opt_len
!= PGM_OPT_SYN_LEN
) {
695 ND_PRINT("[Bad OPT_SYN option, length %u != %u]",
696 opt_len
, PGM_OPT_SYN_LEN
);
701 opts_len
-= PGM_OPT_SYN_LEN
;
705 #define PGM_OPT_FIN_LEN (2+2)
706 if (opt_len
!= PGM_OPT_FIN_LEN
) {
707 ND_PRINT("[Bad OPT_FIN option, length %u != %u]",
708 opt_len
, PGM_OPT_FIN_LEN
);
713 opts_len
-= PGM_OPT_FIN_LEN
;
717 #define PGM_OPT_RST_LEN (2+2)
718 if (opt_len
!= PGM_OPT_RST_LEN
) {
719 ND_PRINT("[Bad OPT_RST option, length %u != %u]",
720 opt_len
, PGM_OPT_RST_LEN
);
725 opts_len
-= PGM_OPT_RST_LEN
;
735 #define PGM_OPT_CRQST_LEN (2+2)
736 if (opt_len
!= PGM_OPT_CRQST_LEN
) {
737 ND_PRINT("[Bad OPT_CRQST option, length %u != %u]",
738 opt_len
, PGM_OPT_CRQST_LEN
);
743 opts_len
-= PGM_OPT_CRQST_LEN
;
746 case PGM_OPT_PGMCC_DATA
:
747 #define PGM_OPT_PGMCC_DATA_FIXED_LEN (2+2+4+2+2)
748 if (opt_len
< PGM_OPT_PGMCC_DATA_FIXED_LEN
) {
749 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u < %u]",
750 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
754 offset
= GET_BE_U_4(bp
);
756 nla_afnum
= GET_BE_U_2(bp
);
760 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
)) {
761 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
762 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
765 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
766 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
767 bp
+= sizeof(nd_ipv4
);
768 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
);
771 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
)) {
772 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
773 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
776 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
777 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
778 bp
+= sizeof(nd_ipv6
);
779 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
);
785 ND_PRINT(" PGMCC DATA %u %s", offset
, nla_buf
);
788 case PGM_OPT_PGMCC_FEEDBACK
:
789 #define PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN (2+2+4+2+2)
790 if (opt_len
< PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
) {
791 ND_PRINT("[Bad PGM_OPT_PGMCC_FEEDBACK option, length %u < %u]",
792 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
796 offset
= GET_BE_U_4(bp
);
798 nla_afnum
= GET_BE_U_2(bp
);
802 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
)) {
803 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
804 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
807 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
808 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
809 bp
+= sizeof(nd_ipv4
);
810 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
);
813 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
)) {
814 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
815 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
818 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
819 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
820 bp
+= sizeof(nd_ipv6
);
821 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
);
827 ND_PRINT(" PGMCC FEEDBACK %u %s", offset
, nla_buf
);
831 ND_PRINT(" OPT_%02X [%u] ", opt_type
, opt_len
);
837 if (opt_type
& PGM_OPT_END
)
842 ND_PRINT(" [%u]", length
);
843 if (ndo
->ndo_packettype
== PT_PGM_ZMTP1
&&
844 (pgm_type_val
== PGM_ODATA
|| pgm_type_val
== PGM_RDATA
))
845 zmtp1_datagram_print(ndo
, bp
,
846 GET_BE_U_2(pgm
->pgm_length
));
850 nd_print_invalid(ndo
);