4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
34 #include <sys/types.h>
36 #include <sys/socket.h>
37 #include <sys/sockio.h>
39 #include <netinet/in_systm.h>
40 #include <netinet/in.h>
41 #include <netinet/ip.h>
42 #include <netinet/if_ether.h>
43 #include <arpa/inet.h>
45 #include "snoop_ospf.h"
46 #include "snoop_ospf6.h"
48 extern char *dlc_header
;
49 static char *sum_line
;
50 extern const struct bits ospf_db_flags_bits
[];
51 extern const struct bits ospf_rla_flag_bits
[];
52 extern const struct bits ospf_option_bits
[];
54 const struct bits ospf6_option_bits
[] = {
55 { OSPF_OPTION_V6
, "V6" },
56 { OSPF_OPTION_E
, "E" },
57 { OSPF_OPTION_MC
, "MC" },
58 { OSPF_OPTION_N
, "N" },
59 { OSPF_OPTION_R
, "R" },
60 { OSPF_OPTION_DC
, "DC" },
65 * return a printable string in dotted-decimal notation
69 print_ipaddr(uint32_t id
)
74 return (inet_ntoa(tmp
));
78 interpret_ospf6_hello(int flags
, struct ospf6hdr
*op
, int fraglen
)
83 if (fraglen
< OSPF6_MIN_HEADER_SIZE
+ OSPF_MIN_HELLO_HEADER_SIZE
)
84 return (-1); /* truncated packet */
87 if (op
->ospf6_hello
.hello_dr
!= 0) {
88 (void) sprintf(sum_line
, "DR=%s ",
89 print_ipaddr(op
->ospf6_hello
.hello_dr
));
91 sum_line
+= strlen(sum_line
);
92 if (op
->ospf6_hello
.hello_bdr
!= 0) {
93 (void) sprintf(sum_line
, "BDR=%s ",
94 print_ipaddr(op
->ospf6_hello
.hello_bdr
));
96 sum_line
+= strlen(sum_line
);
98 nbr
= op
->ospf6_hello
.hello_neighbor
;
99 while ((uchar_t
*)nbr
< ((uchar_t
*)op
+ fraglen
)) {
100 if ((uchar_t
*)nbr
+ sizeof (struct in_addr
) >
101 ((uchar_t
*)op
+ fraglen
))
102 return (-1); /* truncated */
106 (void) sprintf(sum_line
, "%d nbrs", j
);
107 sum_line
+= strlen(sum_line
);
110 if (flags
& F_DTAIL
) {
111 show_header("OSPF HELLO: ", "Hello Packet",
112 ntohs(op
->ospf6_len
));
114 (void) snprintf(get_line(0, 0), get_line_remain(),
115 "Options = %s", ospf_print_bits(ospf6_option_bits
,
116 op
->ospf6_hello
.hello6_options
));
117 (void) snprintf(get_line(0, 0), get_line_remain(),
119 print_ipaddr(op
->ospf6_hello
.hello_ifid
));
120 (void) snprintf(get_line(0, 0), get_line_remain(),
121 "Hello interval = %d",
122 ntohs(op
->ospf6_hello
.hello_helloint
));
123 (void) snprintf(get_line(0, 0), get_line_remain(),
124 "Priority = %d", op
->ospf6_hello
.hello6_priority
);
125 (void) snprintf(get_line(0, 0), get_line_remain(),
126 "Dead interval = %u", ntohl(op
->ospf6_hello
.hello_deadint
));
127 if (op
->ospf6_hello
.hello_dr
!= 0) {
128 (void) snprintf(get_line(0, 0), get_line_remain(),
129 "Designated Router = %s",
130 print_ipaddr(op
->ospf6_hello
.hello_dr
));
132 if (op
->ospf6_hello
.hello_bdr
!= 0) {
133 (void) snprintf(get_line(0, 0), get_line_remain(),
134 "Backup Designated Router = %s",
135 print_ipaddr(op
->ospf6_hello
.hello_bdr
));
137 nbr
= op
->ospf6_hello
.hello_neighbor
;
138 while ((uchar_t
*)nbr
< ((uchar_t
*)op
+ fraglen
)) {
139 if ((uchar_t
*)nbr
+ sizeof (struct in_addr
) >
140 ((uchar_t
*)op
+ fraglen
))
141 return (-1); /* truncated */
142 (void) snprintf(get_line(0, 0), get_line_remain(),
143 "Neigbor: %s", print_ipaddr(*nbr
));
151 ospf6_print_ls_type(int flags
, uint_t ls6_type
, uint32_t ls6_stateid
,
159 switch (ls6_type
& LS6_SCOPE_MASK
) {
160 case LS6_SCOPE_LINKLOCAL
:
161 snprintf(scope
, sizeof (scope
), "linklocal");
164 snprintf(scope
, sizeof (scope
), "area");
167 snprintf(scope
, sizeof (scope
), "AS");
170 snprintf(scope
, sizeof (scope
), "");
173 switch (ls6_type
& LS_TYPE_MASK
) {
175 if (flags
& F_DTAIL
) {
176 (void) snprintf(get_line(0, 0), get_line_remain(),
177 "%s Router = %s", scope
, print_ipaddr(ls6_router
));
180 case LS_TYPE_NETWORK
:
181 if (flags
& F_DTAIL
) {
182 (void) snprintf(get_line(0, 0), get_line_remain(),
183 "%s Net DR %s IF %s", scope
,
184 print_ipaddr(ls6_router
),
185 print_ipaddr(ls6_stateid
));
188 case LS_TYPE_INTER_AP
:
189 if (flags
& F_DTAIL
) {
190 (void) snprintf(get_line(0, 0), get_line_remain(),
191 "%s Inter-area-prefix = %s ABR %s", scope
,
192 print_ipaddr(ls6_stateid
),
193 print_ipaddr(ls6_router
));
196 case LS_TYPE_INTER_AR
:
197 if (flags
& F_DTAIL
) {
198 (void) snprintf(get_line(0, 0), get_line_remain(),
199 "%s Inter-area-router = %s Router %s", scope
,
200 print_ipaddr(ls6_router
),
201 print_ipaddr(ls6_stateid
));
205 if (flags
& F_DTAIL
) {
206 (void) snprintf(get_line(0, 0), get_line_remain(),
207 "%s ASE = %s ASBR %s", scope
,
208 print_ipaddr(ls6_stateid
),
209 print_ipaddr(ls6_router
));
213 if (flags
& F_DTAIL
) {
214 (void) snprintf(get_line(0, 0), get_line_remain(),
215 "%s group = %s Router %s", scope
,
216 print_ipaddr(ls6_stateid
),
217 print_ipaddr(ls6_router
));
221 if (flags
& F_DTAIL
) {
222 (void) snprintf(get_line(0, 0), get_line_remain(),
223 "%s Type 7 = %s Router %s", scope
,
224 print_ipaddr(ls6_stateid
),
225 print_ipaddr(ls6_router
));
229 if (flags
& F_DTAIL
) {
230 (void) snprintf(get_line(0, 0), get_line_remain(),
231 "%s link = %s Router %s", scope
,
232 print_ipaddr(ls6_stateid
),
233 print_ipaddr(ls6_router
));
236 case LS_TYPE_INTRA_AP
:
237 if (flags
& F_DTAIL
) {
238 (void) snprintf(get_line(0, 0), get_line_remain(),
239 "%s Inter-area-prefix = %s Router %s", scope
,
240 print_ipaddr(ls6_stateid
),
241 print_ipaddr(ls6_router
));
245 if (flags
& F_DTAIL
) {
246 (void) snprintf(get_line(0, 0), get_line_remain(),
247 "%s Unknown type = 0x%x", ls6_type
);
254 ospf6_print_lsaprefix(int flags
, struct lsa6_prefix
*lpfx
)
257 struct in6_addr prefix
;
258 char prefixstr
[INET6_ADDRSTRLEN
];
260 k
= (lpfx
->lsa6_plen
+ 31)/32;
261 if (k
* 4 > sizeof (struct in6_addr
)) {
263 sprintf(sum_line
, "Unknown prefix len %d",
265 sum_line
+= strlen(sum_line
);
267 if (flags
& F_DTAIL
) {
268 (void) snprintf(get_line(0, 0), get_line_remain(),
269 "Unknown prefix len %d", lpfx
->lsa6_plen
);
272 memset(&prefix
, 0, sizeof (prefix
));
273 memcpy((void *)&prefix
, lpfx
->lsa6_pfx
, k
* 4);
274 (void) inet_ntop(AF_INET6
, (char *)&prefix
, prefixstr
,
277 sprintf(sum_line
, "%s/%d", prefixstr
, lpfx
->lsa6_plen
);
278 sum_line
+= strlen(sum_line
);
280 if (flags
& F_DTAIL
) {
281 (void) snprintf(get_line(0, 0), get_line_remain(),
282 "%s/%d", prefixstr
, lpfx
->lsa6_plen
);
284 if (lpfx
->lsa6_popt
!= 0) {
286 sprintf(sum_line
, "(opt = %x)", lpfx
->lsa6_popt
);
287 sum_line
+= strlen(sum_line
);
289 if (flags
& F_DTAIL
) {
290 (void) snprintf(get_line(0, 0), get_line_remain(),
291 "(opt = %x)", lpfx
->lsa6_popt
);
294 return (sizeof (*lpfx
) - 4 + k
* 4);
298 interpret_ospf6_lsa_hdr(int flags
, struct lsa6_hdr
*lsah
)
303 if (flags
& F_DTAIL
) {
304 (void) snprintf(get_line(0, 0), get_line_remain(),
305 "Sequence = %X ", ntohl(lsah
->ls6_seq
));
306 (void) snprintf(get_line(0, 0), get_line_remain(),
307 "Age = %X ", ospf_print_lsa_age(ntohl(lsah
->ls6_age
)));
310 ospf6_print_ls_type(flags
, lsah
->ls6_type
, lsah
->ls6_stateid
,
315 #define TRUNC(addr) ((uchar_t *)(addr) > fragend)
317 interpret_ospf6_lsa(int flags
, struct lsa6
*lsa
, uchar_t
*fragend
)
323 struct lsa6_prefix
*lpfx
;
325 char addrstr
[INET6_ADDRSTRLEN
];
327 interpret_ospf6_lsa_hdr(flags
, &lsa
->ls6_hdr
);
329 ls_end
= (uchar_t
*)lsa
+ ntohs(lsa
->ls6_hdr
.ls6_length
);
334 switch (ntohs(lsa
->ls6_hdr
.ls6_type
)) {
336 case LS_TYPE_ROUTER
|LS6_SCOPE_AREA
:
337 if (TRUNC(&lsa
->lsa_un
.un_rla
.rla6_flags
))
340 (void) ospf_print_bits(ospf_rla_flag_bits
,
341 lsa
->lsa_un
.un_rla
.rla6_flags
);
343 if (TRUNC(&lsa
->lsa_un
.un_rla
.rla6_options
))
345 (void) ospf_print_bits(ospf_option_bits
,
346 ntohl(lsa
->lsa_un
.un_rla
.rla6_options
));
348 rl
= lsa
->lsa_un
.un_rla
.rla_link
;
352 while (rl
+ sizeof (*rl
) <= (struct rla6link
*)ls_end
) {
353 if (TRUNC((uchar_t
*)rl
+ sizeof (*rl
)))
356 sprintf(sum_line
, "{"); /* } (ctags) */
357 sum_line
+= strlen(sum_line
);
359 switch (rl
->link_type
) {
360 case RLA_TYPE_VIRTUAL
:
362 sprintf(sum_line
, "virt ");
363 sum_line
+= strlen(sum_line
);
365 if (flags
& F_DTAIL
) {
366 (void) snprintf(get_line(0, 0),
367 get_line_remain(), "Virtual Link");
370 case RLA_TYPE_ROUTER
:
372 sprintf(sum_line
, "nbrid %s",
373 print_ipaddr(rl
->link_nrtid
));
374 sum_line
+= strlen(sum_line
);
375 sprintf(sum_line
, " nbrif %s",
376 print_ipaddr(rl
->link_nifid
));
377 sum_line
+= strlen(sum_line
);
378 sprintf(sum_line
, " if %s",
379 print_ipaddr(rl
->link_ifid
));
380 sum_line
+= strlen(sum_line
);
382 if (flags
& F_DTAIL
) {
383 (void) snprintf(get_line(0, 0),
384 get_line_remain(), "Neighbor = %s",
385 print_ipaddr(rl
->link_nrtid
));
386 (void) snprintf(get_line(0, 0),
388 "Interface = %s id %s",
389 print_ipaddr(rl
->link_nifid
),
390 print_ipaddr(rl
->link_ifid
));
393 case RLA_TYPE_TRANSIT
:
395 sprintf(sum_line
, "dr %s",
396 print_ipaddr(rl
->link_nrtid
));
397 sum_line
+= strlen(sum_line
);
398 sprintf(sum_line
, " drif %s",
399 print_ipaddr(rl
->link_nifid
));
400 sum_line
+= strlen(sum_line
);
401 sprintf(sum_line
, " if %s",
402 print_ipaddr(rl
->link_ifid
));
403 sum_line
+= strlen(sum_line
);
405 if (flags
& F_DTAIL
) {
406 (void) snprintf(get_line(0, 0),
408 "Designated Router = %s",
409 print_ipaddr(rl
->link_nrtid
));
410 (void) snprintf(get_line(0, 0),
412 "DR Interface = %s id %s",
413 print_ipaddr(rl
->link_nifid
),
414 print_ipaddr(rl
->link_ifid
));
420 "Unknown link type %d",
422 sum_line
+= strlen(sum_line
);
424 if (flags
& F_DTAIL
) {
425 (void) snprintf(get_line(0, 0),
427 "Unknown link type %d",
433 sprintf(sum_line
, " metric %d",
434 ntohs(rl
->link_metric
));
435 sum_line
+= strlen(sum_line
);
437 if (flags
& F_DTAIL
) {
438 (void) snprintf(get_line(0, 0),
439 get_line_remain(), " metric = %d",
440 ntohs(rl
->link_metric
));
442 if (flags
& F_SUM
) { /* { (ctags) */
443 sprintf(sum_line
, " }");
444 sum_line
+= strlen(sum_line
);
447 if ((uchar_t
*)rl
> fragend
)
448 return (-1); /* truncated */
451 case LS_TYPE_NETWORK
| LS6_SCOPE_AREA
:
453 if (TRUNC(&lsa
->lsa_un
.un_nla
.nla_options
))
456 (void) ospf_print_bits(ospf6_option_bits
,
457 ntohl(lsa
->lsa_un
.un_nla
.nla_options
));
460 sprintf(sum_line
, " rtrs");
461 sum_line
+= strlen(sum_line
);
463 if (flags
& F_DTAIL
) {
464 snprintf(get_line(0, 0), get_line_remain(),
467 addr
= lsa
->lsa_un
.un_nla
.nla_router
;
468 while ((uchar_t
*)addr
< ls_end
) {
469 if ((uchar_t
*)addr
+ sizeof (struct in_addr
) > ls_end
)
470 return (-1); /* truncated */
472 sprintf(sum_line
, " %s", print_ipaddr(*addr
));
473 sum_line
+= strlen(sum_line
);
475 if (flags
& F_DTAIL
) {
476 snprintf(get_line(0, 0), get_line_remain(),
477 "\t%s", print_ipaddr(*addr
));
482 case LS_TYPE_INTER_AP
| LS6_SCOPE_AREA
:
484 if (TRUNC(&lsa
->lsa_un
.un_inter_ap
.inter_ap_metric
))
488 sprintf(sum_line
, " metric %s",
489 ntohl(lsa
->lsa_un
.un_inter_ap
.inter_ap_metric
) &
491 sum_line
+= strlen(sum_line
);
493 if (flags
& F_DTAIL
) {
494 snprintf(get_line(0, 0), get_line_remain(),
496 ntohl(lsa
->lsa_un
.un_inter_ap
.inter_ap_metric
) &
499 lpfx
= lsa
->lsa_un
.un_inter_ap
.inter_ap_prefix
;
500 if (lpfx
> (struct lsa6_prefix
*)ls_end
)
502 while (lpfx
+ sizeof (*lpfx
) <= (struct lsa6_prefix
*)ls_end
) {
503 k
= ospf6_print_lsaprefix(flags
, lpfx
);
504 lpfx
= (struct lsa6_prefix
*)(((uchar_t
*)lpfx
) + k
);
505 if (lpfx
> (struct lsa6_prefix
*)ls_end
)
510 llsa
= &lsa
->lsa_un
.un_llsa
;
511 if (TRUNC(llsa
->llsa_options
))
513 ospf_print_bits(ospf6_option_bits
, ntohl(llsa
->llsa_options
));
514 if (TRUNC(llsa
->llsa_nprefix
))
516 (void) inet_ntop(AF_INET6
, &llsa
->llsa_lladdr
,
517 addrstr
, INET6_ADDRSTRLEN
);
519 sprintf(sum_line
, " pri %d lladdr %s npref %d",
520 ntohl(llsa
->llsa_priority
), addrstr
,
521 ntohl(llsa
->llsa_nprefix
));
522 sum_line
+= strlen(sum_line
);
524 if (flags
& F_DTAIL
) {
525 snprintf(get_line(0, 0), get_line_remain(),
526 "Priority %d", ntohl(llsa
->llsa_priority
));
527 snprintf(get_line(0, 0), get_line_remain(),
528 "Link Local addr %d", addrstr
);
529 snprintf(get_line(0, 0), get_line_remain(),
530 "npref %d", ntohl(llsa
->llsa_nprefix
));
532 lpfx
= llsa
->llsa_prefix
;
533 for (j
= 0; j
< ntohl(llsa
->llsa_nprefix
); j
++) {
536 k
= ospf6_print_lsaprefix(flags
, lpfx
);
537 lpfx
= (struct lsa6_prefix
*)(((uchar_t
*)lpfx
) + k
);
541 case LS_TYPE_INTRA_AP
| LS6_SCOPE_AREA
:
542 if (TRUNC(&lsa
->lsa_un
.un_intra_ap
.intra_ap_rtid
))
544 ospf6_print_ls_type(flags
,
545 ntohs(lsa
->lsa_un
.un_intra_ap
.intra_ap_lstype
),
546 lsa
->lsa_un
.un_intra_ap
.intra_ap_lsid
,
547 lsa
->lsa_un
.un_intra_ap
.intra_ap_rtid
);
548 if (TRUNC(&lsa
->lsa_un
.un_intra_ap
.intra_ap_nprefix
))
551 sprintf(sum_line
, " npref %d",
552 ntohs(lsa
->lsa_un
.un_intra_ap
.intra_ap_nprefix
));
553 sum_line
+= strlen(sum_line
);
555 if (flags
& F_DTAIL
) {
556 snprintf(get_line(0, 0), get_line_remain(), "NPref %d",
557 ntohs(lsa
->lsa_un
.un_intra_ap
.intra_ap_nprefix
));
560 lpfx
= lsa
->lsa_un
.un_intra_ap
.intra_ap_prefix
;
562 j
< ntohs(lsa
->lsa_un
.un_intra_ap
.intra_ap_nprefix
); j
++) {
565 k
= ospf6_print_lsaprefix(flags
, lpfx
);
566 lpfx
= (struct lsa6_prefix
*)(((uchar_t
*)lpfx
) + k
);
572 sprintf(sum_line
, " Unknown LSA type (%d)",
573 lsa
->ls6_hdr
.ls6_type
);
574 sum_line
+= strlen(sum_line
);
576 if (flags
& F_DTAIL
) {
577 snprintf(get_line(0, 0), get_line_remain(),
578 " Unknown LSA type %d", lsa
->ls6_hdr
.ls6_type
);
587 interpret_ospf6(int flags
, struct ospf6hdr
*ospf
, int iplen
, int fraglen
)
589 boolean_t trunc
= B_FALSE
;
590 struct lsa6_hdr
*lsah
;
595 if ((fraglen
< OSPF6_MIN_HEADER_SIZE
) ||
596 (fraglen
< ntohs(ospf
->ospf6_len
)))
597 return (fraglen
); /* incomplete header */
599 if (ospf
->ospf6_version
!= 3) {
600 if (ospf
->ospf6_version
== 2) {
602 snprintf(get_line(0, 0), get_line_remain(),
603 "ospfv2 packet in ipv6 header");
604 return (interpret_ospf(flags
, ospf
, iplen
, fraglen
));
610 if (fraglen
> ntohs(ospf
->ospf6_len
))
611 fraglen
= ntohs(ospf
->ospf6_len
);
613 if (ospf
->ospf6_type
> OSPF_TYPE_MAX
) {
615 (void) sprintf(sum_line
, "Unknown OSPF TYPE %d \n",
617 sum_line
+= strlen(sum_line
);
620 show_header("OSPFv3: ", "OSPFv3 Header", fraglen
);
622 (void) snprintf(get_line(0, 0), get_line_remain(),
623 "Unknown OSPF Type = %d", ospf
->ospf6_type
);
629 sum_line
= (char *)get_sum_line();
630 (void) sprintf(sum_line
, "OSPFv3 %s RTRID=%s ",
631 ospf_types
[ospf
->ospf6_type
],
632 print_ipaddr(ospf
->ospf6_routerid
));
633 sum_line
+= strlen(sum_line
);
634 (void) sprintf(sum_line
, "AREA=%s LEN=%d instance %u ",
635 print_ipaddr(ospf
->ospf6_areaid
),
636 ntohs((ushort_t
)ospf
->ospf6_len
), ospf
->ospf6_instanceid
);
637 sum_line
+= strlen(sum_line
);
640 if (flags
& F_DTAIL
) {
641 show_header("OSPFv3: ", "OSPF Header", fraglen
);
643 (void) snprintf(get_line(0, 0), get_line_remain(),
644 "Version = %d", ospf
->ospf6_version
);
645 (void) snprintf(get_line(0, 0), get_line_remain(),
646 "Type = %s", ospf_types
[ospf
->ospf6_type
]);
647 (void) snprintf(get_line(0, 0), get_line_remain(),
648 "Router ID = %s", print_ipaddr(ospf
->ospf6_routerid
));
649 (void) snprintf(get_line(0, 0), get_line_remain(),
650 "Area ID = %s", print_ipaddr(ospf
->ospf6_areaid
));
651 (void) snprintf(get_line(0, 0), get_line_remain(),
652 "Checksum = 0x%x", ospf
->ospf6_chksum
);
653 (void) snprintf(get_line(0, 0), get_line_remain(),
654 "Instance = %u", ospf
->ospf6_instanceid
);
657 switch (ospf
->ospf6_type
) {
658 case OSPF_TYPE_HELLO
:
659 if (interpret_ospf6_hello(flags
, ospf
, fraglen
) < 0)
664 if (fraglen
< OSPF6_MIN_HEADER_SIZE
+
665 OSPF6_MIN_DB_HEADER_SIZE
) {
670 sprintf(sum_line
, " %s %s mtu %u S %X", ospf_print_bits(
672 ntohl(ospf
->ospf6_db
.db_options
)),
673 ospf_print_bits(ospf_db_flags_bits
,
674 ospf
->ospf6_db
.db_flags
),
675 ntohs(ospf
->ospf6_db
.db_mtu
),
676 ntohl(ospf
->ospf6_db
.db_seq
));
677 sum_line
+= strlen(sum_line
);
679 if (flags
& F_DTAIL
) {
680 show_header("OSPF DB: ", "Database Description Packet",
683 snprintf(get_line(0, 0), get_line_remain(),
684 "Options = %s", ospf_print_bits(
685 ospf6_option_bits
, ospf
->ospf6_db
.db_options
));
686 snprintf(get_line(0, 0), get_line_remain(),
687 "Flags = %s", ospf_print_bits(
688 ospf_db_flags_bits
, ospf
->ospf6_db
.db_flags
));
689 snprintf(get_line(0, 0), get_line_remain(),
690 "MTU = %u", ntohl(ospf
->ospf6_db
.db_seq
));
691 snprintf(get_line(0, 0), get_line_remain(),
692 "Sequence = 0x%X", ntohl(ospf
->ospf6_db
.db_seq
));
693 /* Print all the LS advs */
694 lsah
= ospf
->ospf6_db
.db_lshdr
;
695 while ((uchar_t
*)lsah
< ((uchar_t
*)ospf
+ fraglen
)) {
696 if ((uchar_t
*)lsah
+ sizeof (struct lsa6_hdr
) >
697 ((uchar_t
*)ospf
+ fraglen
)) {
701 interpret_ospf6_lsa_hdr(flags
, lsah
);
708 if (fraglen
< OSPF6_MIN_HEADER_SIZE
+
709 OSPF_MIN_LSR_HEADER_SIZE
) {
713 if (flags
& F_DTAIL
) {
714 show_header("OSPF LSR: ", "Link State Request Packet",
718 lsr
= ospf
->ospf6_lsr
;
720 while ((uchar_t
*)lsr
< ((uchar_t
*)ospf
+ fraglen
)) {
721 if ((uchar_t
*)lsr
+ sizeof (struct lsr6
) >
722 ((uchar_t
*)ospf
+ fraglen
)) {
727 if (flags
& F_DTAIL
) {
728 ospf6_print_ls_type(flags
, ntohl(lsr
->ls_type
),
729 lsr
->ls_stateid
, lsr
->ls_router
);
734 sprintf(sum_line
, "%d LSAs", nlsah
);
735 sum_line
+= strlen(sum_line
);
740 if (fraglen
< OSPF6_MIN_HEADER_SIZE
+
741 OSPF_MIN_LSU_HEADER_SIZE
) {
745 if (flags
& F_DTAIL
) {
746 show_header("OSPF LSU: ", "Link State Update Packet",
750 lsa
= ospf
->ospf6_lsu
.lsu_lsa
;
751 nlsa
= ntohl(ospf
->ospf6_lsu
.lsu_count
);
753 sprintf(sum_line
, "%d LSAs", nlsa
);
754 sum_line
+= strlen(sum_line
);
757 while (nlsa
-- != 0) {
758 uchar_t
*fragend
= (uchar_t
*)ospf
+ fraglen
;
759 if (((uchar_t
*)lsa
>= fragend
) ||
760 ((uchar_t
*)lsa
+ sizeof (struct lsa_hdr
) >
762 ((uchar_t
*)lsa
+ ntohs(lsa
->ls6_hdr
.ls6_length
) >
768 if (interpret_ospf6_lsa(flags
, lsa
, fragend
) < 0) {
772 lsa
= (struct lsa6
*)((uchar_t
*)lsa
+
773 ntohs(lsa
->ls6_hdr
.ls6_length
));
778 if (flags
& F_DTAIL
) {
779 show_header("OSPF LSA: ", "Link State Ack Packet",
783 lsah
= ospf
->ospf6_lsa
.lsa_lshdr
;
785 while ((uchar_t
*)lsah
< ((uchar_t
*)ospf
+ fraglen
)) {
786 if ((uchar_t
*)lsah
+ sizeof (struct lsa6_hdr
) >
787 ((uchar_t
*)ospf
+ fraglen
)) {
793 interpret_ospf6_lsa_hdr(flags
, lsah
);
797 sprintf(sum_line
, "%d LSAs", nlsah
);
798 sum_line
+= strlen(sum_line
);
808 sprintf(sum_line
, "--truncated");
810 snprintf(get_line(0, 0), get_line_remain(),