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
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
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
167
168
181
182
183
184
185
186
187
188
189
193
194
201
202
203
204
205
206
207
208
209
215
216
217
218
219
220
221
222
223
224
225
226
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ipv6.h"
#include "nx_icmpv6.h"
#include "nx_packet.h"
#ifdef FEATURE_NX_IPV6
...
VOID _nx_icmpv6_send_queued_packets(NX_IP *ip_ptr, ND_CACHE_ENTRY *nd_entry)
{
NX_IP_DRIVER driver_request;
UCHAR *mac_addr;
NX_PACKET *queued_list_head, *ip_packet_ptr;
UINT next_hop_mtu;
#ifndef NX_DISABLE_FRAGMENTATION
#ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY
NX_IPV6_DESTINATION_ENTRY *dest_entry_ptr;
NX_IPV6_HEADER *ip_header_ptr;
ULONG status;/* ... */
#endif /* ... */
#endif
TX_INTERRUPT_SAVE_AREA
NX_ASSERT(nd_entry != NX_NULL);
NX_ASSERT(nd_entry -> nx_nd_cache_packet_waiting_head != NX_NULL);
queued_list_head = nd_entry -> nx_nd_cache_packet_waiting_head;
mac_addr = nd_entry -> nx_nd_cache_mac_addr;
driver_request.nx_ip_driver_physical_address_msw = ((ULONG)(mac_addr[0]) << 8) | mac_addr[1];
driver_request.nx_ip_driver_physical_address_lsw = ((ULONG)(mac_addr[2]) << 24) | ((ULONG)(mac_addr[3]) << 16) | ((ULONG)(mac_addr[4]) << 8) | mac_addr[5];
driver_request.nx_ip_driver_ptr = ip_ptr;
driver_request.nx_ip_driver_command = NX_LINK_PACKET_SEND;
driver_request.nx_ip_driver_interface = nd_entry -> nx_nd_cache_interface_ptr;
driver_request.nx_ip_driver_status = NX_SUCCESS;
while (queued_list_head)
{
ip_packet_ptr = queued_list_head;
queued_list_head = queued_list_head -> nx_packet_queue_next;
ip_packet_ptr -> nx_packet_queue_next = NX_NULL;
driver_request.nx_ip_driver_packet = ip_packet_ptr;
next_hop_mtu = driver_request.nx_ip_driver_interface -> nx_interface_ip_mtu_size;
#ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY
/* ... */
ip_header_ptr = (NX_IPV6_HEADER *)ip_packet_ptr -> nx_packet_prepend_ptr;
NX_IPV6_ADDRESS_CHANGE_ENDIAN(ip_header_ptr -> nx_ip_header_destination_ip);
status = _nx_icmpv6_dest_table_find(ip_ptr, ip_header_ptr -> nx_ip_header_destination_ip, &dest_entry_ptr, 0, 0);
NX_IPV6_ADDRESS_CHANGE_ENDIAN(ip_header_ptr -> nx_ip_header_destination_ip);
if (status == NX_SUCCESS)
{
ULONG next_hop_address[4];
NX_IPV6_DESTINATION_ENTRY *next_hop_dest_entry_ptr;
next_hop_mtu = dest_entry_ptr -> nx_ipv6_destination_entry_path_mtu;
COPY_IPV6_ADDRESS(dest_entry_ptr -> nx_ipv6_destination_entry_next_hop, next_hop_address);
if (!CHECK_UNSPECIFIED_ADDRESS(&(next_hop_address[0])))
{
status = _nx_icmpv6_dest_table_find(ip_ptr, next_hop_address, &next_hop_dest_entry_ptr, 0, 0);
if (status == NX_SUCCESS)
{
if ((next_hop_dest_entry_ptr -> nx_ipv6_destination_entry_path_mtu > 0) &&
(next_hop_mtu > next_hop_dest_entry_ptr -> nx_ipv6_destination_entry_path_mtu))
{
next_hop_mtu = next_hop_dest_entry_ptr -> nx_ipv6_destination_entry_path_mtu;
}if ((next_hop_dest_entry_ptr -> nx_ipv6_destination_entry_path_mtu > 0) && (next_hop_mtu > next_hop_dest_entry_ptr -> nx_ipv6_destination_entry_path_mtu)) { ... }
}if (status == NX_SUCCESS) { ... }
}if (!CHECK_UNSPECIFIED_ADDRESS(&(next_hop_address[0]))) { ... }
}if (status == NX_SUCCESS) { ... }
/* ... */#endif
if (ip_packet_ptr -> nx_packet_length > next_hop_mtu)
{
#ifndef NX_DISABLE_FRAGMENTATION
_nx_ipv6_fragment_process(&driver_request, next_hop_mtu);
/* ... */
#else
#ifndef NX_DISABLE_IP_INFO
ip_ptr -> nx_ip_send_packets_dropped++;/* ... */
#endif
_nx_packet_transmit_release(ip_packet_ptr);/* ... */
#endif
}if (ip_packet_ptr -> nx_packet_length > next_hop_mtu) { ... }
else
{
#ifndef NX_DISABLE_IP_INFO
ip_ptr -> nx_ip_total_packets_sent++;
ip_ptr -> nx_ip_total_bytes_sent += ip_packet_ptr -> nx_packet_length - (ULONG)sizeof(NX_IPV6_HEADER);/* ... */
#endif
NX_PACKET_DEBUG(__FILE__, __LINE__, ip_packet_ptr);
(ip_packet_ptr -> nx_packet_address.nx_packet_ipv6_address_ptr -> nxd_ipv6_address_attached -> nx_interface_link_driver_entry)(&driver_request);
}else { ... }
}while (queued_list_head) { ... }
TX_DISABLE
/* ... */
if (nd_entry -> nx_nd_cache_nd_status == ND_CACHE_STATE_STALE)
{
nd_entry -> nx_nd_cache_nd_status = ND_CACHE_STATE_DELAY;
nd_entry -> nx_nd_cache_timer_tick = NX_DELAY_FIRST_PROBE_TIME;
}if (nd_entry -> nx_nd_cache_nd_status == ND_CACHE_STATE_STALE) { ... }
TX_RESTORE
nd_entry -> nx_nd_cache_packet_waiting_head = NX_NULL;
nd_entry -> nx_nd_cache_packet_waiting_tail = NX_NULL;
nd_entry -> nx_nd_cache_packet_waiting_queue_length = 0;
}_nx_icmpv6_send_queued_packets (NX_IP *ip_ptr, ND_CACHE_ENTRY *nd_entry) { ... }
/* ... */#endif