mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
plugins: extend reach to "configurable" reject spots
This commit is contained in:
parent
f2d6a44b4c
commit
b97789b2d9
@ -57,7 +57,7 @@ function is_interface_mismatch()
|
||||
$mismatch = false;
|
||||
|
||||
foreach (plugins_devices() as $device) {
|
||||
if (!$device['critical']) {
|
||||
if (!empty($device['volatile'])) {
|
||||
$patterns[] = "({$device['pattern']})";
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,26 +109,26 @@ function core_devices()
|
||||
$devices = array();
|
||||
|
||||
# XXX is a plugin collection...
|
||||
$devices[] = array('pattern' => '^bridge', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^cua', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^enc', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^gif', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^gre', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^ipsec', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^l2tp', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^lagg', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^ocvpn', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^ovpn', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^ppp', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^pptp', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^tinc', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^tun|^tap', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^ue', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^wg', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^zt', 'critical' => false);
|
||||
$devices[] = array('pattern' => '_stf', 'critical' => false);
|
||||
$devices[] = array('pattern' => '_wlan', 'critical' => false);
|
||||
$devices[] = array('pattern' => 'vlan', 'critical' => false);
|
||||
$devices[] = array('pattern' => '^bridge', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^cua', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^enc', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^gif', 'volatile' => true, 'configurable' => false);
|
||||
$devices[] = array('pattern' => '^gre', 'volatile' => true, 'configurable' => false);
|
||||
$devices[] = array('pattern' => '^ipsec', 'volatile' => true, 'configurable' => false);
|
||||
$devices[] = array('pattern' => '^l2tp', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^lagg', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^ocvpn', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^ovpn', 'volatile' => true, 'configurable' => false);
|
||||
$devices[] = array('pattern' => '^ppp', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^pptp', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^tinc', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^tun|^tap', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^ue', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^wg', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '^zt', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '_stf', 'volatile' => true);
|
||||
$devices[] = array('pattern' => '_wlan', 'volatile' => true);
|
||||
$devices[] = array('pattern' => 'vlan', 'volatile' => true);
|
||||
|
||||
return $devices;
|
||||
}
|
||||
|
||||
@ -667,8 +667,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
|
||||
if ($pconfig['type'] != 'none' || $pconfig['type6'] != 'none') {
|
||||
if (strstr($pconfig['if'], 'gre') || strstr($pconfig['if'], 'gif') || strstr($pconfig['if'], 'ovpn') || strstr($pconfig['if'], 'ipsec')) {
|
||||
$input_errors[] = gettext('Cannot assign an IP configuration type to a tunnel interface.');
|
||||
foreach (plugins_devices() as $device) {
|
||||
if (!isset($device['configurable']) || $device['configurable'] == true) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/' . $device['pattern'] . '/', $ifport)) {
|
||||
$input_errors[] = gettext('Cannot assign an IP configuration type to a tunnel interface.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -279,11 +279,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$config['interfaces'][$ifname]['ipaddr'] = $interfaces[$ifport]['type'];
|
||||
}
|
||||
|
||||
if (strstr($ifport, 'gre') || strstr($ifport, 'gif') || strstr($ifport, 'ovpn') || strstr($ifport, 'ipsec')) {
|
||||
unset($config['interfaces'][$ifname]['ipaddr']);
|
||||
unset($config['interfaces'][$ifname]['subnet']);
|
||||
unset($config['interfaces'][$ifname]['ipaddrv6']);
|
||||
unset($config['interfaces'][$ifname]['subnetv6']);
|
||||
foreach (plugins_devices() as $device) {
|
||||
if (!isset($device['configurable']) || $device['configurable'] == true) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/' . $device['pattern'] . '/', $ifport)) {
|
||||
unset($config['interfaces'][$ifname]['ipaddr']);
|
||||
unset($config['interfaces'][$ifname]['subnet']);
|
||||
unset($config['interfaces'][$ifname]['ipaddrv6']);
|
||||
unset($config['interfaces'][$ifname]['subnetv6']);
|
||||
}
|
||||
}
|
||||
|
||||
/* check for wireless interfaces, set or clear ['wireless'] */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user