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 */
22 #include "netdissect-stdinc.h"
24 #include "netdissect.h"
26 #include "addrtoname.h"
27 #include "addrtostr.h"
35 * PGM header (RFC 3208)
38 nd_uint16_t pgm_sport
;
39 nd_uint16_t pgm_dport
;
41 nd_uint8_t pgm_options
;
44 nd_uint16_t pgm_length
;
49 nd_uint32_t pgms_trailseq
;
50 nd_uint32_t pgms_leadseq
;
51 nd_uint16_t pgms_nla_afi
;
52 nd_uint16_t pgms_reserved
;
53 /* ... uint8_t pgms_nla[0]; */
59 nd_uint16_t pgmn_source_afi
;
60 nd_uint16_t pgmn_reserved
;
61 /* ... uint8_t pgmn_source[0]; */
62 /* ... uint16_t pgmn_group_afi */
63 /* ... uint16_t pgmn_reserved2; */
64 /* ... uint8_t pgmn_group[0]; */
69 nd_uint32_t pgma_rx_max_seq
;
70 nd_uint32_t pgma_bitmap
;
76 nd_uint16_t pgmp_round
;
77 nd_uint16_t pgmp_reserved
;
83 nd_uint16_t pgmp_round
;
84 nd_uint16_t pgmp_subtype
;
85 nd_uint16_t pgmp_nla_afi
;
86 nd_uint16_t pgmp_reserved
;
87 /* ... uint8_t pgmp_nla[0]; */
93 nd_uint32_t pgmd_trailseq
;
97 typedef enum _pgm_type
{
98 PGM_SPM
= 0, /* source path message */
99 PGM_POLL
= 1, /* POLL Request */
100 PGM_POLR
= 2, /* POLL Response */
101 PGM_ODATA
= 4, /* original data */
102 PGM_RDATA
= 5, /* repair data */
103 PGM_NAK
= 8, /* NAK */
104 PGM_NULLNAK
= 9, /* Null NAK */
105 PGM_NCF
= 10, /* NAK Confirmation */
106 PGM_ACK
= 11, /* ACK for congestion control */
107 PGM_SPMR
= 12, /* SPM request */
111 #define PGM_OPT_BIT_PRESENT 0x01
112 #define PGM_OPT_BIT_NETWORK 0x02
113 #define PGM_OPT_BIT_VAR_PKTLEN 0x40
114 #define PGM_OPT_BIT_PARITY 0x80
116 #define PGM_OPT_LENGTH 0x00
117 #define PGM_OPT_FRAGMENT 0x01
118 #define PGM_OPT_NAK_LIST 0x02
119 #define PGM_OPT_JOIN 0x03
120 #define PGM_OPT_NAK_BO_IVL 0x04
121 #define PGM_OPT_NAK_BO_RNG 0x05
123 #define PGM_OPT_REDIRECT 0x07
124 #define PGM_OPT_PARITY_PRM 0x08
125 #define PGM_OPT_PARITY_GRP 0x09
126 #define PGM_OPT_CURR_TGSIZE 0x0A
127 #define PGM_OPT_NBR_UNREACH 0x0B
128 #define PGM_OPT_PATH_NLA 0x0C
130 #define PGM_OPT_SYN 0x0D
131 #define PGM_OPT_FIN 0x0E
132 #define PGM_OPT_RST 0x0F
133 #define PGM_OPT_CR 0x10
134 #define PGM_OPT_CRQST 0x11
136 #define PGM_OPT_PGMCC_DATA 0x12
137 #define PGM_OPT_PGMCC_FEEDBACK 0x13
139 #define PGM_OPT_MASK 0x7f
141 #define PGM_OPT_END 0x80 /* end of options marker */
143 #define PGM_MIN_OPT_LEN 4
146 pgm_print(netdissect_options
*ndo
,
147 const u_char
*bp
, u_int length
,
150 const struct pgm_header
*pgm
;
152 uint8_t pgm_type_val
;
153 uint16_t sport
, dport
;
155 char nla_buf
[INET6_ADDRSTRLEN
];
156 const struct ip6_hdr
*ip6
;
157 uint8_t opt_type
, opt_len
;
158 uint32_t seq
, opts_len
, len
, offset
;
160 ndo
->ndo_protocol
= "pgm";
161 pgm
= (const struct pgm_header
*)bp
;
162 ip
= (const struct ip
*)bp2
;
164 ip6
= (const struct ip6_hdr
*)bp2
;
167 if (!ND_TTEST_2(pgm
->pgm_dport
)) {
170 ip6addr_string(ndo
, ip6
->ip6_src
),
171 ip6addr_string(ndo
, ip6
->ip6_dst
));
174 ipaddr_string(ndo
, ip
->ip_src
),
175 ipaddr_string(ndo
, ip
->ip_dst
));
181 sport
= EXTRACT_BE_U_2(pgm
->pgm_sport
);
182 dport
= EXTRACT_BE_U_2(pgm
->pgm_dport
);
185 if (EXTRACT_U_1(ip6
->ip6_nxt
) == IPPROTO_PGM
) {
186 ND_PRINT("%s.%s > %s.%s: ",
187 ip6addr_string(ndo
, ip6
->ip6_src
),
188 tcpport_string(ndo
, sport
),
189 ip6addr_string(ndo
, ip6
->ip6_dst
),
190 tcpport_string(ndo
, dport
));
192 ND_PRINT("%s > %s: ",
193 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
196 if (EXTRACT_U_1(ip
->ip_p
) == IPPROTO_PGM
) {
197 ND_PRINT("%s.%s > %s.%s: ",
198 ipaddr_string(ndo
, ip
->ip_src
),
199 tcpport_string(ndo
, sport
),
200 ipaddr_string(ndo
, ip
->ip_dst
),
201 tcpport_string(ndo
, dport
));
203 ND_PRINT("%s > %s: ",
204 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
210 ND_PRINT("PGM, length %u", EXTRACT_BE_U_2(pgm
->pgm_length
));
215 pgm_type_val
= EXTRACT_U_1(pgm
->pgm_type
);
216 ND_PRINT(" 0x%02x%02x%02x%02x%02x%02x ",
223 switch (pgm_type_val
) {
225 const struct pgm_spm
*spm
;
227 spm
= (const struct pgm_spm
*)(pgm
+ 1);
229 bp
= (const u_char
*) (spm
+ 1);
231 switch (EXTRACT_BE_U_2(spm
->pgms_nla_afi
)) {
233 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
234 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
235 bp
+= sizeof(nd_ipv4
);
238 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
239 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
240 bp
+= sizeof(nd_ipv6
);
247 ND_PRINT("SPM seq %u trail %u lead %u nla %s",
248 EXTRACT_BE_U_4(spm
->pgms_seq
),
249 EXTRACT_BE_U_4(spm
->pgms_trailseq
),
250 EXTRACT_BE_U_4(spm
->pgms_leadseq
),
256 const struct pgm_poll
*poll_msg
;
258 poll_msg
= (const struct pgm_poll
*)(pgm
+ 1);
259 ND_TCHECK_SIZE(poll_msg
);
260 ND_PRINT("POLL seq %u round %u",
261 EXTRACT_BE_U_4(poll_msg
->pgmp_seq
),
262 EXTRACT_BE_U_2(poll_msg
->pgmp_round
));
263 bp
= (const u_char
*) (poll_msg
+ 1);
267 const struct pgm_polr
*polr
;
268 uint32_t ivl
, rnd
, mask
;
270 polr
= (const struct pgm_polr
*)(pgm
+ 1);
271 ND_TCHECK_SIZE(polr
);
272 bp
= (const u_char
*) (polr
+ 1);
274 switch (EXTRACT_BE_U_2(polr
->pgmp_nla_afi
)) {
276 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
277 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
278 bp
+= sizeof(nd_ipv4
);
281 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
282 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
283 bp
+= sizeof(nd_ipv6
);
290 ND_TCHECK_LEN(bp
, sizeof(uint32_t));
291 ivl
= EXTRACT_BE_U_4(bp
);
292 bp
+= sizeof(uint32_t);
294 ND_TCHECK_LEN(bp
, sizeof(uint32_t));
295 rnd
= EXTRACT_BE_U_4(bp
);
296 bp
+= sizeof(uint32_t);
298 ND_TCHECK_LEN(bp
, sizeof(uint32_t));
299 mask
= EXTRACT_BE_U_4(bp
);
300 bp
+= sizeof(uint32_t);
302 ND_PRINT("POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
303 "mask 0x%08x", EXTRACT_BE_U_4(polr
->pgmp_seq
),
304 EXTRACT_BE_U_2(polr
->pgmp_round
), nla_buf
, ivl
, rnd
, mask
);
308 const struct pgm_data
*odata
;
310 odata
= (const struct pgm_data
*)(pgm
+ 1);
311 ND_TCHECK_SIZE(odata
);
312 ND_PRINT("ODATA trail %u seq %u",
313 EXTRACT_BE_U_4(odata
->pgmd_trailseq
),
314 EXTRACT_BE_U_4(odata
->pgmd_seq
));
315 bp
= (const u_char
*) (odata
+ 1);
320 const struct pgm_data
*rdata
;
322 rdata
= (const struct pgm_data
*)(pgm
+ 1);
323 ND_TCHECK_SIZE(rdata
);
324 ND_PRINT("RDATA trail %u seq %u",
325 EXTRACT_BE_U_4(rdata
->pgmd_trailseq
),
326 EXTRACT_BE_U_4(rdata
->pgmd_seq
));
327 bp
= (const u_char
*) (rdata
+ 1);
334 const struct pgm_nak
*nak
;
335 char source_buf
[INET6_ADDRSTRLEN
], group_buf
[INET6_ADDRSTRLEN
];
337 nak
= (const struct pgm_nak
*)(pgm
+ 1);
339 bp
= (const u_char
*) (nak
+ 1);
342 * Skip past the source, saving info along the way
343 * and stopping if we don't have enough.
345 switch (EXTRACT_BE_U_2(nak
->pgmn_source_afi
)) {
347 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
348 addrtostr(bp
, source_buf
, sizeof(source_buf
));
349 bp
+= sizeof(nd_ipv4
);
352 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
353 addrtostr6(bp
, source_buf
, sizeof(source_buf
));
354 bp
+= sizeof(nd_ipv6
);
362 * Skip past the group, saving info along the way
363 * and stopping if we don't have enough.
365 bp
+= (2 * sizeof(uint16_t));
367 switch (EXTRACT_BE_U_2(bp
)) {
369 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
370 addrtostr(bp
, group_buf
, sizeof(group_buf
));
371 bp
+= sizeof(nd_ipv4
);
374 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
375 addrtostr6(bp
, group_buf
, sizeof(group_buf
));
376 bp
+= sizeof(nd_ipv6
);
384 * Options decoding can go here.
386 switch (pgm_type_val
) {
399 ND_PRINT("(%s -> %s), seq %u",
400 source_buf
, group_buf
, EXTRACT_BE_U_4(nak
->pgmn_seq
));
405 const struct pgm_ack
*ack
;
407 ack
= (const struct pgm_ack
*)(pgm
+ 1);
409 ND_PRINT("ACK seq %u",
410 EXTRACT_BE_U_4(ack
->pgma_rx_max_seq
));
411 bp
= (const u_char
*) (ack
+ 1);
420 ND_PRINT("UNKNOWN type 0x%02x", pgm_type_val
);
424 if (EXTRACT_U_1(pgm
->pgm_options
) & PGM_OPT_BIT_PRESENT
) {
427 * make sure there's enough for the first option header
429 ND_TCHECK_LEN(bp
, PGM_MIN_OPT_LEN
);
432 * That option header MUST be an OPT_LENGTH option
433 * (see the first paragraph of section 9.1 in RFC 3208).
435 opt_type
= EXTRACT_U_1(bp
);
437 if ((opt_type
& PGM_OPT_MASK
) != PGM_OPT_LENGTH
) {
438 ND_PRINT("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type
& PGM_OPT_MASK
);
441 opt_len
= EXTRACT_U_1(bp
);
444 ND_PRINT("[Bad OPT_LENGTH option, length %u != 4]", opt_len
);
447 opts_len
= EXTRACT_BE_U_2(bp
);
448 bp
+= sizeof(uint16_t);
450 ND_PRINT("[Bad total option length %u < 4]", opts_len
);
453 ND_PRINT(" OPTS LEN %u", opts_len
);
457 if (opts_len
< PGM_MIN_OPT_LEN
) {
458 ND_PRINT("[Total option length leaves no room for final option]");
462 opt_type
= EXTRACT_U_1(bp
);
464 opt_len
= EXTRACT_U_1(bp
);
466 if (opt_len
< PGM_MIN_OPT_LEN
) {
467 ND_PRINT("[Bad option, length %u < %u]", opt_len
,
471 if (opts_len
< opt_len
) {
472 ND_PRINT("[Total option length leaves no room for final option]");
475 ND_TCHECK_LEN(bp
, opt_len
- 2);
477 switch (opt_type
& PGM_OPT_MASK
) {
479 #define PGM_OPT_LENGTH_LEN (2+2)
480 if (opt_len
!= PGM_OPT_LENGTH_LEN
) {
481 ND_PRINT("[Bad OPT_LENGTH option, length %u != %u]",
482 opt_len
, PGM_OPT_LENGTH_LEN
);
485 ND_PRINT(" OPTS LEN (extra?) %u", EXTRACT_BE_U_2(bp
));
487 opts_len
-= PGM_OPT_LENGTH_LEN
;
490 case PGM_OPT_FRAGMENT
:
491 #define PGM_OPT_FRAGMENT_LEN (2+2+4+4+4)
492 if (opt_len
!= PGM_OPT_FRAGMENT_LEN
) {
493 ND_PRINT("[Bad OPT_FRAGMENT option, length %u != %u]",
494 opt_len
, PGM_OPT_FRAGMENT_LEN
);
498 seq
= EXTRACT_BE_U_4(bp
);
500 offset
= EXTRACT_BE_U_4(bp
);
502 len
= EXTRACT_BE_U_4(bp
);
504 ND_PRINT(" FRAG seq %u off %u len %u", seq
, offset
, len
);
505 opts_len
-= PGM_OPT_FRAGMENT_LEN
;
508 case PGM_OPT_NAK_LIST
:
510 opt_len
-= 4; /* option header */
511 ND_PRINT(" NAK LIST");
514 ND_PRINT("[Option length not a multiple of 4]");
518 ND_PRINT(" %u", EXTRACT_BE_U_4(bp
));
526 #define PGM_OPT_JOIN_LEN (2+2+4)
527 if (opt_len
!= PGM_OPT_JOIN_LEN
) {
528 ND_PRINT("[Bad OPT_JOIN option, length %u != %u]",
529 opt_len
, PGM_OPT_JOIN_LEN
);
533 seq
= EXTRACT_BE_U_4(bp
);
535 ND_PRINT(" JOIN %u", seq
);
536 opts_len
-= PGM_OPT_JOIN_LEN
;
539 case PGM_OPT_NAK_BO_IVL
:
540 #define PGM_OPT_NAK_BO_IVL_LEN (2+2+4+4)
541 if (opt_len
!= PGM_OPT_NAK_BO_IVL_LEN
) {
542 ND_PRINT("[Bad OPT_NAK_BO_IVL option, length %u != %u]",
543 opt_len
, PGM_OPT_NAK_BO_IVL_LEN
);
547 offset
= EXTRACT_BE_U_4(bp
);
549 seq
= EXTRACT_BE_U_4(bp
);
551 ND_PRINT(" BACKOFF ivl %u ivlseq %u", offset
, seq
);
552 opts_len
-= PGM_OPT_NAK_BO_IVL_LEN
;
555 case PGM_OPT_NAK_BO_RNG
:
556 #define PGM_OPT_NAK_BO_RNG_LEN (2+2+4+4)
557 if (opt_len
!= PGM_OPT_NAK_BO_RNG_LEN
) {
558 ND_PRINT("[Bad OPT_NAK_BO_RNG option, length %u != %u]",
559 opt_len
, PGM_OPT_NAK_BO_RNG_LEN
);
563 offset
= EXTRACT_BE_U_4(bp
);
565 seq
= EXTRACT_BE_U_4(bp
);
567 ND_PRINT(" BACKOFF max %u min %u", offset
, seq
);
568 opts_len
-= PGM_OPT_NAK_BO_RNG_LEN
;
571 case PGM_OPT_REDIRECT
:
572 #define PGM_OPT_REDIRECT_FIXED_LEN (2+2+2+2)
573 if (opt_len
< PGM_OPT_REDIRECT_FIXED_LEN
) {
574 ND_PRINT("[Bad OPT_REDIRECT option, length %u < %u]",
575 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
579 nla_afnum
= EXTRACT_BE_U_2(bp
);
583 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
)) {
584 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
585 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
588 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
589 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
590 bp
+= sizeof(nd_ipv4
);
591 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
);
594 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
)) {
595 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
596 PGM_OPT_REDIRECT_FIXED_LEN
, opt_len
);
599 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
600 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
601 bp
+= sizeof(nd_ipv6
);
602 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
);
609 ND_PRINT(" REDIRECT %s", nla_buf
);
612 case PGM_OPT_PARITY_PRM
:
613 #define PGM_OPT_PARITY_PRM_LEN (2+2+4)
614 if (opt_len
!= PGM_OPT_PARITY_PRM_LEN
) {
615 ND_PRINT("[Bad OPT_PARITY_PRM option, length %u != %u]",
616 opt_len
, PGM_OPT_PARITY_PRM_LEN
);
620 len
= EXTRACT_BE_U_4(bp
);
622 ND_PRINT(" PARITY MAXTGS %u", len
);
623 opts_len
-= PGM_OPT_PARITY_PRM_LEN
;
626 case PGM_OPT_PARITY_GRP
:
627 #define PGM_OPT_PARITY_GRP_LEN (2+2+4)
628 if (opt_len
!= PGM_OPT_PARITY_GRP_LEN
) {
629 ND_PRINT("[Bad OPT_PARITY_GRP option, length %u != %u]",
630 opt_len
, PGM_OPT_PARITY_GRP_LEN
);
634 seq
= EXTRACT_BE_U_4(bp
);
636 ND_PRINT(" PARITY GROUP %u", seq
);
637 opts_len
-= PGM_OPT_PARITY_GRP_LEN
;
640 case PGM_OPT_CURR_TGSIZE
:
641 #define PGM_OPT_CURR_TGSIZE_LEN (2+2+4)
642 if (opt_len
!= PGM_OPT_CURR_TGSIZE_LEN
) {
643 ND_PRINT("[Bad OPT_CURR_TGSIZE option, length %u != %u]",
644 opt_len
, PGM_OPT_CURR_TGSIZE_LEN
);
648 len
= EXTRACT_BE_U_4(bp
);
650 ND_PRINT(" PARITY ATGS %u", len
);
651 opts_len
-= PGM_OPT_CURR_TGSIZE_LEN
;
654 case PGM_OPT_NBR_UNREACH
:
655 #define PGM_OPT_NBR_UNREACH_LEN (2+2)
656 if (opt_len
!= PGM_OPT_NBR_UNREACH_LEN
) {
657 ND_PRINT("[Bad OPT_NBR_UNREACH option, length %u != %u]",
658 opt_len
, PGM_OPT_NBR_UNREACH_LEN
);
662 ND_PRINT(" NBR_UNREACH");
663 opts_len
-= PGM_OPT_NBR_UNREACH_LEN
;
666 case PGM_OPT_PATH_NLA
:
667 ND_PRINT(" PATH_NLA [%u]", opt_len
);
673 #define PGM_OPT_SYN_LEN (2+2)
674 if (opt_len
!= PGM_OPT_SYN_LEN
) {
675 ND_PRINT("[Bad OPT_SYN option, length %u != %u]",
676 opt_len
, PGM_OPT_SYN_LEN
);
681 opts_len
-= PGM_OPT_SYN_LEN
;
685 #define PGM_OPT_FIN_LEN (2+2)
686 if (opt_len
!= PGM_OPT_FIN_LEN
) {
687 ND_PRINT("[Bad OPT_FIN option, length %u != %u]",
688 opt_len
, PGM_OPT_FIN_LEN
);
693 opts_len
-= PGM_OPT_FIN_LEN
;
697 #define PGM_OPT_RST_LEN (2+2)
698 if (opt_len
!= PGM_OPT_RST_LEN
) {
699 ND_PRINT("[Bad OPT_RST option, length %u != %u]",
700 opt_len
, PGM_OPT_RST_LEN
);
705 opts_len
-= PGM_OPT_RST_LEN
;
715 #define PGM_OPT_CRQST_LEN (2+2)
716 if (opt_len
!= PGM_OPT_CRQST_LEN
) {
717 ND_PRINT("[Bad OPT_CRQST option, length %u != %u]",
718 opt_len
, PGM_OPT_CRQST_LEN
);
723 opts_len
-= PGM_OPT_CRQST_LEN
;
726 case PGM_OPT_PGMCC_DATA
:
727 #define PGM_OPT_PGMCC_DATA_FIXED_LEN (2+2+4+2+2)
728 if (opt_len
< PGM_OPT_PGMCC_DATA_FIXED_LEN
) {
729 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u < %u]",
730 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
734 offset
= EXTRACT_BE_U_4(bp
);
736 nla_afnum
= EXTRACT_BE_U_2(bp
);
740 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
)) {
741 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
742 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
745 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
746 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
747 bp
+= sizeof(nd_ipv4
);
748 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
);
751 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
)) {
752 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
753 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
756 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
757 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
758 bp
+= sizeof(nd_ipv6
);
759 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
);
766 ND_PRINT(" PGMCC DATA %u %s", offset
, nla_buf
);
769 case PGM_OPT_PGMCC_FEEDBACK
:
770 #define PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN (2+2+4+2+2)
771 if (opt_len
< PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
) {
772 ND_PRINT("[Bad PGM_OPT_PGMCC_FEEDBACK option, length %u < %u]",
773 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
777 offset
= EXTRACT_BE_U_4(bp
);
779 nla_afnum
= EXTRACT_BE_U_2(bp
);
783 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
)) {
784 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
785 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
788 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
789 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
790 bp
+= sizeof(nd_ipv4
);
791 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
);
794 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
)) {
795 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
796 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
799 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
800 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
801 bp
+= sizeof(nd_ipv6
);
802 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
);
809 ND_PRINT(" PGMCC FEEDBACK %u %s", offset
, nla_buf
);
813 ND_PRINT(" OPT_%02X [%u] ", opt_type
, opt_len
);
819 if (opt_type
& PGM_OPT_END
)
824 ND_PRINT(" [%u]", length
);
825 if (ndo
->ndo_packettype
== PT_PGM_ZMTP1
&&
826 (pgm_type_val
== PGM_ODATA
|| pgm_type_val
== PGM_RDATA
))
827 zmtp1_datagram_print(ndo
, bp
,
828 EXTRACT_BE_U_2(pgm
->pgm_length
));