コード例 #1
0
ファイル: system.php プロジェクト: LFCavalcanti/pfsense
             } else {
                 // The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
                 $ignore_posted_dnsgw[$dnsgwname] = true;
             }
         }
     }
 }
 if (count(array_filter($dnslist)) != count(array_unique(array_filter($dnslist)))) {
     $input_errors[] = gettext('Each configured DNS server must have a unique IP address. Remove the duplicated IP.');
 }
 $direct_networks_list = explode(" ", filter_get_direct_networks_list());
 for ($dnscounter = 1; $dnscounter < 5; $dnscounter++) {
     $dnsitem = "dns{$dnscounter}";
     $dnsgwitem = "dns{$dnscounter}gw";
     if ($_POST[$dnsgwitem]) {
         if (interface_has_gateway($_POST[$dnsgwitem])) {
             foreach ($direct_networks_list as $direct_network) {
                 if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
                     $input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
                 }
             }
         }
     }
 }
 # it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
 $_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
 $_POST['timeservers'] = trim($_POST['timeservers']);
 foreach (explode(' ', $_POST['timeservers']) as $ts) {
     if (!is_domain($ts)) {
         $input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
     }
コード例 #2
0
ファイル: status_rrd_graph.php プロジェクト: z0x010/pfsense
 foreach ($ui_databases as $curdatabase) {
     if (!stristr($curdatabase, $curcat)) {
         continue;
     }
     $optionc = explode("-", $curdatabase);
     $search = array("-", ".rrd", $optionc);
     $replace = array(" :: ", "", $friendly);
     switch ($curoption) {
         case "outbound":
             /* make sure we do not show the placeholder databases in the outbound view */
             if (stristr($curdatabase, "outbound") || stristr($curdatabase, "allgraphs")) {
                 continue 2;
             }
             /* only show interfaces with a gateway */
             $optionc = "{$optionc['0']}";
             if (!interface_has_gateway($optionc)) {
                 if (!isset($gateways_arr)) {
                     if (preg_match("/quality/i", $curdatabase)) {
                         $gateways_arr = return_gateways_array();
                     } else {
                         $gateways_arr = array();
                     }
                 }
                 $found_gateway = false;
                 foreach ($gateways_arr as $gw) {
                     if ($gw['name'] == $optionc) {
                         $found_gateway = true;
                         break;
                     }
                 }
                 if (!$found_gateway) {
コード例 #3
0
ファイル: system.php プロジェクト: nuclewall/nuclewall
        ?>
									<select name='<?php 
        echo $fldname;
        ?>
'>
										<?php 
        $interface = "none";
        $dnsgw = "dns{$dnscounter}gwint";
        if ($pconfig[$dnsgw] == $interface) {
            $selected = "selected";
        } else {
            $selected = "";
        }
        echo "<option value='{$interface}' {$selected}>" . ucwords($interface) . "</option>\n";
        foreach ($interfaces as $interface) {
            if (interface_has_gateway($interface)) {
                if ($pconfig[$dnsgw] == $interface) {
                    $selected = "selected";
                } else {
                    $selected = "";
                }
                $friendly_interface = convert_friendly_interface_to_friendly_descr($interface);
                echo "<option value='{$interface}' {$selected}>" . ucwords($friendly_interface) . "</option>\n";
            }
        }
        ?>
									</select>
								<?php 
    }
    ?>
								</td>
コード例 #4
0
ファイル: system_general.php プロジェクト: reelsense/core
             if (is_ipaddrv6($pconfig[$dnsname]) && validate_address_family($pconfig[$dnsname], $pconfig[$dnsgwname]) === false) {
                 $input_errors[] = gettext("You can not specify IPv4 gateway '{$pconfig[$dnsgwname]}' for IPv6 DNS server '{$pconfig[$dnsname]}'");
             }
         } else {
             // The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
             $ignore_posted_dnsgw[$dnsgwname] = true;
         }
     }
 }
 /* XXX cranky low-level call, please refactor */
 $direct_networks_list = explode(' ', filter_get_direct_networks_list(filter_generate_optcfg_array()));
 for ($dnscounter = 1; $dnscounter < 5; $dnscounter++) {
     $dnsitem = "dns{$dnscounter}";
     $dnsgwitem = "dns{$dnscounter}gw";
     if (!empty($pconfig[$dnsgwitem])) {
         if (interface_has_gateway($pconfig[$dnsgwitem])) {
             foreach ($direct_networks_list as $direct_network) {
                 if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
                     $input_errors[] = sprintf(gettext("You can not assign a gateway to DNS '%s' server which is on a directly connected network."), $pconfig[$dnsitem]);
                 }
             }
         }
     }
 }
 # it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
 $pconfig['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $pconfig['timeservers']);
 $pconfig['timeservers'] = trim($pconfig['timeservers']);
 foreach (explode(' ', $pconfig['timeservers']) as $ts) {
     if (!is_domain($ts)) {
         $input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
     }
コード例 #5
0
  *    lets automatically create entries
  *    for all of the interfaces to make life easier on the pip-o-chap
  */
 $ifdescrs = get_configured_interface_with_descr();
 foreach ($ifdescrs as $if => $ifdesc) {
     if (interface_has_gateway($if)) {
         continue;
     }
     $osipaddr = get_interface_ip($if);
     $ossubnet = get_interface_subnet($if);
     if (!is_ipaddr($osipaddr) || empty($ossubnet)) {
         continue;
     }
     $osn = gen_subnet($osipaddr, $ossubnet);
     foreach ($ifdescrs as $if2 => $ifdesc2) {
         if (!interface_has_gateway($if2)) {
             continue;
         }
         $natent = array();
         $natent['source']['network'] = "{$osn}/{$ossubnet}";
         $natent['dstport'] = "500";
         $natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'), $ifdesc, $ifdesc2);
         $natent['target'] = "";
         $natent['interface'] = $if2;
         $natent['destination']['any'] = true;
         $natent['staticnatport'] = true;
         $a_out[] = $natent;
         $natent = array();
         $natent['source']['network'] = "{$osn}/{$ossubnet}";
         $natent['sourceport'] = "";
         $natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'), $ifdesc, $ifdesc2);