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
100
101
102
106
107
108
109
110
111
112
116
117
118
122
123
124
128
129
130
131
132
133
134
135
136
137
138
139
140
142
143
144
145
149
150
152
153
154
155
167
168
169
170
171
172
173
174
178
179
180
181
182
183
184
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ipv6.h"
#include "nx_icmpv6.h"
#ifdef FEATURE_NX_IPV6
...
UINT _nx_icmpv6_validate_neighbor_message(NX_PACKET *packet_ptr)
{
NX_ICMPV6_ND *nd_header_ptr;
NX_IPV6_HEADER *ipv6_header;
NX_ICMPV6_OPTION *option_ptr;
UINT option_length;
UINT option_check;
ULONG source_address_type;
ULONG dest_address_type;
ipv6_header = (NX_IPV6_HEADER *)packet_ptr -> nx_packet_ip_header;
/* ... */
if ((ipv6_header -> nx_ip_header_word_1 & 0xFF) != 0xFF)
{
return(NX_NOT_SUCCESSFUL);
}if ((ipv6_header -> nx_ip_header_word_1 & 0xFF) != 0xFF) { ... }
nd_header_ptr = (NX_ICMPV6_ND *)packet_ptr -> nx_packet_prepend_ptr;
if (nd_header_ptr -> nx_icmpv6_nd_header.nx_icmpv6_header_code != 0)
{
return(NX_NOT_SUCCESSFUL);
}if (nd_header_ptr -> nx_icmpv6_nd_header.nx_icmpv6_header_code != 0) { ... }
if (packet_ptr -> nx_packet_length < 24)
{
return(NX_NOT_SUCCESSFUL);
}if (packet_ptr -> nx_packet_length < 24) { ... }
if ((nd_header_ptr -> nx_icmpv6_nd_targetAddress[0] & (ULONG)0xFF000000) == (ULONG)0xFF000000)
{
return(NX_NOT_SUCCESSFUL);
}if ((nd_header_ptr -> nx_icmpv6_nd_targetAddress[0] & (ULONG)0xFF000000) == (ULONG)0xFF000000) { ... }
dest_address_type = IPv6_Address_Type(ipv6_header -> nx_ip_header_destination_ip);
option_check = 0;
if (nd_header_ptr -> nx_icmpv6_nd_header.nx_icmpv6_header_type == NX_ICMPV6_NEIGHBOR_SOLICITATION_TYPE)
{
source_address_type = IPv6_Address_Type(ipv6_header -> nx_ip_header_source_ip);
/* ... */
if (source_address_type == IPV6_ADDRESS_UNSPECIFIED)
{
if ((dest_address_type & IPV6_SOLICITED_NODE_MCAST) != IPV6_SOLICITED_NODE_MCAST)
{
return(NX_NOT_SUCCESSFUL);
}if ((dest_address_type & IPV6_SOLICITED_NODE_MCAST) != IPV6_SOLICITED_NODE_MCAST) { ... }
/* ... */
option_check = NX_NO_SLLA;
}if (source_address_type == IPV6_ADDRESS_UNSPECIFIED) { ... }
}if (nd_header_ptr -> nx_icmpv6_nd_header.nx_icmpv6_header_type == NX_ICMPV6_NEIGHBOR_SOLICITATION_TYPE) { ... }
else
{
/* ... */
if (((ipv6_header -> nx_ip_header_destination_ip[0] & (ULONG)0xFF000000) == (ULONG)0xFF000000) &&
nd_header_ptr -> nx_icmpv6_nd_flag & 0x40000000)
{
return(NX_NOT_SUCCESSFUL);
}if (((ipv6_header -> nx_ip_header_destination_ip[0] & (ULONG)0xFF000000) == (ULONG)0xFF000000) && nd_header_ptr -> nx_icmpv6_nd_flag & 0x40000000) { ... }
}else { ... }
option_ptr = (NX_ICMPV6_OPTION *)NX_UCHAR_POINTER_ADD(nd_header_ptr, sizeof(NX_ICMPV6_ND));
option_length = (UINT)(packet_ptr -> nx_packet_length - sizeof(NX_ICMPV6_ND));
if (option_length)
{
return(_nx_icmpv6_validate_options(option_ptr, (INT)option_length, (INT)option_check));
}if (option_length) { ... }
return(NX_SUCCESS);
}_nx_icmpv6_validate_neighbor_message (NX_PACKET *packet_ptr) { ... }
/* ... */
#endif