1
10
13
14
20
21
22
23
24
25
26
27
28
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
128
129
130
131
132
133
134
135
138
139
140
141
142
143
144
145
146
148
149
150
151
152
153
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
238
239
240
241
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
265
266
267
268
269
270
271
272
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "tx_thread.h"
#include "nx_packet.h"
#include "nx_ipv6.h"
#include "nx_icmpv6.h"
5 includes
#ifdef NX_IPSEC_ENABLE
#include "nx_ipsec.h"
#endif
#ifdef FEATURE_NX_IPV6
...
VOID _nx_icmpv6_process_echo_reply(NX_IP *ip_ptr, NX_PACKET *packet_ptr)
{
TX_INTERRUPT_SAVE_AREA
NX_IPV6_HEADER *ipv6_header;
USHORT sequence_num;
ULONG suspended;
TX_THREAD *thread_ptr;
NX_ICMPV6_ECHO *echo_ptr;
NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr);
#ifndef NX_DISABLE_RX_SIZE_CHECKING
if (packet_ptr -> nx_packet_length < sizeof(NX_ICMPV6_ECHO))
{
#ifndef NX_DISABLE_ICMP_INFO
ip_ptr -> nx_ip_icmp_invalid_packets++;/* ... */
#endif
_nx_packet_release(packet_ptr);
return;
}if (packet_ptr -> nx_packet_length < sizeof(NX_ICMPV6_ECHO)) { ... }
/* ... */#endif
ipv6_header = (NX_IPV6_HEADER *)packet_ptr -> nx_packet_ip_header;
echo_ptr = (NX_ICMPV6_ECHO *)packet_ptr -> nx_packet_prepend_ptr;
#ifndef NX_DISABLE_ICMP_INFO
ip_ptr -> nx_ip_ping_responses_received++;/* ... */
#endif
if (CHECK_UNSPECIFIED_ADDRESS(ipv6_header -> nx_ip_header_source_ip))
{
#ifndef NX_DISABLE_ICMP_INFO
ip_ptr -> nx_ip_icmp_invalid_packets++;/* ... */
#endif
_nx_packet_release(packet_ptr);
return;
}if (CHECK_UNSPECIFIED_ADDRESS(ipv6_header -> nx_ip_header_source_ip)) { ... }
/* ... */
if (packet_ptr -> nx_packet_address.nx_packet_ipv6_address_ptr -> nxd_ipv6_address_state != NX_IPV6_ADDR_STATE_VALID)
{
#ifndef NX_DISABLE_ICMP_INFO
ip_ptr -> nx_ip_icmp_invalid_packets++;/* ... */
#endif
_nx_packet_release(packet_ptr);
return;
}if (packet_ptr -> nx_packet_address.nx_packet_ipv6_address_ptr -> nxd_ipv6_address_state != NX_IPV6_ADDR_STATE_VALID) { ... }
sequence_num = echo_ptr -> nx_icmpv6_echo_sequence_num;
NX_CHANGE_USHORT_ENDIAN(sequence_num);
TX_DISABLE
thread_ptr = ip_ptr -> nx_ip_icmp_ping_suspension_list;
suspended = ip_ptr -> nx_ip_icmp_ping_suspended_count;
_tx_thread_preempt_disable++;
TX_RESTORE
/* ... */
while (suspended--)
{
if (thread_ptr -> tx_thread_suspend_info == sequence_num)
{
TX_DISABLE
if (thread_ptr == thread_ptr -> tx_thread_suspended_next)
{
ip_ptr -> nx_ip_icmp_ping_suspension_list = NX_NULL;
}if (thread_ptr == thread_ptr -> tx_thread_suspended_next) { ... }
else
{
if (ip_ptr -> nx_ip_icmp_ping_suspension_list == thread_ptr)
{
ip_ptr -> nx_ip_icmp_ping_suspension_list = thread_ptr -> tx_thread_suspended_next;
}if (ip_ptr -> nx_ip_icmp_ping_suspension_list == thread_ptr) { ... }
(thread_ptr -> tx_thread_suspended_next) -> tx_thread_suspended_previous =
thread_ptr -> tx_thread_suspended_previous;
(thread_ptr -> tx_thread_suspended_previous) -> tx_thread_suspended_next =
thread_ptr -> tx_thread_suspended_next;
}else { ... }
ip_ptr -> nx_ip_icmp_ping_suspended_count--;
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
_tx_thread_preempt_disable++;
TX_RESTORE
/* ... */
packet_ptr -> nx_packet_length = packet_ptr -> nx_packet_length - (ULONG)sizeof(NX_ICMPV6_ECHO);
packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_prepend_ptr + sizeof(NX_ICMPV6_ECHO);
/* ... */
*((NX_PACKET **)thread_ptr -> tx_thread_additional_suspend_info) = packet_ptr;
NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr);
packet_ptr = NX_NULL;
thread_ptr -> tx_thread_suspend_status = NX_SUCCESS;
_tx_thread_system_resume(thread_ptr);
break;
}if (thread_ptr -> tx_thread_suspend_info == sequence_num) { ... }
else
{
thread_ptr = thread_ptr -> tx_thread_suspended_next;
}else { ... }
}while (suspended--) { ... }
if (packet_ptr)
{
#ifndef NX_DISABLE_ICMP_INFO
ip_ptr -> nx_ip_icmp_invalid_packets++;/* ... */
#endif
_nx_packet_release(packet_ptr);
}if (packet_ptr) { ... }
TX_DISABLE
_tx_thread_preempt_disable--;
TX_RESTORE
_tx_thread_system_preempt_check();
}_nx_icmpv6_process_echo_reply (NX_IP *ip_ptr, NX_PACKET *packet_ptr) { ... }
/* ... */
#endif