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
100
101
102
103
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
126
133
134
135
136
137
138
139
140
141
142
143
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
165
166
167
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ip.h"
...
...
UINT _nx_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask)
{
#if !defined(NX_DISABLE_IPV4) && defined(NX_ENABLE_IP_STATIC_ROUTING)
UINT i;
UINT found_match = NX_FALSE;
UINT status = NX_NOT_SUCCESSFUL;
network_address = network_address & net_mask;
NX_TRACE_IN_LINE_INSERT(NX_TRACE_IP_STATIC_ROUTE_DELETE, ip_ptr, network_address, net_mask, 0, NX_TRACE_IP_EVENTS, 0, 0);
/* ... */
tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
if (ip_ptr -> nx_ip_routing_table_entry_count == 0)
{
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
return(NX_SUCCESS);
}if (ip_ptr -> nx_ip_routing_table_entry_count == 0) { ... }
for (i = 0; i < ip_ptr -> nx_ip_routing_table_entry_count; i++)
{
if (ip_ptr -> nx_ip_routing_table[i].nx_ip_routing_dest_ip == network_address &&
ip_ptr -> nx_ip_routing_table[i].nx_ip_routing_net_mask == net_mask)
{
UINT j;
found_match = NX_TRUE;
/* ... */
for (j = i; j < ip_ptr -> nx_ip_routing_table_entry_count; j++)
{
ip_ptr -> nx_ip_routing_table[j].nx_ip_routing_dest_ip = ip_ptr -> nx_ip_routing_table[j + 1].nx_ip_routing_dest_ip;
ip_ptr -> nx_ip_routing_table[j].nx_ip_routing_net_mask = ip_ptr -> nx_ip_routing_table[j + 1].nx_ip_routing_net_mask;
ip_ptr -> nx_ip_routing_table[j].nx_ip_routing_next_hop_address = ip_ptr -> nx_ip_routing_table[j + 1].nx_ip_routing_next_hop_address;
ip_ptr -> nx_ip_routing_table[j].nx_ip_routing_entry_ip_interface = ip_ptr -> nx_ip_routing_table[j + 1].nx_ip_routing_entry_ip_interface;
}for (j = i; j < ip_ptr -> nx_ip_routing_table_entry_count; j++) { ... }
ip_ptr -> nx_ip_routing_table[j - 1].nx_ip_routing_dest_ip = 0;
ip_ptr -> nx_ip_routing_table[j - 1].nx_ip_routing_net_mask = 0;
ip_ptr -> nx_ip_routing_table[j - 1].nx_ip_routing_next_hop_address = 0;
ip_ptr -> nx_ip_routing_table[j - 1].nx_ip_routing_entry_ip_interface = NX_NULL;
break;
}if (ip_ptr -> nx_ip_routing_table[i].nx_ip_routing_dest_ip == network_address && ip_ptr -> nx_ip_routing_table[i].nx_ip_routing_net_mask == net_mask) { ... }
}for (i = 0; i < ip_ptr -> nx_ip_routing_table_entry_count; i++) { ... }
/* ... */
if (found_match)
{
ip_ptr -> nx_ip_routing_table_entry_count--;
status = NX_SUCCESS;
}if (found_match) { ... }
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
return(status);/* ... */
#else
NX_PARAMETER_NOT_USED(ip_ptr);
NX_PARAMETER_NOT_USED(network_address);
NX_PARAMETER_NOT_USED(net_mask);
return(NX_NOT_SUPPORTED);
/* ... */
#endif
}{ ... }