1
10
13
14
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
106
107
108
112
113
114
118
119
120
121
122
123
124
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
164
171
172
173
174
175
176
177
181
182
183
184
185
186
187
188
189
193
194
205
206
207
208
209
210
211
212
213
214
215
216
217
218
220
221
222
233
234
240
241
242
243
250
251
252
253
266
267
268
269
270
271
272
273
274
275
276
277
278
282
283
284
288
289
290
294
295
296
297
298
299
300
301
302
306
307
311
318
319
320
321
322
323
324
325
326
327
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ipv6.h"
#ifdef FEATURE_NX_IPV6...
...
UINT _nxd_ipv6_interface_find(NX_IP *ip_ptr, ULONG *dest_address,
NXD_IPV6_ADDRESS **ipv6_addr, NX_INTERFACE *if_ptr)
{
UINT i;
NXD_IPV6_ADDRESS *ipv6_address;
NX_IPV6_DEFAULT_ROUTER_ENTRY *rt_entry;
UINT start_index;
UINT end_index;
ULONG address_type = IPv6_Address_Type(dest_address);
NX_ASSERT(ipv6_addr != NX_NULL);
#ifdef NX_ENABLE_IPV6_MULTICAST
if (address_type & IPV6_ADDRESS_MULTICAST)
{
for (i = 0; i < NX_MAX_MULTICAST_GROUPS; i++)
{
if (ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_interface_list == NX_NULL)
{
continue;
}if (ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_interface_list == NX_NULL) { ... }
if (if_ptr && (ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_interface_list != if_ptr))
{
continue;
}if (if_ptr && (ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_interface_list != if_ptr)) { ... }
if (ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_interface_list -> nx_interface_link_up == NX_FALSE)
{
continue;
}if (ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_interface_list -> nx_interface_link_up == NX_FALSE) { ... }
if (CHECK_IPV6_ADDRESSES_SAME(ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_list, dest_address))
{
*ipv6_addr = ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_interface_list -> nxd_interface_ipv6_address_list_head;
if (*ipv6_addr == NX_NULL)
{
return(NX_NO_INTERFACE_ADDRESS);
}if (*ipv6_addr == NX_NULL) { ... }
NX_ASSERT((*ipv6_addr) -> nxd_ipv6_address_valid);
return(NX_SUCCESS);
}if (CHECK_IPV6_ADDRESSES_SAME(ip_ptr -> nx_ipv6_multicast_entry[i].nx_ip_mld_join_list, dest_address)) { ... }
}for (i = 0; i < NX_MAX_MULTICAST_GROUPS; i++) { ... }
}if (address_type & IPV6_ADDRESS_MULTICAST) { ... }
/* ... */#endif
if (address_type & IPV6_ADDRESS_UNICAST)
{
for (i = 0; i < NX_MAX_IPV6_ADDRESSES; i++)
{
if ((ip_ptr -> nx_ipv6_address[i].nxd_ipv6_address_valid) &&
(CHECK_IPV6_ADDRESSES_SAME(ip_ptr -> nx_ipv6_address[i].nxd_ipv6_address, dest_address)))
{
*ipv6_addr = &(ip_ptr -> nx_ipv6_address[i]);
return(NX_SUCCESS);
}if ((ip_ptr -> nx_ipv6_address[i].nxd_ipv6_address_valid) && (CHECK_IPV6_ADDRESSES_SAME(ip_ptr -> nx_ipv6_address[i].nxd_ipv6_address, dest_address))) { ... }
}for (i = 0; i < NX_MAX_IPV6_ADDRESSES; i++) { ... }
}if (address_type & IPV6_ADDRESS_UNICAST) { ... }
if (if_ptr)
{
start_index = if_ptr -> nx_interface_index;
end_index = (UINT)(if_ptr -> nx_interface_index + 1);
}if (if_ptr) { ... }
else
{
start_index = 0;
end_index = NX_MAX_PHYSICAL_INTERFACES;
}else { ... }
for (i = start_index; i < end_index; i++)
{
if (ip_ptr -> nx_ip_interface[i].nx_interface_link_up == NX_FALSE)
{
continue;
}if (ip_ptr -> nx_ip_interface[i].nx_interface_link_up == NX_FALSE) { ... }
for (ipv6_address = ip_ptr -> nx_ip_interface[i].nxd_interface_ipv6_address_list_head;
ipv6_address;
ipv6_address = ipv6_address -> nxd_ipv6_address_next)
{
if (ipv6_address -> nxd_ipv6_address_state != NX_IPV6_ADDR_STATE_VALID)
{
continue;
}if (ipv6_address -> nxd_ipv6_address_state != NX_IPV6_ADDR_STATE_VALID) { ... }
if (address_type & IPV6_ADDRESS_LINKLOCAL)
{
if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_LINKLOCAL)
{
break;
}if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_LINKLOCAL) { ... }
}if (address_type & IPV6_ADDRESS_LINKLOCAL) { ... }
else if (_nxd_ipv6_find_max_prefix_length(dest_address, ipv6_address -> nxd_ipv6_address,
ipv6_address -> nxd_ipv6_address_prefix_length) >=
ipv6_address -> nxd_ipv6_address_prefix_length)
{
break;
}else if (_nxd_ipv6_find_max_prefix_length(dest_address, ipv6_address -> nxd_ipv6_address, ipv6_address -> nxd_ipv6_address_prefix_length) >= ipv6_address -> nxd_ipv6_address_prefix_length) { ... }
else if (address_type & IPV6_ADDRESS_MULTICAST)
{
/* ... */
if ((dest_address[0] & 0x000F0000) == 0x00020000)
{
if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_LINKLOCAL)
{
break;
}if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_LINKLOCAL) { ... }
}if ((dest_address[0] & 0x000F0000) == 0x00020000) { ... }
else if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_GLOBAL)
{
break;
}else if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_GLOBAL) { ... }
}else if (address_type & IPV6_ADDRESS_MULTICAST) { ... }
}for (ipv6_address = ip_ptr -> nx_ip_interface[i].nxd_interface_ipv6_address_list_head; ipv6_address; ipv6_address = ipv6_address -> nxd_ipv6_address_next) { ... }
if (ipv6_address)
{
*ipv6_addr = ipv6_address;
return(NX_SUCCESS);
}if (ipv6_address) { ... }
}for (i = start_index; i < end_index; i++) { ... }
#ifndef NX_DISABLE_LOOPBACK_INTERFACE
ipv6_address = ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nxd_interface_ipv6_address_list_head;
if (ipv6_address)
{
if (CHECK_IPV6_ADDRESSES_SAME(ipv6_address -> nxd_ipv6_address, dest_address))
{
*ipv6_addr = ipv6_address;
return(NX_SUCCESS);
}if (CHECK_IPV6_ADDRESSES_SAME(ipv6_address -> nxd_ipv6_address, dest_address)) { ... }
}if (ipv6_address) { ... }
/* ... */#endif
if (address_type & IPV6_ADDRESS_GLOBAL)
{
for (i = 0; i < NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE; i++)
{
rt_entry = &ip_ptr -> nx_ipv6_default_router_table[i];
if (rt_entry -> nx_ipv6_default_router_entry_flag == 0)
{
continue;
}if (rt_entry -> nx_ipv6_default_router_entry_flag == 0) { ... }
if (rt_entry -> nx_ipv6_default_router_entry_interface_ptr -> nx_interface_link_up == NX_FALSE)
{
continue;
}if (rt_entry -> nx_ipv6_default_router_entry_interface_ptr -> nx_interface_link_up == NX_FALSE) { ... }
if (if_ptr && (rt_entry -> nx_ipv6_default_router_entry_interface_ptr != if_ptr))
{
continue;
}if (if_ptr && (rt_entry -> nx_ipv6_default_router_entry_interface_ptr != if_ptr)) { ... }
ipv6_address = rt_entry -> nx_ipv6_default_router_entry_interface_ptr -> nxd_interface_ipv6_address_list_head;
while (ipv6_address)
{
if (ipv6_address -> nxd_ipv6_address_state != NX_IPV6_ADDR_STATE_VALID)
{
ipv6_address = ipv6_address -> nxd_ipv6_address_next;
}if (ipv6_address -> nxd_ipv6_address_state != NX_IPV6_ADDR_STATE_VALID) { ... }
else if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_LINKLOCAL)
{
ipv6_address = ipv6_address -> nxd_ipv6_address_next;
}else if (IPv6_Address_Type(ipv6_address -> nxd_ipv6_address) & IPV6_ADDRESS_LINKLOCAL) { ... }
else
{
*ipv6_addr = ipv6_address;
return(NX_SUCCESS);
}else { ... }
}while (ipv6_address) { ... }
}for (i = 0; i < NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE; i++) { ... }
}if (address_type & IPV6_ADDRESS_GLOBAL) { ... }
return(NX_NO_INTERFACE_ADDRESS);
}_nxd_ipv6_interface_find (NX_IP *ip_ptr, ULONG *dest_address, NXD_IPV6_ADDRESS **ipv6_addr, NX_INTERFACE *if_ptr) { ... }
/* ... */
#endif