]>
The Tcpdump Group git mirrors - tcpdump/blob - print-rt6.c
2 * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 static const char rcsid
[] =
24 "@(#) /master/usr.sbin/tcpdump/tcpdump/print-icmp.c,v 2.1 1995/02/03 18:14:42 polk Exp (LBL)";
29 #include <sys/param.h>
31 #include <sys/types.h>
32 #include <sys/socket.h>
36 #include <netinet/in.h>
37 #include <netinet/if_ether.h>
38 #include <netinet/in_systm.h>
39 #include <netinet/ip.h>
40 #include <netinet/ip_icmp.h>
41 #include <netinet/ip_var.h>
42 #include <netinet/udp.h>
43 #include <netinet/udp_var.h>
44 #include <netinet/tcp.h>
48 #include <netinet/ip6.h>
50 #include "interface.h"
51 #include "addrtoname.h"
54 rt6_print(register const u_char
*bp
, register const u_char
*bp2
)
56 register const struct ip6_rthdr0
*dp
;
57 register const struct ip6_hdr
*ip
;
58 register const u_char
*ep
;
59 u_long bitmap
= 0x0800;
64 #define TCHECK(var) if ((u_char *)&(var) >= ep - sizeof(var)) goto trunc
67 dp
= (struct ip6_rthdr0
*)bp
;
68 ip
= (struct ip6_hdr
*)bp2
;
71 /* 'ep' points to the end of avaible data. */
75 ip6addr_string(&ip
->ip6_src
),
76 ip6addr_string(&ip
->ip6_dst
));
78 TCHECK(dp
->ip6r0_slmap
[2]);
79 printf("srcrt (len=%d, ", dp
->ip6r0_len
);
80 printf("type=%d, ", dp
->ip6r0_type
);
81 printf("segleft=%d, ", dp
->ip6r0_segleft
);
82 if (dp
->ip6r0_type
!= 0)
84 slmap
= (dp
->ip6r0_slmap
[0] << 16)
85 | (dp
->ip6r0_slmap
[1] << 8)
86 | (dp
->ip6r0_slmap
[2]);
88 for (i
= 24; i
> 0; i
--) {
99 for (i
= 0; i
< len
; i
++) {
100 if ((((u_char
*)&(dp
->ip6r0_reserved
)) + sizeof(u_long
)
101 + (i
<<4)) > ep
) goto trunc
;
103 ip6addr_string(((u_char
*)&(dp
->ip6r0_reserved
)) +
104 sizeof(u_long
) + (i
<<4)));
110 return((dp
->ip6r0_len
+ 1) << 3);
112 fputs("[|srcrt]", stdout
);