Revision 3e798da2
Added by Jim Pingle almost 3 years ago
src/etc/rc.openvpn | ||
---|---|---|
38 | 38 |
function openvpn_resync_if_needed ($mode, $ovpn_settings, $interface) { |
39 | 39 |
global $g, $config; |
40 | 40 |
|
41 |
if (empty($mode) || |
|
42 |
!is_array($ovpn_settings) || |
|
43 |
empty($ovpn_settings)) { |
|
44 |
return; |
|
45 |
} |
|
46 |
|
|
41 | 47 |
$resync_needed = true; |
42 | 48 |
if (isset($ovpn_settings['disable'])) { |
43 | 49 |
$resync_needed = false; |
... | ... | |
81 | 87 |
system_routing_configure(); |
82 | 88 |
} |
83 | 89 |
|
84 |
|
|
85 |
if ((is_array($config['openvpn']['openvpn-server']) && count($config['openvpn']['openvpn-server'])) || |
|
86 |
(is_array($config['openvpn']['openvpn-client']) && count($config['openvpn']['openvpn-client']))) { |
|
90 |
if (count(config_get_path("openvpn/openvpn-server", [])) || |
|
91 |
count(config_get_path("openvpn/openvpn-client", []))) { |
|
87 | 92 |
if (empty($argument) || $argument == "all") { |
88 | 93 |
$argument = "all"; |
89 | 94 |
$log_text = "all"; |
90 | 95 |
} else { |
91 | 96 |
$log_text = "endpoints that may use " . $argument; |
92 | 97 |
} |
93 |
log_error("OpenVPN: One or more OpenVPN tunnel endpoints may have changed its IP. Reloading " . $log_text . ".");
|
|
98 |
log_error("OpenVPN: One or more OpenVPN tunnel endpoints may have changed IP addresses. Reloading " . $log_text . ".");
|
|
94 | 99 |
} else { |
95 | 100 |
return; |
96 | 101 |
} |
... | ... | |
118 | 123 |
} |
119 | 124 |
} |
120 | 125 |
|
121 |
if (is_array($config['openvpn']['openvpn-server'])) { |
|
122 |
foreach ($config['openvpn']['openvpn-server'] as &$server) { |
|
123 |
if ($server['interface'] == $interface || empty($interface) || (!empty($gwgroups) && in_array($server['interface'], $gwgroups))) { |
|
124 |
openvpn_resync_if_needed('server', $server, $interface); |
|
125 |
} |
|
126 |
foreach (config_get_path("openvpn/openvpn-server", []) as &$server) { |
|
127 |
if (empty($server)) { |
|
128 |
continue; |
|
129 |
} |
|
130 |
if ($server['interface'] == $interface || empty($interface) || |
|
131 |
(!empty($gwgroups) && in_array($server['interface'], $gwgroups))) { |
|
132 |
openvpn_resync_if_needed('server', $server, $interface); |
|
126 | 133 |
} |
127 | 134 |
} |
128 | 135 |
|
129 |
if (is_array($config['openvpn']['openvpn-client'])) { |
|
130 |
foreach ($config['openvpn']['openvpn-client'] as &$client) { |
|
131 |
if ($client['interface'] == $interface || empty($interface) || (!empty($gwgroups) && in_array($client['interface'], $gwgroups))) { |
|
132 |
openvpn_resync_if_needed('client', $client, $interface); |
|
133 |
} |
|
136 |
foreach (config_get_path("openvpn/openvpn-client", []) as &$client) { |
|
137 |
if (empty($client)) { |
|
138 |
continue; |
|
139 |
} |
|
140 |
if ($client['interface'] == $interface || empty($interface) || |
|
141 |
(!empty($gwgroups) && in_array($client['interface'], $gwgroups))) { |
|
142 |
openvpn_resync_if_needed('client', $client, $interface); |
|
134 | 143 |
} |
135 | 144 |
} |
136 | 145 |
} |
Also available in: Unified diff
Fix PHP8 issues in rc.openvpn and rc.carp*