예제 #1
0
     $reqdfields[] = 'tunnel_network';
     $reqdfieldsn[] = gettext('Tunnel network');
 } else {
     if ($pconfig['serverbridge_dhcp'] && $pconfig['tunnel_network']) {
         $input_errors[] = gettext("Using a tunnel network and server bridge settings together is not allowed.");
     }
     if ($pconfig['serverbridge_dhcp_start'] && !$pconfig['serverbridge_dhcp_end'] || !$pconfig['serverbridge_dhcp_start'] && $pconfig['serverbridge_dhcp_end']) {
         $input_errors[] = gettext("Server Bridge DHCP Start and End must both be empty, or defined.");
     }
     if ($pconfig['serverbridge_dhcp_start'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_start'])) {
         $input_errors[] = gettext("Server Bridge DHCP Start must be an IPv4 address.");
     }
     if ($pconfig['serverbridge_dhcp_end'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_end'])) {
         $input_errors[] = gettext("Server Bridge DHCP End must be an IPv4 address.");
     }
     if (ip_greater_than($pconfig['serverbridge_dhcp_start'], $pconfig['serverbridge_dhcp_end'])) {
         $input_errors[] = gettext("The Server Bridge DHCP range is invalid (start higher than end).");
     }
 }
 do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
 if (!$input_errors) {
     $server = array();
     if ($id && $pconfig['dev_mode'] != $a_server[$id]['dev_mode']) {
         openvpn_delete('server', $a_server[$id]);
         // delete(rename) old interface so a new TUN or TAP interface can be created.
     }
     if ($vpnid) {
         $server['vpnid'] = $vpnid;
     } else {
         $server['vpnid'] = openvpn_vpnid_next();
     }
예제 #2
0
                                                 $input_errors[] = gettext("IP address or host type must be an IP address or host name.");
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 if (!$input_errors) {
     /* make sure the range lies within the current subnet */
     if (ip_greater_than($_POST['range_from'], $_POST['range_to'])) {
         $input_errors[] = gettext("The range is invalid (first element higher than second element).");
     }
     if (!is_inrange_v4($_POST['range_from'], $subnet_start, $subnet_end) || !is_inrange_v4($_POST['range_to'], $subnet_start, $subnet_end)) {
         $input_errors[] = gettext("The specified range lies outside of the current subnet.");
     }
     if (is_numeric($pool) || $act == "newpool") {
         if (is_inrange_v4($_POST['range_from'], $config['dhcpd'][$if]['range']['from'], $config['dhcpd'][$if]['range']['to']) || is_inrange_v4($_POST['range_to'], $config['dhcpd'][$if]['range']['from'], $config['dhcpd'][$if]['range']['to'])) {
             $input_errors[] = gettext("The specified range must not be within the DHCP range for this interface.");
         }
     }
     foreach ($a_pools as $id => $p) {
         if (is_numeric($pool) && $id == $pool) {
             continue;
         }
         if (is_inrange_v4($_POST['range_from'], $p['range']['from'], $p['range']['to']) || is_inrange_v4($_POST['range_to'], $p['range']['from'], $p['range']['to'])) {