当前位置: 首页>>代码示例>>PHP>>正文


PHP check_subnets_overlap函数代码示例

本文整理汇总了PHP中check_subnets_overlap函数的典型用法代码示例。如果您正苦于以下问题:PHP check_subnets_overlap函数的具体用法?PHP check_subnets_overlap怎么用?PHP check_subnets_overlap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_subnets_overlap函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sprintf

 }
 /* For dst, user can enter ip's, networks or aliases */
 if (!is_specialnet($_POST['dsttype'])) {
     if ($_POST['dst'] && !is_ipaddroralias($_POST['dst'])) {
         $input_errors[] = sprintf(gettext("%s is not a valid destination IP address or alias."), $_POST['dst']);
     }
     if ($_POST['dstmask'] && !is_numericint($_POST['dstmask'])) {
         $input_errors[] = gettext("A valid destination bit count must be specified.");
     }
 }
 /* check for overlaps with other 1:1 */
 foreach ($a_1to1 as $natent) {
     if (isset($id) && $a_1to1[$id] && $a_1to1[$id] === $natent) {
         continue;
     }
     if (check_subnets_overlap($_POST['internal'], $_POST['subnet'], $natent['internal'], $natent['subnet'])) {
         //$input_errors[] = "Another 1:1 rule overlaps with the specified internal subnet.";
         //break;
     }
 }
 if (!$input_errors) {
     $natent = array();
     $natent['disabled'] = isset($_POST['disabled']) ? true : false;
     $natent['external'] = $_POST['external'];
     $natent['descr'] = $_POST['descr'];
     $natent['interface'] = $_POST['interface'];
     pconfig_to_address($natent['source'], $_POST['src'], $_POST['srcmask'], $_POST['srcnot']);
     pconfig_to_address($natent['destination'], $_POST['dst'], $_POST['dstmask'], $_POST['dstnot']);
     if ($_POST['natreflection'] == "enable" || $_POST['natreflection'] == "disable") {
         $natent['natreflection'] = $_POST['natreflection'];
     } else {
开发者ID:OptimWIFI,项目名称:pfsense,代码行数:31,代码来源:firewall_nat_1to1_edit.php

示例2: foreach

         continue;
     }
     if (check_subnets_overlap($_POST['external'], $_POST['subnet'], $natent['external'], $natent['subnet'])) {
         //$input_errors[] = "Another 1:1 rule overlaps with the specified external subnet.";
         //break;
     } else {
         if (check_subnets_overlap($_POST['internal'], $_POST['subnet'], $natent['internal'], $natent['subnet'])) {
             //$input_errors[] = "Another 1:1 rule overlaps with the specified internal subnet.";
             //break;
         }
     }
 }
 /* check for overlaps with advanced outbound NAT */
 if (is_array($config['nat']['advancedoutbound']['rule'])) {
     foreach ($config['nat']['advancedoutbound']['rule'] as $natent) {
         if ($natent['target'] && check_subnets_overlap($_POST['external'], $_POST['subnet'], $natent['target'], 32)) {
             $input_errors[] = "An advanced outbound NAT entry overlaps with the specified external subnet.";
             break;
         }
     }
 }
 if (!$input_errors) {
     $natent = array();
     $natent['external'] = $_POST['external'];
     $natent['internal'] = $_POST['internal'];
     $natent['subnet'] = $_POST['subnet'];
     $natent['descr'] = $_POST['descr'];
     $natent['interface'] = $_POST['interface'];
     if (isset($id) && $a_1to1[$id]) {
         $a_1to1[$id] = $natent;
     } else {
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:firewall_nat_1to1_edit.php

示例3: get_failover_interface

                 $if = get_failover_interface($phase1['interface'], "inet6");
                 $interfaceip = get_interface_ipv6($if);
             } else {
                 $if = get_failover_interface($phase1['interface']);
                 $interfaceip = get_interface_ip($if);
             }
             /* skip validation for hostnames, they're subject to change anyway */
             if (is_ipaddr($phase1['remote-gateway'])) {
                 if ($pconfig['mode'] == "tunnel") {
                     if (check_subnets_overlap($interfaceip, 32, $entered_local_network, $entered_local_mask) && check_subnets_overlap($phase1['remote-gateway'], 32, $entered_remote_network, $entered_remote_mask)) {
                         $input_errors[] = gettext("The local and remote networks of a phase 2 entry cannot overlap the outside of the tunnel (interface and remote gateway) configured in its phase 1.");
                         break;
                     }
                 } else {
                     if ($pconfig['mode'] == "tunnel6") {
                         if (check_subnetsv6_overlap($interfaceip, 128, $entered_local_network, $entered_local_mask) && check_subnets_overlap($phase1['remote-gateway'], 128, $entered_remote_network, $entered_remote_mask)) {
                             $input_errors[] = gettext("The local and remote networks of a phase 2 entry cannot overlap the outside of the tunnel (interface and remote gateway) configured in its phase 1.");
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
 /* For ESP protocol, handle encryption algorithms */
 if ($pconfig['proto'] == "esp") {
     $ealgos = pconfig_to_ealgos($pconfig);
     if (!count($ealgos)) {
         $input_errors[] = gettext("At least one encryption algorithm must be selected.");
     } else {
开发者ID:jdillard,项目名称:pfsense,代码行数:31,代码来源:vpn_ipsec_phase2.php

示例4: foreach

     $input_errors[] = "/32 alt ağ maskesi geçersiz CARP IP leri içeriyor.";
 }
 /* check for overlaps with other virtual IP */
 foreach ($a_vip as $vipent) {
     if (isset($id) && $a_vip[$id] && $a_vip[$id] === $vipent) {
         continue;
     }
     if (isset($_POST['subnet']) && $_POST['subnet'] == $vipent['subnet']) {
         $input_errors[] = "Tanımlanan IP adresi zaten sanal IP listesinde mevcuttur.";
         break;
     }
 }
 /* check for overlaps with 1:1 NAT */
 if (is_array($config['nat']['onetoone'])) {
     foreach ($config['nat']['onetoone'] as $natent) {
         if (check_subnets_overlap($_POST['ipaddr'], 32, $natent['external'], $natent['subnet'])) {
             $input_errors[] = "A 1:1 NAT mapping overlaps with the specified IP address.";
             break;
         }
     }
 }
 /* make sure new ip is within the subnet of a valid ip
  * on one of our interfaces (wan, lan optX)
  */
 if ($_POST['mode'] == "carp") {
     if (!$id) {
         /* verify against reusage of vhids */
         $idtracker = 0;
         foreach ($config['virtualip']['vip'] as $vip) {
             if ($vip['vhid'] == $_POST['vhid'] and $idtracker != $id) {
                 $input_errors[] = "VHID {$_POST['vhid']} is already in use.  Pick a unique number.";
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:firewall_virtual_ip_edit.php


注:本文中的check_subnets_overlap函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。