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 #define ND_LONGJMP_FROM_TCHECK
25 #include "netdissect.h"
27 #include "addrtoname.h"
28 #include "addrtostr.h"
36 * PGM header (RFC 3208)
39 nd_uint16_t pgm_sport
;
40 nd_uint16_t pgm_dport
;
42 nd_uint8_t pgm_options
;
45 nd_uint16_t pgm_length
;
50 nd_uint32_t pgms_trailseq
;
51 nd_uint32_t pgms_leadseq
;
52 nd_uint16_t pgms_nla_afi
;
53 nd_uint16_t pgms_reserved
;
54 /* ... uint8_t pgms_nla[0]; */
60 nd_uint16_t pgmn_source_afi
;
61 nd_uint16_t pgmn_reserved
;
62 /* ... uint8_t pgmn_source[0]; */
63 /* ... uint16_t pgmn_group_afi */
64 /* ... uint16_t pgmn_reserved2; */
65 /* ... uint8_t pgmn_group[0]; */
70 nd_uint32_t pgma_rx_max_seq
;
71 nd_uint32_t pgma_bitmap
;
77 nd_uint16_t pgmp_round
;
78 nd_uint16_t pgmp_subtype
;
79 nd_uint16_t pgmp_nla_afi
;
80 nd_uint16_t pgmp_reserved
;
81 /* ... uint8_t pgmp_nla[0]; */
87 nd_uint16_t pgmp_round
;
88 nd_uint16_t pgmp_reserved
;
94 nd_uint32_t pgmd_trailseq
;
98 typedef enum _pgm_type
{
99 PGM_SPM
= 0, /* source path message */
100 PGM_POLL
= 1, /* POLL Request */
101 PGM_POLR
= 2, /* POLL Response */
102 PGM_ODATA
= 4, /* original data */
103 PGM_RDATA
= 5, /* repair data */
104 PGM_NAK
= 8, /* NAK */
105 PGM_NULLNAK
= 9, /* Null NAK */
106 PGM_NCF
= 10, /* NAK Confirmation */
107 PGM_ACK
= 11, /* ACK for congestion control */
108 PGM_SPMR
= 12, /* SPM request */
112 #define PGM_OPT_BIT_PRESENT 0x01
113 #define PGM_OPT_BIT_NETWORK 0x02
114 #define PGM_OPT_BIT_VAR_PKTLEN 0x40
115 #define PGM_OPT_BIT_PARITY 0x80
117 #define PGM_OPT_LENGTH 0x00
118 #define PGM_OPT_FRAGMENT 0x01
119 #define PGM_OPT_NAK_LIST 0x02
120 #define PGM_OPT_JOIN 0x03
121 #define PGM_OPT_NAK_BO_IVL 0x04
122 #define PGM_OPT_NAK_BO_RNG 0x05
124 #define PGM_OPT_REDIRECT 0x07
125 #define PGM_OPT_PARITY_PRM 0x08
126 #define PGM_OPT_PARITY_GRP 0x09
127 #define PGM_OPT_CURR_TGSIZE 0x0A
128 #define PGM_OPT_NBR_UNREACH 0x0B
129 #define PGM_OPT_PATH_NLA 0x0C
131 #define PGM_OPT_SYN 0x0D
132 #define PGM_OPT_FIN 0x0E
133 #define PGM_OPT_RST 0x0F
134 #define PGM_OPT_CR 0x10
135 #define PGM_OPT_CRQST 0x11
137 #define PGM_OPT_PGMCC_DATA 0x12
138 #define PGM_OPT_PGMCC_FEEDBACK 0x13
140 #define PGM_OPT_MASK 0x7f
142 #define PGM_OPT_END 0x80 /* end of options marker */
144 #define PGM_MIN_OPT_LEN 4
147 pgm_print(netdissect_options
*ndo
,
148 const u_char
*bp
, u_int length
,
151 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
;
168 if (!ND_TTEST_2(pgm
->pgm_dport
)) {
171 GET_IP6ADDR_STRING(ip6
->ip6_src
),
172 GET_IP6ADDR_STRING(ip6
->ip6_dst
));
175 GET_IPADDR_STRING(ip
->ip_src
),
176 GET_IPADDR_STRING(ip
->ip_dst
));
178 nd_trunc_longjmp(ndo
);
181 sport
= GET_BE_U_2(pgm
->pgm_sport
);
182 dport
= GET_BE_U_2(pgm
->pgm_dport
);
185 if (GET_U_1(ip6
->ip6_nxt
) == IPPROTO_PGM
) {
186 ND_PRINT("%s.%s > %s.%s: ",
187 GET_IP6ADDR_STRING(ip6
->ip6_src
),
188 tcpport_string(ndo
, sport
),
189 GET_IP6ADDR_STRING(ip6
->ip6_dst
),
190 tcpport_string(ndo
, dport
));
192 ND_PRINT("%s > %s: ",
193 tcpport_string(ndo
, sport
), tcpport_string(ndo
, dport
));
196 if (GET_U_1(ip
->ip_p
) == IPPROTO_PGM
) {
197 ND_PRINT("%s.%s > %s.%s: ",
198 GET_IPADDR_STRING(ip
->ip_src
),
199 tcpport_string(ndo
, sport
),
200 GET_IPADDR_STRING(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", GET_BE_U_2(pgm
->pgm_length
));
215 pgm_type_val
= GET_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 (GET_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 GET_BE_U_4(spm
->pgms_seq
),
249 GET_BE_U_4(spm
->pgms_trailseq
),
250 GET_BE_U_4(spm
->pgms_leadseq
),
256 const struct pgm_poll
*pgm_poll
;
257 uint32_t ivl
, rnd
, mask
;
259 pgm_poll
= (const struct pgm_poll
*)(pgm
+ 1);
260 ND_TCHECK_SIZE(pgm_poll
);
261 bp
= (const u_char
*) (pgm_poll
+ 1);
263 switch (GET_BE_U_2(pgm_poll
->pgmp_nla_afi
)) {
265 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
266 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
267 bp
+= sizeof(nd_ipv4
);
270 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
271 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
272 bp
+= sizeof(nd_ipv6
);
279 ivl
= GET_BE_U_4(bp
);
280 bp
+= sizeof(uint32_t);
282 rnd
= GET_BE_U_4(bp
);
283 bp
+= sizeof(uint32_t);
285 mask
= GET_BE_U_4(bp
);
286 bp
+= sizeof(uint32_t);
288 ND_PRINT("POLL seq %u round %u nla %s ivl %u rnd 0x%08x "
289 "mask 0x%08x", GET_BE_U_4(pgm_poll
->pgmp_seq
),
290 GET_BE_U_2(pgm_poll
->pgmp_round
), nla_buf
, ivl
, rnd
,
295 const struct pgm_polr
*polr_msg
;
297 polr_msg
= (const struct pgm_polr
*)(pgm
+ 1);
298 ND_TCHECK_SIZE(polr_msg
);
299 ND_PRINT("POLR seq %u round %u",
300 GET_BE_U_4(polr_msg
->pgmp_seq
),
301 GET_BE_U_2(polr_msg
->pgmp_round
));
302 bp
= (const u_char
*) (polr_msg
+ 1);
306 const struct pgm_data
*odata
;
308 odata
= (const struct pgm_data
*)(pgm
+ 1);
309 ND_PRINT("ODATA trail %u seq %u",
310 GET_BE_U_4(odata
->pgmd_trailseq
),
311 GET_BE_U_4(odata
->pgmd_seq
));
312 bp
= (const u_char
*) (odata
+ 1);
317 const struct pgm_data
*rdata
;
319 rdata
= (const struct pgm_data
*)(pgm
+ 1);
320 ND_PRINT("RDATA trail %u seq %u",
321 GET_BE_U_4(rdata
->pgmd_trailseq
),
322 GET_BE_U_4(rdata
->pgmd_seq
));
323 bp
= (const u_char
*) (rdata
+ 1);
330 const struct pgm_nak
*nak
;
331 char source_buf
[INET6_ADDRSTRLEN
], group_buf
[INET6_ADDRSTRLEN
];
333 nak
= (const struct pgm_nak
*)(pgm
+ 1);
335 bp
= (const u_char
*) (nak
+ 1);
338 * Skip past the source, saving info along the way
339 * and stopping if we don't have enough.
341 switch (GET_BE_U_2(nak
->pgmn_source_afi
)) {
343 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
344 addrtostr(bp
, source_buf
, sizeof(source_buf
));
345 bp
+= sizeof(nd_ipv4
);
348 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
349 addrtostr6(bp
, source_buf
, sizeof(source_buf
));
350 bp
+= sizeof(nd_ipv6
);
358 * Skip past the group, saving info along the way
359 * and stopping if we don't have enough.
361 bp
+= (2 * sizeof(uint16_t));
362 switch (GET_BE_U_2(bp
)) {
364 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
365 addrtostr(bp
, group_buf
, sizeof(group_buf
));
366 bp
+= sizeof(nd_ipv4
);
369 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
370 addrtostr6(bp
, group_buf
, sizeof(group_buf
));
371 bp
+= sizeof(nd_ipv6
);
379 * Options decoding can go here.
381 switch (pgm_type_val
) {
394 ND_PRINT("(%s -> %s), seq %u",
395 source_buf
, group_buf
, GET_BE_U_4(nak
->pgmn_seq
));
400 const struct pgm_ack
*ack
;
402 ack
= (const struct pgm_ack
*)(pgm
+ 1);
404 ND_PRINT("ACK seq %u",
405 GET_BE_U_4(ack
->pgma_rx_max_seq
));
406 bp
= (const u_char
*) (ack
+ 1);
415 ND_PRINT("UNKNOWN type 0x%02x", pgm_type_val
);
419 if (GET_U_1(pgm
->pgm_options
) & PGM_OPT_BIT_PRESENT
) {
422 * make sure there's enough for the first option header
424 ND_TCHECK_LEN(bp
, PGM_MIN_OPT_LEN
);
427 * That option header MUST be an OPT_LENGTH option
428 * (see the first paragraph of section 9.1 in RFC 3208).
430 opt_type
= GET_U_1(bp
);
432 if ((opt_type
& PGM_OPT_MASK
) != PGM_OPT_LENGTH
) {
433 ND_PRINT("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type
& PGM_OPT_MASK
);
436 opt_len
= GET_U_1(bp
);
439 ND_PRINT("[Bad OPT_LENGTH option, length %u != 4]", opt_len
);
442 opts_len
= GET_BE_U_2(bp
);
443 bp
+= sizeof(uint16_t);
445 ND_PRINT("[Bad total option length %u < 4]", opts_len
);
448 ND_PRINT(" OPTS LEN %u", opts_len
);
452 if (opts_len
< PGM_MIN_OPT_LEN
) {
453 ND_PRINT("[Total option length leaves no room for final option]");
456 opt_type
= GET_U_1(bp
);
458 opt_len
= GET_U_1(bp
);
460 if (opt_len
< PGM_MIN_OPT_LEN
) {
461 ND_PRINT("[Bad option, length %u < %u]", opt_len
,
465 if (opts_len
< opt_len
) {
466 ND_PRINT("[Total option length leaves no room for final option]");
469 ND_TCHECK_LEN(bp
, opt_len
- 2);
471 switch (opt_type
& PGM_OPT_MASK
) {
473 #define PGM_OPT_LENGTH_LEN (2+2)
474 if (opt_len
!= PGM_OPT_LENGTH_LEN
) {
475 ND_PRINT("[Bad OPT_LENGTH option, length %u != %u]",
476 opt_len
, PGM_OPT_LENGTH_LEN
);
479 ND_PRINT(" OPTS LEN (extra?) %u", GET_BE_U_2(bp
));
481 opts_len
-= PGM_OPT_LENGTH_LEN
;
484 case PGM_OPT_FRAGMENT
:
485 #define PGM_OPT_FRAGMENT_LEN (2+2+4+4+4)
486 if (opt_len
!= PGM_OPT_FRAGMENT_LEN
) {
487 ND_PRINT("[Bad OPT_FRAGMENT option, length %u != %u]",
488 opt_len
, PGM_OPT_FRAGMENT_LEN
);
492 seq
= GET_BE_U_4(bp
);
494 offset
= GET_BE_U_4(bp
);
496 len
= GET_BE_U_4(bp
);
498 ND_PRINT(" FRAG seq %u off %u len %u", seq
, offset
, len
);
499 opts_len
-= PGM_OPT_FRAGMENT_LEN
;
502 case PGM_OPT_NAK_LIST
:
504 opt_len
-= 4; /* option header */
505 ND_PRINT(" NAK LIST");
508 ND_PRINT("[Option length not a multiple of 4]");
511 ND_PRINT(" %u", GET_BE_U_4(bp
));
519 #define PGM_OPT_JOIN_LEN (2+2+4)
520 if (opt_len
!= PGM_OPT_JOIN_LEN
) {
521 ND_PRINT("[Bad OPT_JOIN option, length %u != %u]",
522 opt_len
, PGM_OPT_JOIN_LEN
);
526 seq
= GET_BE_U_4(bp
);
528 ND_PRINT(" JOIN %u", seq
);
529 opts_len
-= PGM_OPT_JOIN_LEN
;
532 case PGM_OPT_NAK_BO_IVL
:
533 #define PGM_OPT_NAK_BO_IVL_LEN (2+2+4+4)
534 if (opt_len
!= PGM_OPT_NAK_BO_IVL_LEN
) {
535 ND_PRINT("[Bad OPT_NAK_BO_IVL option, length %u != %u]",
536 opt_len
, PGM_OPT_NAK_BO_IVL_LEN
);
540 offset
= GET_BE_U_4(bp
);
542 seq
= GET_BE_U_4(bp
);
544 ND_PRINT(" BACKOFF ivl %u ivlseq %u", offset
, seq
);
545 opts_len
-= PGM_OPT_NAK_BO_IVL_LEN
;
548 case PGM_OPT_NAK_BO_RNG
:
549 #define PGM_OPT_NAK_BO_RNG_LEN (2+2+4+4)
550 if (opt_len
!= PGM_OPT_NAK_BO_RNG_LEN
) {
551 ND_PRINT("[Bad OPT_NAK_BO_RNG option, length %u != %u]",
552 opt_len
, PGM_OPT_NAK_BO_RNG_LEN
);
556 offset
= GET_BE_U_4(bp
);
558 seq
= GET_BE_U_4(bp
);
560 ND_PRINT(" BACKOFF max %u min %u", offset
, seq
);
561 opts_len
-= PGM_OPT_NAK_BO_RNG_LEN
;
564 case PGM_OPT_REDIRECT
:
565 #define PGM_OPT_REDIRECT_FIXED_LEN (2+2+2+2)
566 if (opt_len
< PGM_OPT_REDIRECT_FIXED_LEN
) {
567 ND_PRINT("[Bad OPT_REDIRECT option, length %u < %u]",
568 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
572 nla_afnum
= GET_BE_U_2(bp
);
576 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
)) {
577 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
578 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
581 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
582 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
583 bp
+= sizeof(nd_ipv4
);
584 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv4
);
587 if (opt_len
!= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
)) {
588 ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]",
589 opt_len
, PGM_OPT_REDIRECT_FIXED_LEN
);
592 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
593 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
594 bp
+= sizeof(nd_ipv6
);
595 opts_len
-= PGM_OPT_REDIRECT_FIXED_LEN
+ sizeof(nd_ipv6
);
602 ND_PRINT(" REDIRECT %s", nla_buf
);
605 case PGM_OPT_PARITY_PRM
:
606 #define PGM_OPT_PARITY_PRM_LEN (2+2+4)
607 if (opt_len
!= PGM_OPT_PARITY_PRM_LEN
) {
608 ND_PRINT("[Bad OPT_PARITY_PRM option, length %u != %u]",
609 opt_len
, PGM_OPT_PARITY_PRM_LEN
);
613 len
= GET_BE_U_4(bp
);
615 ND_PRINT(" PARITY MAXTGS %u", len
);
616 opts_len
-= PGM_OPT_PARITY_PRM_LEN
;
619 case PGM_OPT_PARITY_GRP
:
620 #define PGM_OPT_PARITY_GRP_LEN (2+2+4)
621 if (opt_len
!= PGM_OPT_PARITY_GRP_LEN
) {
622 ND_PRINT("[Bad OPT_PARITY_GRP option, length %u != %u]",
623 opt_len
, PGM_OPT_PARITY_GRP_LEN
);
627 seq
= GET_BE_U_4(bp
);
629 ND_PRINT(" PARITY GROUP %u", seq
);
630 opts_len
-= PGM_OPT_PARITY_GRP_LEN
;
633 case PGM_OPT_CURR_TGSIZE
:
634 #define PGM_OPT_CURR_TGSIZE_LEN (2+2+4)
635 if (opt_len
!= PGM_OPT_CURR_TGSIZE_LEN
) {
636 ND_PRINT("[Bad OPT_CURR_TGSIZE option, length %u != %u]",
637 opt_len
, PGM_OPT_CURR_TGSIZE_LEN
);
641 len
= GET_BE_U_4(bp
);
643 ND_PRINT(" PARITY ATGS %u", len
);
644 opts_len
-= PGM_OPT_CURR_TGSIZE_LEN
;
647 case PGM_OPT_NBR_UNREACH
:
648 #define PGM_OPT_NBR_UNREACH_LEN (2+2)
649 if (opt_len
!= PGM_OPT_NBR_UNREACH_LEN
) {
650 ND_PRINT("[Bad OPT_NBR_UNREACH option, length %u != %u]",
651 opt_len
, PGM_OPT_NBR_UNREACH_LEN
);
655 ND_PRINT(" NBR_UNREACH");
656 opts_len
-= PGM_OPT_NBR_UNREACH_LEN
;
659 case PGM_OPT_PATH_NLA
:
660 ND_PRINT(" PATH_NLA [%u]", opt_len
);
666 #define PGM_OPT_SYN_LEN (2+2)
667 if (opt_len
!= PGM_OPT_SYN_LEN
) {
668 ND_PRINT("[Bad OPT_SYN option, length %u != %u]",
669 opt_len
, PGM_OPT_SYN_LEN
);
674 opts_len
-= PGM_OPT_SYN_LEN
;
678 #define PGM_OPT_FIN_LEN (2+2)
679 if (opt_len
!= PGM_OPT_FIN_LEN
) {
680 ND_PRINT("[Bad OPT_FIN option, length %u != %u]",
681 opt_len
, PGM_OPT_FIN_LEN
);
686 opts_len
-= PGM_OPT_FIN_LEN
;
690 #define PGM_OPT_RST_LEN (2+2)
691 if (opt_len
!= PGM_OPT_RST_LEN
) {
692 ND_PRINT("[Bad OPT_RST option, length %u != %u]",
693 opt_len
, PGM_OPT_RST_LEN
);
698 opts_len
-= PGM_OPT_RST_LEN
;
708 #define PGM_OPT_CRQST_LEN (2+2)
709 if (opt_len
!= PGM_OPT_CRQST_LEN
) {
710 ND_PRINT("[Bad OPT_CRQST option, length %u != %u]",
711 opt_len
, PGM_OPT_CRQST_LEN
);
716 opts_len
-= PGM_OPT_CRQST_LEN
;
719 case PGM_OPT_PGMCC_DATA
:
720 #define PGM_OPT_PGMCC_DATA_FIXED_LEN (2+2+4+2+2)
721 if (opt_len
< PGM_OPT_PGMCC_DATA_FIXED_LEN
) {
722 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u < %u]",
723 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
727 offset
= GET_BE_U_4(bp
);
729 nla_afnum
= GET_BE_U_2(bp
);
733 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
)) {
734 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
735 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
738 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
739 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
740 bp
+= sizeof(nd_ipv4
);
741 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv4
);
744 if (opt_len
!= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
)) {
745 ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]",
746 opt_len
, PGM_OPT_PGMCC_DATA_FIXED_LEN
);
749 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
750 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
751 bp
+= sizeof(nd_ipv6
);
752 opts_len
-= PGM_OPT_PGMCC_DATA_FIXED_LEN
+ sizeof(nd_ipv6
);
759 ND_PRINT(" PGMCC DATA %u %s", offset
, nla_buf
);
762 case PGM_OPT_PGMCC_FEEDBACK
:
763 #define PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN (2+2+4+2+2)
764 if (opt_len
< PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
) {
765 ND_PRINT("[Bad PGM_OPT_PGMCC_FEEDBACK option, length %u < %u]",
766 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
770 offset
= GET_BE_U_4(bp
);
772 nla_afnum
= GET_BE_U_2(bp
);
776 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
)) {
777 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
778 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
781 ND_TCHECK_LEN(bp
, sizeof(nd_ipv4
));
782 addrtostr(bp
, nla_buf
, sizeof(nla_buf
));
783 bp
+= sizeof(nd_ipv4
);
784 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv4
);
787 if (opt_len
!= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
)) {
788 ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]",
789 opt_len
, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
);
792 ND_TCHECK_LEN(bp
, sizeof(nd_ipv6
));
793 addrtostr6(bp
, nla_buf
, sizeof(nla_buf
));
794 bp
+= sizeof(nd_ipv6
);
795 opts_len
-= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN
+ sizeof(nd_ipv6
);
802 ND_PRINT(" PGMCC FEEDBACK %u %s", offset
, nla_buf
);
806 ND_PRINT(" OPT_%02X [%u] ", opt_type
, opt_len
);
812 if (opt_type
& PGM_OPT_END
)
817 ND_PRINT(" [%u]", length
);
818 if (ndo
->ndo_packettype
== PT_PGM_ZMTP1
&&
819 (pgm_type_val
== PGM_ODATA
|| pgm_type_val
== PGM_RDATA
))
820 zmtp1_datagram_print(ndo
, bp
,
821 GET_BE_U_2(pgm
->pgm_length
));
825 nd_print_invalid(ndo
);