1 /*
2 * inet6 interface/address list definitions
3 * Linux INET6 implementation
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15 #ifndef _NET_IF_INET6_H
16 #define _NET_IF_INET6_H
17
18 #define IF_RA_RCVD 0x20
19 #define IF_RS_SENT 0x10
20
21 #ifdef __KERNEL__
22
23 struct inet6_ifaddr
24 {
25 struct in6_addr addr;
26 __u32 prefix_len;
27
28 __u32 valid_lft;
29 __u32 prefered_lft;
30 unsigned long tstamp;
31 atomic_t refcnt;
32 spinlock_t lock;
33
34 __u8 probes;
35 __u8 flags;
36
37 __u16 scope;
38
39 struct timer_list timer;
40
41 struct inet6_dev *idev;
42
43 struct inet6_ifaddr *lst_next; /* next addr in addr_lst */
44 struct inet6_ifaddr *if_next; /* next addr in inet6_dev */
45
46 int dead;
47 };
48
49 struct ipv6_mc_socklist
50 {
51 struct in6_addr addr;
52 int ifindex;
53 struct ipv6_mc_socklist *next;
54 };
55
56 #define MAF_TIMER_RUNNING 0x01
57 #define MAF_LAST_REPORTER 0x02
58 #define MAF_LOADED 0x04
59
60 struct ifmcaddr6
61 {
62 struct in6_addr mca_addr;
63 struct inet6_dev *idev;
64 struct ifmcaddr6 *next;
65 struct timer_list mca_timer;
66 unsigned mca_flags;
67 int mca_users;
68 atomic_t mca_refcnt;
69 spinlock_t mca_lock;
70 };
71
72 #define IFA_HOST IPV6_ADDR_LOOPBACK
73 #define IFA_LINK IPV6_ADDR_LINKLOCAL
74 #define IFA_SITE IPV6_ADDR_SITELOCAL
75 #define IFA_GLOBAL 0x0000U
76
77 struct ipv6_devconf
78 {
79 int forwarding;
80 int hop_limit;
81 int mtu6;
82 int accept_ra;
83 int accept_redirects;
84 int autoconf;
85 int dad_transmits;
86 int rtr_solicits;
87 int rtr_solicit_interval;
88 int rtr_solicit_delay;
89
90 void *sysctl;
91 };
92
93 struct inet6_dev
94 {
95 struct net_device *dev;
96
97 struct inet6_ifaddr *addr_list;
98 struct ifmcaddr6 *mc_list;
99 rwlock_t lock;
100 atomic_t refcnt;
101 __u32 if_flags;
102 int dead;
103
104 struct neigh_parms *nd_parms;
105 struct inet6_dev *next;
106 struct ipv6_devconf cnf;
107 };
108
109 extern struct ipv6_devconf ipv6_devconf;
110
111 static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf)
112 {
113 /*
114 * +-------+-------+-------+-------+-------+-------+
115 * | 33 | 33 | DST13 | DST14 | DST15 | DST16 |
116 * +-------+-------+-------+-------+-------+-------+
117 */
118
119 buf[0]= 0x33;
120 buf[1]= 0x33;
121
122 memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32));
123 }
124
125 static inline void ipv6_tr_mc_map(struct in6_addr *addr, char *buf)
126 {
127 /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */
128
129 if (((addr->s6_addr[0] == 0xFF) &&
130 ((addr->s6_addr[1] == 0x01) || (addr->s6_addr[1] == 0x02)) &&
131 (addr->s6_addr16[1] == 0) &&
132 (addr->s6_addr32[1] == 0) &&
133 (addr->s6_addr32[2] == 0) &&
134 (addr->s6_addr16[6] == 0) &&
135 (addr->s6_addr[15] == 1)) ||
136 ((addr->s6_addr[0] == 0xFF) &&
137 (addr->s6_addr[1] == 0x02) &&
138 (addr->s6_addr16[1] == 0) &&
139 (addr->s6_addr32[1] == 0) &&
140 (addr->s6_addr16[4] == 0) &&
141 (addr->s6_addr[10] == 0) &&
142 (addr->s6_addr[11] == 1) &&
143 (addr->s6_addr[12] == 0xff)))
144 {
145 buf[0]=0xC0;
146 buf[1]=0x00;
147 buf[2]=0x01;
148 buf[3]=0x00;
149 buf[4]=0x00;
150 buf[5]=0x00;
151 /* All routers FF0x::2 */
152 } else if ((addr->s6_addr[0] ==0xff) &&
153 ((addr->s6_addr[1] & 0xF0) == 0) &&
154 (addr->s6_addr16[1] == 0) &&
155 (addr->s6_addr32[1] == 0) &&
156 (addr->s6_addr32[2] == 0) &&
157 (addr->s6_addr16[6] == 0) &&
158 (addr->s6_addr[15] == 2))
159 {
160 buf[0]=0xC0;
161 buf[1]=0x00;
162 buf[2]=0x02;
163 buf[3]=0x00;
164 buf[4]=0x00;
165 buf[5]=0x00;
166 } else {
167 unsigned char i ;
168
169 i = addr->s6_addr[15] & 7 ;
170 buf[0]=0xC0;
171 buf[1]=0x00;
172 buf[2]=0x00;
173 buf[3]=0x01 << i ;
174 buf[4]=0x00;
175 buf[5]=0x00;
176 }
177 }
178 #endif
179 #endif
180
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.