-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipv6.h
More file actions
166 lines (136 loc) · 4.12 KB
/
ipv6.h
File metadata and controls
166 lines (136 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
* Linux INET6 implementation
*
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
* $Id: ipv6.h,v 1.6 1997/04/01 02:22:58 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _NET_IPV6_H
#define _NET_IPV6_H
#ifndef __NETINET_IN_H
#include <netinet/in.h> /* in6_addr */
#endif
/*
* Advanced API
* source interface/address selection, source routing, etc...
* *under construction*
*/
#include <sys/packon.h>
/*
* IPv6 fixed header
*/
struct ipv6hdr {
unsigned char ipv6_priority:4;
unsigned char ipv6_version:4;
unsigned char ipv6_flow_lbl[3];
unsigned short ipv6_len;
unsigned char ipv6_nextheader;
unsigned char ipv6_hoplimit;
struct in6_addr ipv6_src;
struct in6_addr ipv6_dst;
};
/*
* The length of this struct cannot be greater than the length of
* the proto_priv field in a sk_buff which is currently
* defined to be 16 bytes.
* Pointers take upto 8 bytes (sizeof(void *) is 8 on the alpha).
*/
struct ipv6_options {
/* length of extension headers */
unsigned short opt_flen; /* after fragment hdr */
unsigned short opt_nflen; /* before fragment hdr */
/*
* protocol options
* usualy carried in IPv6 extension headers
*/
struct ipv6_rt_hdr *srcrt; /* Routing Header */
};
struct in6_pktinfo {
struct in6_addr ipi6_addr;
int ipi6_ifindex;
};
struct in6_ifreq {
struct in6_addr ifr6_addr;
unsigned long ifr6_prefixlen;
unsigned long ifr6_ifindex;
};
#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */
#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
/*
* routing header
*/
struct ipv6_rt_hdr {
unsigned char nexthdr;
unsigned char hdrlen;
unsigned char type;
unsigned char segments_left;
/*
* type specific data
* variable length field
*/
};
/*
* routing header type 0 (used in cmsghdr struct)
*/
struct ipv6_rt0_hdr {
struct ipv6_rt_hdr rt_hdr;
unsigned long bitmap; /* strict/loose bit map */
struct in6_addr addr[0];
#define rt0_type rt_hdr.type;
};
/*
* NextHeader field of IPv6 header
*/
#define NEXTHDR_HOP 0 /* Hop-by-hop option header. */
#define NEXTHDR_TCP 6 /* TCP segment. */
#define NEXTHDR_UDP 17 /* UDP message. */
#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */
#define NEXTHDR_ROUTING 43 /* Routing header. */
#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
#define NEXTHDR_ESP 50 /* Encapsulating security payload. */
#define NEXTHDR_AUTH 51 /* Authentication header. */
#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
#define NEXTHDR_NONE 59 /* No next header */
#define NEXTHDR_DEST 60 /* Destination options header. */
#define NEXTHDR_MAX 255
#define IPV6_DEFAULT_HOPLIMIT 64
#define IPV6_DEFAULT_MCASTHOPS 1
/*
* Addr type
*
* type - unicast | multicast | anycast
* scope - local | site | global
* v4 - compat
* v4mapped
* any
* loopback
*/
#define IPV6_ADDR_ANY 0x0000U
#define IPV6_ADDR_UNICAST 0x0001U
#define IPV6_ADDR_MULTICAST 0x0002U
#define IPV6_ADDR_ANYCAST 0x0004U
#define IPV6_ADDR_LOOPBACK 0x0010U
#define IPV6_ADDR_LINKLOCAL 0x0020U
#define IPV6_ADDR_SITELOCAL 0x0040U
#define IPV6_ADDR_COMPATv4 0x0080U
#define IPV6_ADDR_SCOPE_MASK 0x00f0U
#define IPV6_ADDR_MAPPED 0x1000U
#define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */
/*
* fragmentation header
*/
struct ipv6_fraghdr {
unsigned char nexthdr;
unsigned char reserved;
unsigned short frag_off;
unsigned long identification;
};
#define fraghdr ipv6_fraghdr
#include <sys/packoff.h>
#endif