interfaces: 6rd validation and avoid assignment #1501

This commit is contained in:
Franco Fichtner 2018-07-14 09:11:42 +00:00
parent 893e9cf0f4
commit cc2902e4dd
2 changed files with 12 additions and 0 deletions

View File

@ -679,6 +679,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
break;
case "6rd":
if (empty($pconfig['gateway-6rd']) || !is_ipaddrv4($pconfig['gateway-6rd'])) {
$input_errors[] = gettext('6RD border relay gateway must be a valid IPv4 address.');
}
if (empty($pconfig['prefix-6rd']) || !is_subnetv6($pconfig['prefix-6rd'])) {
$input_errors[] = gettext('6RD prefix must be a valid IPv6 subnet.');
}
if (!is_numeric($pconfig['prefix-6rd-v4plen'])) {
$input_errors[] = gettext('6RD IPv4 prefix length must be a number.');
}
foreach ($ifdescrs as $ifent => $ifdescr) {
if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $pconfig['type6'])) {
if ($config[interfaces][$ifent]['prefix-6rd'] == $pconfig['prefix-6rd']) {

View File

@ -68,6 +68,9 @@ function list_interfaces() {
if (match_wireless_interface($key)) {
continue;
}
if (preg_match('/_stf$/', $key)) {
continue;
}
$interfaces[$key] = array('descr' => $key . ' (' . $intf_item['mac'] . ')', 'section' => 'interfaces');
}
// collect interfaces from defined config sections