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
;
153 uint8_t pgm_type_val
;
154 uint16_t sport
, dport
;
156 char nla_buf
[INET6_ADDRSTRLEN
];
157 const struct ip6_hdr
*ip6
;
158 uint8_t opt_type
, opt_len
;
159 uint32_t seq
, opts_len
, len
, offset
;
161 ndo
->ndo_protocol
= "pgm";
162 pgm
= (const struct pgm_header
*)bp
;
163 ip
= (const struct ip
*)bp2
;
165 ip6
= (const struct ip6_hdr
*)bp2
;
169 if (!ND_TTEST_2(pgm
->pgm_dport
)) {
172 ip6addr_string(ndo
, ip6
->ip6_src
),
173 ip6addr_string(ndo
, ip6
->ip6_dst
));
176 ipaddr_string(ndo
, ip
->ip_src
),
177 ipaddr_string(ndo
, ip
->ip_dst
));
183 sport
= EXTRACT_BE_U_2(pgm
->pgm_sport
);
184 dport
= EXTRACT_BE_U_2(pgm
->pgm_dport
);
187 if (EXTRACT_U_1(ip6
->ip6_nxt
) == IPPROTO_PGM
) {
188 ND_PRINT("%s.%s > %s.%s: ",
189 ip6addr_string(ndo
, ip6
->ip6_src
),
190 tcpport_string(ndo
, sport
),
191 ip6addr_string(ndo
, ip6
->ip6_dst
),
192 tcpport_string(ndo
, dport
));
194 ND_PRINT("%s > %s: ",
195 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
198 if (EXTRACT_U_1(ip
->ip_p
) == IPPROTO_PGM
) {
199 ND_PRINT("%s.%s > %s.%s: ",
200 ipaddr_string(ndo
, ip
->ip_src
),
201 tcpport_string(ndo
, sport
),
202 ipaddr_string(ndo
, ip
->ip_dst
),
203 tcpport_string(ndo
, dport
));
205 ND_PRINT("%s > %s: ",
206 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
212 ND_PRINT("PGM, length %u", EXTRACT_BE_U_2(pgm
->pgm_length
));
217 pgm_type_val
= EXTRACT_U_1(pgm
->pgm_type
);
218 ND_PRINT(" 0x%02x%02x%02x%02x%02x%02x ",
225 switch (pgm_type_val
) {
227 const struct pgm_spm
*spm
;
229 spm
= (const struct pgm_spm
*)(pgm
+ 1);
231 bp
= (const u_char
*) (spm
+ 1);
233 switch (EXTRACT_BE_U_2(spm
->pgms_nla_afi
)) {
235 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
236 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
237 bp
+= sizeof(nd_ipv4
);
240 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
241 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
242 bp
+= sizeof(nd_ipv6
);
249 ND_PRINT("SPM seq %u trail %u lead %u nla %s",
250 EXTRACT_BE_U_4(spm
->pgms_seq
),
251 EXTRACT_BE_U_4(spm
->pgms_trailseq
),
252 EXTRACT_BE_U_4(spm
->pgms_leadseq
),
258 const struct pgm_poll
*poll_msg
;
260 poll_msg
= (const struct pgm_poll
*)(pgm
+ 1);
261 ND_TCHECK_SIZE(poll_msg
);
262 ND_PRINT("POLL seq %u round %u",
263 EXTRACT_BE_U_4(poll_msg
->pgmp_seq
),
264 EXTRACT_BE_U_2(poll_msg
->pgmp_round
));
265 bp
= (const u_char
*) (poll_msg
+ 1);
269 const struct pgm_polr
*polr
;
270 uint32_t ivl
, rnd
, mask
;
272 polr
= (const struct pgm_polr
*)(pgm
+ 1);
273 ND_TCHECK_SIZE(polr
);
274 bp
= (const u_char
*) (polr
+ 1);
276 switch (EXTRACT_BE_U_2(polr
->pgmp_nla_afi
)) {
278 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
279 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
280 bp
+= sizeof(nd_ipv4
);
283 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
284 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
285 bp
+= sizeof(nd_ipv6
);
292 ND_TCHECK_LEN(bp
, sizeof(uint32_t));
293 ivl
= EXTRACT_BE_U_4(bp
);
294 bp
+= sizeof(uint32_t);
296 ND_TCHECK_LEN(bp
, sizeof(uint32_t));
297 rnd
= EXTRACT_BE_U_4(bp
);
298 bp
+= sizeof(uint32_t);
300 ND_TCHECK_LEN(bp
, sizeof(uint32_t));
301 mask
= EXTRACT_BE_U_4(bp
);
302 bp
+= sizeof(uint32_t);
304 ND_PRINT("POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
305 "mask 0x%08x", EXTRACT_BE_U_4(polr
->pgmp_seq
),
306 EXTRACT_BE_U_2(polr
->pgmp_round
), nla_buf
, ivl
, rnd
, mask
);
310 const struct pgm_data
*odata
;
312 odata
= (const struct pgm_data
*)(pgm
+ 1);
313 ND_TCHECK_SIZE(odata
);
314 ND_PRINT("ODATA trail %u seq %u",
315 EXTRACT_BE_U_4(odata
->pgmd_trailseq
),
316 EXTRACT_BE_U_4(odata
->pgmd_seq
));
317 bp
= (const u_char
*) (odata
+ 1);
322 const struct pgm_data
*rdata
;
324 rdata
= (const struct pgm_data
*)(pgm
+ 1);
325 ND_TCHECK_SIZE(rdata
);
326 ND_PRINT("RDATA trail %u seq %u",
327 EXTRACT_BE_U_4(rdata
->pgmd_trailseq
),
328 EXTRACT_BE_U_4(rdata
->pgmd_seq
));
329 bp
= (const u_char
*) (rdata
+ 1);
336 const struct pgm_nak
*nak
;
337 char source_buf
[INET6_ADDRSTRLEN
], group_buf
[INET6_ADDRSTRLEN
];
339 nak
= (const struct pgm_nak
*)(pgm
+ 1);
341 bp
= (const u_char
*) (nak
+ 1);
344 * Skip past the source, saving info along the way
345 * and stopping if we don't have enough.
347 switch (EXTRACT_BE_U_2(nak
->pgmn_source_afi
)) {
349 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
350 addrtostr(bp
, source_buf
, sizeof(source_buf
));
351 bp
+= sizeof(nd_ipv4
);
354 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
355 addrtostr6(bp
, source_buf
, sizeof(source_buf
));
356 bp
+= sizeof(nd_ipv6
);
364 * Skip past the group, saving info along the way
365 * and stopping if we don't have enough.
367 bp
+= (2 * sizeof(uint16_t));
369 switch (EXTRACT_BE_U_2(bp
)) {
371 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
372 addrtostr(bp
, group_buf
, sizeof(group_buf
));
373 bp
+= sizeof(nd_ipv4
);
376 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
377 addrtostr6(bp
, group_buf
, sizeof(group_buf
));
378 bp
+= sizeof(nd_ipv6
);
386 * Options decoding can go here.
388 switch (pgm_type_val
) {
401 ND_PRINT("(%s -> %s), seq %u",
402 source_buf
, group_buf
, EXTRACT_BE_U_4(nak
->pgmn_seq
));
407 const struct pgm_ack
*ack
;
409 ack
= (const struct pgm_ack
*)(pgm
+ 1);
411 ND_PRINT("ACK seq %u",
412 EXTRACT_BE_U_4(ack
->pgma_rx_max_seq
));
413 bp
= (const u_char
*) (ack
+ 1);
422 ND_PRINT("UNKNOWN type 0x%02x", pgm_type_val
);
426 if (EXTRACT_U_1(pgm
->pgm_options
) & PGM_OPT_BIT_PRESENT
) {
429 * make sure there's enough for the first option header
431 if (!ND_TTEST_LEN(bp
, PGM_MIN_OPT_LEN
)) {
437 * That option header MUST be an OPT_LENGTH option
438 * (see the first paragraph of section 9.1 in RFC 3208).
440 opt_type
= EXTRACT_U_1(bp
);
442 if ((opt_type
& PGM_OPT_MASK
) != PGM_OPT_LENGTH
) {
443 ND_PRINT("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type
& PGM_OPT_MASK
);
446 opt_len
= EXTRACT_U_1(bp
);
449 ND_PRINT("[Bad OPT_LENGTH option, length %u != 4]", opt_len
);
452 opts_len
= EXTRACT_BE_U_2(bp
);
453 bp
+= sizeof(uint16_t);
455 ND_PRINT("[Bad total option length %u < 4]", opts_len
);
458 ND_PRINT(" OPTS LEN %u", opts_len
);
462 if (opts_len
< PGM_MIN_OPT_LEN
) {
463 ND_PRINT("[Total option length leaves no room for final option]");
466 if (!ND_TTEST_2(bp
)) {
470 opt_type
= EXTRACT_U_1(bp
);
472 opt_len
= EXTRACT_U_1(bp
);
474 if (opt_len
< PGM_MIN_OPT_LEN
) {
475 ND_PRINT("[Bad option, length %u < %u]", opt_len
,
479 if (opts_len
< opt_len
) {
480 ND_PRINT("[Total option length leaves no room for final option]");
483 if (!ND_TTEST_LEN(bp
, opt_len
- 2)) {
488 switch (opt_type
& PGM_OPT_MASK
) {
490 #define PGM_OPT_LENGTH_LEN (2+2)
491 if (opt_len
!= PGM_OPT_LENGTH_LEN
) {
492 ND_PRINT("[Bad OPT_LENGTH option, length %u != %u]",
493 opt_len
, PGM_OPT_LENGTH_LEN
);
496 ND_PRINT(" OPTS LEN (extra?) %u", EXTRACT_BE_U_2(bp
));
498 opts_len
-= PGM_OPT_LENGTH_LEN
;
501 case PGM_OPT_FRAGMENT
:
502 #define PGM_OPT_FRAGMENT_LEN (2+2+4+4+4)
503 if (opt_len
!= PGM_OPT_FRAGMENT_LEN
) {
504 ND_PRINT("[Bad OPT_FRAGMENT option, length %u != %u]",
505 opt_len
, PGM_OPT_FRAGMENT_LEN
);
509 seq
= EXTRACT_BE_U_4(bp
);
511 offset
= EXTRACT_BE_U_4(bp
);
513 len
= EXTRACT_BE_U_4(bp
);
515 ND_PRINT(" FRAG seq %u off %u len %u", seq
, offset
, len
);
516 opts_len
-= PGM_OPT_FRAGMENT_LEN
;
519 case PGM_OPT_NAK_LIST
:
521 opt_len
-= 4; /* option header */
522 ND_PRINT(" NAK LIST");
525 ND_PRINT("[Option length not a multiple of 4]");
529 ND_PRINT(" %u", EXTRACT_BE_U_4(bp
));
537 #define PGM_OPT_JOIN_LEN (2+2+4)
538 if (opt_len
!= PGM_OPT_JOIN_LEN
) {
539 ND_PRINT("[Bad OPT_JOIN option, length %u != %u]",
540 opt_len
, PGM_OPT_JOIN_LEN
);
544 seq
= EXTRACT_BE_U_4(bp
);
546 ND_PRINT(" JOIN %u", seq
);
547 opts_len
-= PGM_OPT_JOIN_LEN
;
550 case PGM_OPT_NAK_BO_IVL
:
551 #define PGM_OPT_NAK_BO_IVL_LEN (2+2+4+4)
552 if (opt_len
!= PGM_OPT_NAK_BO_IVL_LEN
) {
553 ND_PRINT("[Bad OPT_NAK_BO_IVL option, length %u != %u]",
554 opt_len
, PGM_OPT_NAK_BO_IVL_LEN
);
558 offset
= EXTRACT_BE_U_4(bp
);
560 seq
= EXTRACT_BE_U_4(bp
);
562 ND_PRINT(" BACKOFF ivl %u ivlseq %u", offset
, seq
);
563 opts_len
-= PGM_OPT_NAK_BO_IVL_LEN
;
566 case PGM_OPT_NAK_BO_RNG
:
567 #define PGM_OPT_NAK_BO_RNG_LEN (2+2+4+4)
568 if (opt_len
!= PGM_OPT_NAK_BO_RNG_LEN
) {
569 ND_PRINT("[Bad OPT_NAK_BO_RNG option, length %u != %u]",
570 opt_len
, PGM_OPT_NAK_BO_RNG_LEN
);
574 offset
= EXTRACT_BE_U_4(bp
);
576 seq
= EXTRACT_BE_U_4(bp
);
578 ND_PRINT(" BACKOFF max %u min %u", offset
, seq
);
579 opts_len
-= PGM_OPT_NAK_BO_RNG_LEN
;
582 case PGM_OPT_REDIRECT
:
583 #define PGM_OPT_REDIRECT_FIXED_LEN (2+2+2+2)
584 if (opt_len
< PGM_OPT_REDIRECT_FIXED_LEN
) {
585 ND_PRINT("[Bad OPT_REDIRECT option, length %u < %u]",
586 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
590 nla_afnum
= EXTRACT_BE_U_2(bp
);
594 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
)) {
595 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
596 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
599 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
600 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
601 bp
+= sizeof(nd_ipv4
);
602 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
);
605 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
)) {
606 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
607 PGM_OPT_REDIRECT_FIXED_LEN
, opt_len
);
610 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
611 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
612 bp
+= sizeof(nd_ipv6
);
613 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
);
620 ND_PRINT(" REDIRECT %s", nla_buf
);
623 case PGM_OPT_PARITY_PRM
:
624 #define PGM_OPT_PARITY_PRM_LEN (2+2+4)
625 if (opt_len
!= PGM_OPT_PARITY_PRM_LEN
) {
626 ND_PRINT("[Bad OPT_PARITY_PRM option, length %u != %u]",
627 opt_len
, PGM_OPT_PARITY_PRM_LEN
);
631 len
= EXTRACT_BE_U_4(bp
);
633 ND_PRINT(" PARITY MAXTGS %u", len
);
634 opts_len
-= PGM_OPT_PARITY_PRM_LEN
;
637 case PGM_OPT_PARITY_GRP
:
638 #define PGM_OPT_PARITY_GRP_LEN (2+2+4)
639 if (opt_len
!= PGM_OPT_PARITY_GRP_LEN
) {
640 ND_PRINT("[Bad OPT_PARITY_GRP option, length %u != %u]",
641 opt_len
, PGM_OPT_PARITY_GRP_LEN
);
645 seq
= EXTRACT_BE_U_4(bp
);
647 ND_PRINT(" PARITY GROUP %u", seq
);
648 opts_len
-= PGM_OPT_PARITY_GRP_LEN
;
651 case PGM_OPT_CURR_TGSIZE
:
652 #define PGM_OPT_CURR_TGSIZE_LEN (2+2+4)
653 if (opt_len
!= PGM_OPT_CURR_TGSIZE_LEN
) {
654 ND_PRINT("[Bad OPT_CURR_TGSIZE option, length %u != %u]",
655 opt_len
, PGM_OPT_CURR_TGSIZE_LEN
);
659 len
= EXTRACT_BE_U_4(bp
);
661 ND_PRINT(" PARITY ATGS %u", len
);
662 opts_len
-= PGM_OPT_CURR_TGSIZE_LEN
;
665 case PGM_OPT_NBR_UNREACH
:
666 #define PGM_OPT_NBR_UNREACH_LEN (2+2)
667 if (opt_len
!= PGM_OPT_NBR_UNREACH_LEN
) {
668 ND_PRINT("[Bad OPT_NBR_UNREACH option, length %u != %u]",
669 opt_len
, PGM_OPT_NBR_UNREACH_LEN
);
673 ND_PRINT(" NBR_UNREACH");
674 opts_len
-= PGM_OPT_NBR_UNREACH_LEN
;
677 case PGM_OPT_PATH_NLA
:
678 ND_PRINT(" PATH_NLA [%u]", opt_len
);
684 #define PGM_OPT_SYN_LEN (2+2)
685 if (opt_len
!= PGM_OPT_SYN_LEN
) {
686 ND_PRINT("[Bad OPT_SYN option, length %u != %u]",
687 opt_len
, PGM_OPT_SYN_LEN
);
692 opts_len
-= PGM_OPT_SYN_LEN
;
696 #define PGM_OPT_FIN_LEN (2+2)
697 if (opt_len
!= PGM_OPT_FIN_LEN
) {
698 ND_PRINT("[Bad OPT_FIN option, length %u != %u]",
699 opt_len
, PGM_OPT_FIN_LEN
);
704 opts_len
-= PGM_OPT_FIN_LEN
;
708 #define PGM_OPT_RST_LEN (2+2)
709 if (opt_len
!= PGM_OPT_RST_LEN
) {
710 ND_PRINT("[Bad OPT_RST option, length %u != %u]",
711 opt_len
, PGM_OPT_RST_LEN
);
716 opts_len
-= PGM_OPT_RST_LEN
;
726 #define PGM_OPT_CRQST_LEN (2+2)
727 if (opt_len
!= PGM_OPT_CRQST_LEN
) {
728 ND_PRINT("[Bad OPT_CRQST option, length %u != %u]",
729 opt_len
, PGM_OPT_CRQST_LEN
);
734 opts_len
-= PGM_OPT_CRQST_LEN
;
737 case PGM_OPT_PGMCC_DATA
:
738 #define PGM_OPT_PGMCC_DATA_FIXED_LEN (2+2+4+2+2)
739 if (opt_len
< PGM_OPT_PGMCC_DATA_FIXED_LEN
) {
740 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u < %u]",
741 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
745 offset
= EXTRACT_BE_U_4(bp
);
747 nla_afnum
= EXTRACT_BE_U_2(bp
);
751 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
)) {
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_ipv4
));
757 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
758 bp
+= sizeof(nd_ipv4
);
759 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
);
762 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
)) {
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_ipv6
));
768 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
769 bp
+= sizeof(nd_ipv6
);
770 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
);
777 ND_PRINT(" PGMCC DATA %u %s", offset
, nla_buf
);
780 case PGM_OPT_PGMCC_FEEDBACK
:
781 #define PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN (2+2+4+2+2)
782 if (opt_len
< PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
) {
783 ND_PRINT("[Bad PGM_OPT_PGMCC_FEEDBACK option, length %u < %u]",
784 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
788 offset
= EXTRACT_BE_U_4(bp
);
790 nla_afnum
= EXTRACT_BE_U_2(bp
);
794 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
)) {
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_ipv4
));
800 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
801 bp
+= sizeof(nd_ipv4
);
802 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
);
805 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
)) {
806 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
807 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
810 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
811 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
812 bp
+= sizeof(nd_ipv6
);
813 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
);
820 ND_PRINT(" PGMCC FEEDBACK %u %s", offset
, nla_buf
);
824 ND_PRINT(" OPT_%02X [%u] ", opt_type
, opt_len
);
830 if (opt_type
& PGM_OPT_END
)
835 ND_PRINT(" [%u]", length
);
836 if (ndo
->ndo_packettype
== PT_PGM_ZMTP1
&&
837 (pgm_type_val
== PGM_ODATA
|| pgm_type_val
== PGM_RDATA
))
838 zmtp1_datagram_print(ndo
, bp
,
839 EXTRACT_BE_U_2(pgm
->pgm_length
));