1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
204
205
206
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ipv6.h"
#ifdef FEATURE_NX_IPV6
#include "nx_ip.h"
#include "nx_nd_cache.h"
#include "nx_icmpv6.h"
/* ... */#endif
...
...
UINT _nxd_ipv6_enable(NX_IP *ip_ptr)
{
#ifdef FEATURE_NX_IPV6
TX_INTERRUPT_SAVE_AREA
UINT i;
#ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION
ULONG address[4];
#endif
if (ip_ptr -> nx_ipv6_packet_receive)
{
return(NX_ALREADY_ENABLED);
}if (ip_ptr -> nx_ipv6_packet_receive) { ... }
NX_TRACE_IN_LINE_INSERT(NX_TRACE_IPV6_ENABLE, ip_ptr, 0, 0, 0, NX_TRACE_IP_EVENTS, 0, 0);
tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
TX_DISABLE
ip_ptr -> nx_ipv6_packet_receive = _nx_ipv6_packet_receive;
TX_RESTORE
_nxd_ipv6_default_router_table_init(ip_ptr);
ip_ptr -> nx_ipv6_reachable_timer = NX_REACHABLE_TIME;
/* ... */
#if ((NX_RETRANS_TIMER * NX_IP_FAST_TIMER_RATE) > 1000)
ip_ptr -> nx_ipv6_retrans_timer_ticks = (NX_RETRANS_TIMER * NX_IP_FAST_TIMER_RATE) / 1000;
#else
ip_ptr -> nx_ipv6_retrans_timer_ticks = 1;
#endif
ip_ptr -> nx_ipv6_hop_limit = 0xFF;
for (i = 0; i < (NX_MAX_IPV6_ADDRESSES + NX_LOOPBACK_IPV6_ENABLED); i++)
{
ip_ptr -> nx_ipv6_address[i].nxd_ipv6_address_index = (UCHAR)i;
}for (i = 0; i < (NX_MAX_IPV6_ADDRESSES + NX_LOOPBACK_IPV6_ENABLED); i++) { ... }
#ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION
address[0] = 0xFF020000;
address[1] = 0;
address[2] = 0;
address[3] = 1;
for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++)
{
if (ip_ptr -> nx_ip_interface[i].nx_interface_valid == NX_TRUE)
{
ip_ptr -> nx_ip_interface[i].nx_ipv6_rtr_solicitation_max = NX_ICMPV6_MAX_RTR_SOLICITATIONS;
ip_ptr -> nx_ip_interface[i].nx_ipv6_rtr_solicitation_count = ip_ptr -> nx_ip_interface[i].nx_ipv6_rtr_solicitation_max;
ip_ptr -> nx_ip_interface[i].nx_ipv6_rtr_solicitation_interval = NX_ICMPV6_RTR_SOLICITATION_INTERVAL;
ip_ptr -> nx_ip_interface[i].nx_ipv6_rtr_solicitation_timer = NX_ICMPV6_RTR_SOLICITATION_DELAY;
_nx_ipv6_multicast_join(ip_ptr, address, &ip_ptr -> nx_ip_interface[i]);
}if (ip_ptr -> nx_ip_interface[i].nx_interface_valid == NX_TRUE) { ... }
}for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++) { ... }
/* ... */#endif
_nx_ip_fast_periodic_timer_create(ip_ptr);
#ifndef NX_DISABLE_LOOPBACK_INTERFACE
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address[0] = 0x0;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address[1] = 0x0;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address[2] = 0x0;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address[3] = 0x1;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address_valid = NX_TRUE;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address_type = NX_IP_VERSION_V6;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address_prefix_length = 128;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address_next = NX_NULL;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address_attached = &ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE];
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address_ConfigurationMethod = NX_IPV6_ADDRESS_MANUAL_CONFIG;
ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX].nxd_ipv6_address_state = NX_IPV6_ADDR_STATE_VALID;
ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nxd_interface_ipv6_address_list_head = &ip_ptr -> nx_ipv6_address[NX_LOOPBACK_IPV6_SOURCE_INDEX];/* ... */
#endif
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
return(NX_SUCCESS);
/* ... */
#else
NX_PARAMETER_NOT_USED(ip_ptr);
return(NX_NOT_SUPPORTED);
/* ... */
#endif
}{ ... }