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


PHP gen_subnet函数代码示例

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


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

示例1: formTranslateAddresses

/**
 * return option array for valid translation networks
 */
function formTranslateAddresses()
{
    global $config;
    $retval = array();
    // add this hosts ips
    foreach ($config['interfaces'] as $intf => $intfdata) {
        if (isset($intfdata['ipaddr']) && $intfdata['ipaddr'] != 'dhcp') {
            $retval[$intfdata['ipaddr']] = (!empty($intfdata['descr']) ? $intfdata['descr'] : $intf) . " " . gettext("address");
        }
    }
    // add VIPs's
    if (isset($config['virtualip']['vip'])) {
        foreach ($config['virtualip']['vip'] as $sn) {
            if (!isset($sn['noexpand'])) {
                if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
                    $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
                    $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
                    $len = $end - $start;
                    $retval[$sn['subnet'] . '/' . $sn['subnet_bits']] = htmlspecialchars("Subnet: {$sn['subnet']}/{$sn['subnet_bits']} ({$sn['descr']})");
                    for ($i = 0; $i <= $len; $i++) {
                        $snip = long2ip32($start + $i);
                        $retval[$snip] = htmlspecialchars("{$snip} ({$sn['descr']})");
                    }
                } else {
                    $retval[$sn['subnet']] = htmlspecialchars("{$sn['subnet']} ({$sn['descr']})");
                }
            }
        }
    }
    // add Aliases
    foreach (legacy_list_aliases("network") as $alias) {
        if ($alias['type'] == "host") {
            $retval[$alias['name']] = $alias['name'];
        }
    }
    return $retval;
}
开发者ID:paudam,项目名称:opnsense-core,代码行数:40,代码来源:firewall_nat_out_edit.php

示例2: deleteVIPEntry

/**
 * delete virtual ip
 */
function deleteVIPEntry($id)
{
    global $config;
    $input_errors = array();
    $a_vip =& $config['virtualip']['vip'];
    /* make sure no inbound NAT mappings reference this entry */
    if (isset($config['nat']['rule'])) {
        foreach ($config['nat']['rule'] as $rule) {
            if (!empty($rule['destination']['address'])) {
                if ($rule['destination']['address'] == $a_vip[$id]['subnet']) {
                    $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one NAT mapping.");
                    break;
                }
            }
        }
    }
    if (is_ipaddrv6($a_vip[$id]['subnet'])) {
        $is_ipv6 = true;
        $subnet = gen_subnetv6($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']);
        $if_subnet_bits = get_interface_subnetv6($a_vip[$id]['interface']);
        $if_subnet = gen_subnetv6(get_interface_ipv6($a_vip[$id]['interface']), $if_subnet_bits);
    } else {
        $is_ipv6 = false;
        $subnet = gen_subnet($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']);
        $if_subnet_bits = get_interface_subnet($a_vip[$id]['interface']);
        $if_subnet = gen_subnet(get_interface_ip($a_vip[$id]['interface']), $if_subnet_bits);
    }
    $subnet .= "/" . $a_vip[$id]['subnet_bits'];
    $if_subnet .= "/" . $if_subnet_bits;
    if (isset($config['gateways']['gateway_item'])) {
        foreach ($config['gateways']['gateway_item'] as $gateway) {
            if ($a_vip[$id]['interface'] != $gateway['interface']) {
                continue;
            }
            if ($is_ipv6 && $gateway['ipprotocol'] == 'inet') {
                continue;
            }
            if (!$is_ipv6 && $gateway['ipprotocol'] == 'inet6') {
                continue;
            }
            if (ip_in_subnet($gateway['gateway'], $if_subnet)) {
                continue;
            }
            if (ip_in_subnet($gateway['gateway'], $subnet)) {
                $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one Gateway.");
                break;
            }
        }
    }
    if ($a_vip[$id]['mode'] == "ipalias") {
        $subnet = gen_subnet($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']) . "/" . $a_vip[$id]['subnet_bits'];
        $found_if = false;
        $found_carp = false;
        $found_other_alias = false;
        if ($subnet == $if_subnet) {
            $found_if = true;
        }
        $vipiface = $a_vip[$id]['interface'];
        foreach ($a_vip as $vip_id => $vip) {
            if ($vip_id != $id) {
                if ($vip['interface'] == $vipiface && ip_in_subnet($vip['subnet'], $subnet)) {
                    if ($vip['mode'] == "carp") {
                        $found_carp = true;
                    } else {
                        if ($vip['mode'] == "ipalias") {
                            $found_other_alias = true;
                        }
                    }
                }
            }
        }
        if ($found_carp === true && $found_other_alias === false && $found_if === false) {
            $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by a CARP IP with the description") . " {$vip['descr']}.";
        }
    }
    if (count($input_errors) == 0) {
        // Special case since every proxyarp vip is handled by the same daemon.
        if ($a_vip[$id]['mode'] == "proxyarp") {
            $viface = $a_vip[$id]['interface'];
            unset($a_vip[$id]);
            interface_proxyarp_configure($viface);
        } else {
            interface_vip_bring_down($a_vip[$id]);
            unset($a_vip[$id]);
        }
        if (count($config['virtualip']['vip']) == 0) {
            unset($config['virtualip']['vip']);
        }
    }
    return $input_errors;
}
开发者ID:8191,项目名称:opnsense-core,代码行数:94,代码来源:firewall_virtual_ip.php

示例3: sprintf

         $input_errors[] = sprintf(gettext("The IP address cannot be the %s network address."), $ifcfgdescr);
     }
     if ($ipaddr_int == $lansubnet_end) {
         $input_errors[] = sprintf(gettext("The IP address cannot be the %s broadcast address."), $ifcfgdescr);
     }
 }
 if ($_POST['gateway'] && !is_ipaddrv4($_POST['gateway'])) {
     $input_errors[] = gettext("A valid IP address must be specified for the gateway.");
 }
 if ($_POST['wins1'] && !is_ipaddrv4($_POST['wins1']) || $_POST['wins2'] && !is_ipaddrv4($_POST['wins2'])) {
     $input_errors[] = gettext("A valid IP address must be specified for the primary/secondary WINS servers.");
 }
 $parent_ip = get_interface_ip($POST['if']);
 if (is_ipaddrv4($parent_ip) && $_POST['gateway']) {
     $parent_sn = get_interface_subnet($_POST['if']);
     if (!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['if'], $_POST['gateway'])) {
         $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
     }
 }
 if ($_POST['dns1'] && !is_ipaddrv4($_POST['dns1']) || $_POST['dns2'] && !is_ipaddrv4($_POST['dns2']) || $_POST['dns3'] && !is_ipaddrv4($_POST['dns3']) || $_POST['dns4'] && !is_ipaddrv4($_POST['dns4'])) {
     $input_errors[] = gettext("A valid IP address must be specified for each of the DNS servers.");
 }
 if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || $_POST['deftime'] < 60)) {
     $input_errors[] = gettext("The default lease time must be at least 60 seconds.");
 }
 if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || $_POST['maxtime'] < 60 || $_POST['maxtime'] <= $_POST['deftime'])) {
     $input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
 }
 if ($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])) {
     $input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
 }
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:services_dhcp_edit.php

示例4: htmlspecialchars

        echo htmlspecialchars($pconfig['descr']);
        ?>
" />
											</td>
											</tr>
										<?php 
    }
    ?>
										<tr>
										<td width="22%" valign="top" class="vncellreq"><?php 
    echo gettext("Subnet");
    ?>
</td>
										<td width="78%" class="vtable">
											<?php 
    echo gen_subnet($ifcfgip, $ifcfgsn);
    ?>
										</td>
										</tr>
										<tr>
										<td width="22%" valign="top" class="vncellreq"><?php 
    echo gettext("Subnet mask");
    ?>
</td>
										<td width="78%" class="vtable">
											<?php 
    echo gen_subnet_mask($ifcfgsn);
    ?>
										</td>
										</tr>
										<tr>
开发者ID:karawan,项目名称:core,代码行数:31,代码来源:services_dhcp.php

示例5: gettext

         $input_errors[] = gettext("You must specify a CARP password that is shared between the two VHID members.");
     }
     if ($_POST['interface'] == 'lo0') {
         $input_errors[] = gettext("For this type of vip localhost is not allowed.");
     } else {
         if (strpos($_POST['interface'], '_vip')) {
             $input_errors[] = gettext("A CARP parent interface can only be used with IP Alias type Virtual IPs.");
         }
     }
     break;
 case 'ipalias':
     if (strstr($_POST['interface'], "_vip")) {
         if (is_ipaddrv4($_POST['subnet'])) {
             $parent_ip = get_interface_ip($_POST['interface']);
             $parent_sn = get_interface_subnet($_POST['interface']);
             $subnet = gen_subnet($parent_ip, $parent_sn);
         } else {
             if (is_ipaddrv6($_POST['subnet'])) {
                 $parent_ip = get_interface_ipv6($_POST['interface']);
                 $parent_sn = get_interface_subnetv6($_POST['interface']);
                 $subnet = gen_subnetv6($parent_ip, $parent_sn);
             }
         }
         if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") && !ip_in_interface_alias_subnet(link_carp_interface_to_parent($_POST['interface']), $_POST['subnet'])) {
             $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'];
             $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s.  Please add an IP alias in this subnet on this interface."), $cannot_find);
         }
         unset($parent_ip, $parent_sn, $subnet);
     }
     break;
 default:
开发者ID:toshisam,项目名称:pfsense,代码行数:31,代码来源:firewall_virtual_ip_edit.php

示例6: array

      *    user has enabled advanced outbound nat -- lets automatically create entries
      *    for all of the interfaces to make life easier on the pip-o-chap
      */
     $ifdescrs = array('lan');
     for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
         $ifdescrs[] = "opt" . $j;
     }
     foreach ($ifdescrs as $if) {
         if ($if != "lan" and $if != "wan") {
             /* interface is an optional.  is it enabled? */
             if (!isset($config['interfaces'][$if]['enabled'])) {
                 continue;
             }
         }
         $natent = array();
         $osn = gen_subnet($config['interfaces'][$if]['ipaddr'], $config['interfaces'][$if]['subnet']);
         $natent['source']['network'] = $osn . "/" . $config['interfaces'][$if]['subnet'];
         $natent['sourceport'] = "";
         $int_description = $config['interfaces'][$if]['descr'];
         if ($if == "lan") {
             $int_description = "LAN";
         }
         $natent['descr'] = "Auto created rule for {$int_description}";
         $natent['target'] = "";
         $natent['interface'] = "wan";
         $natent['destination']['any'] = true;
         $natent['natport'] = "";
         $a_out[] = $natent;
     }
     $savemsg = "Default rules for each interface have been created.";
 }
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:firewall_nat_out.php

示例7: foreach

         }
     }
 }
 if (is_array($config['virtualip']) && isset($pkga['showvirtualips'])) {
     foreach ($config['virtualip']['vip'] as $vip) {
         if (!preg_match("/{$interface_regex}/", $vip['interface'])) {
             $vip_description = $vip['descr'] != "" ? " ({$vip['descr']}) " : " ";
         }
         switch ($vip['mode']) {
             case "ipalias":
             case "carp":
                 $ips[] = array('ip' => $vip['subnet'], 'description' => "{$vip['subnet']} {$vip_description}");
                 break;
             case "proxyarp":
                 if ($vip['type'] == "network") {
                     $start = ip2long32(gen_subnet($vip['subnet'], $vip['subnet_bits']));
                     $end = ip2long32(gen_subnet_max($vip['subnet'], $vip['subnet_bits']));
                     $len = $end - $start;
                     for ($i = 0; $i <= $len; $i++) {
                         $ips[] = array('ip' => long2ip32($start + $i), 'description' => long2ip32($start + $i) . " from {$vip['subnet']}/{$vip['subnet_bits']} {$vip_description}");
                     }
                 } else {
                     $ips[] = array('ip' => $vip['subnet'], 'description' => "{$vip['subnet']} {$vip_description}");
                 }
                 break;
         }
     }
 }
 sort($ips);
 if (isset($pkga['showlistenall'])) {
     array_unshift($ips, array('ip' => gettext('All'), 'description' => gettext('Listen on All interfaces/ip addresses ')));
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:pkg_edit.php

示例8: if

											<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked=\"checked\""; ?> />
											<strong><?=gettext("Deny unknown clients");?></strong><br />
											<?=gettext("If this is checked, only the clients defined below will get DHCP leases from this server. ");?></td>
										</tr>
										<?php if (is_numeric($pool) || ($act == "newpool")): ?>
											<tr>
											<td width="22%" valign="top" class="vncell"><?=gettext("Pool Description");?></td>
											<td width="78%" class="vtable">
												<input name="descr" type="text" class="form-control unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>" />
											</td>
											</tr>
										<?php endif; ?>
										<tr>
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet");?></td>
										<td width="78%" class="vtable">
											<?=gen_subnet($ifcfgip, $ifcfgsn);?>
										</td>
										</tr>
										<tr>
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet mask");?></td>
										<td width="78%" class="vtable">
											<?=gen_subnet_mask($ifcfgsn);?>
										</td>
										</tr>
										<tr>
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Available range");?></td>
										<td width="78%" class="vtable">
										<?php
											$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
											$range_from++;
											echo long2ip32($range_from);
开发者ID:Toudix,项目名称:core,代码行数:31,代码来源:services_dhcp.php

示例9: gen_subnet

                      <td width="78%" class="vtable">
			<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php 
if ($pconfig['denyunknown']) {
    echo "checked";
}
?>
>
                      <strong>Bilinmeyen istemcileri engelle</strong><br>
					  Eğer bu alan seçilirse, sadece tanımlanmış olan istemcilere IP dağıtılacaktır
                      </td>
		      		  </tr>
                      <tr>
                        <td width="22%" valign="top" class="vncellreq">Alt ağ</td>
                        <td width="78%" class="vtable">
                          <?php 
echo gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']);
?>
                        </td>
                      </tr>
                      <tr>
                        <td width="22%" valign="top" class="vncellreq">Alt ağ
                          maskesi</td>
                        <td width="78%" class="vtable">
                          <?php 
echo gen_subnet_mask($ifcfg['subnet']);
?>
                        </td>
                      </tr>
                      <tr>
                        <td width="22%" valign="top" class="vncellreq">Mevcut aralık</td>
                        <td width="78%" class="vtable">
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:services_dhcp.php

示例10: build_dsttype_list

function build_dsttype_list()
{
    global $pconfig, $config, $ifdisp;
    $sel = is_specialnet($pconfig['dst']);
    $list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network', '(self)' => 'This Firewall (self)');
    if (have_ruleint_access("pppoe")) {
        $list['pppoe'] = 'PPPoE clients';
    }
    if (have_ruleint_access("l2tp")) {
        $list['l2tp'] = 'L2TP clients';
    }
    foreach ($ifdisp as $if => $ifdesc) {
        if (have_ruleint_access($if)) {
            $list[$if] = $ifdesc;
            $list[$if . 'ip'] = $ifdesc . ' address';
        }
    }
    if (is_array($config['virtualip']['vip'])) {
        foreach ($config['virtualip']['vip'] as $sn) {
            if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
                if (isset($sn['noexpand'])) {
                    continue;
                }
                $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
                $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
                $len = $end - $start;
                for ($i = 0; $i <= $len; $i++) {
                    $snip = long2ip32($start + $i);
                    $list[$snip] = $snip . ' (' . $sn['descr'] . ')';
                }
                $list[$sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')';
            } else {
                $list[$sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')';
            }
        }
    }
    return $list;
}
开发者ID:ffdesousa,项目名称:pfsense,代码行数:38,代码来源:firewall_nat_edit.php

示例11: sprintf

     // allow alldirs
 } else {
     if (isset($_POST['quiet'])) {
         // might be delayed mount
     } else {
         if (isset($_POST['alldirs']) && !ismounted_or_dataset($path)) {
             $input_errors[] = sprintf(gettext("All dirs requires mounted path, but Path %s is not mounted."), $path);
         }
     }
 }
 if (empty($input_errors)) {
     $share = array();
     $share['uuid'] = $_POST['uuid'];
     $share['path'] = $path;
     $share['mapall'] = $_POST['mapall'];
     $share['network'] = gen_subnet($_POST['network'], $_POST['mask']) . "/" . $_POST['mask'];
     $share['comment'] = $_POST['comment'];
     $share['v4rootdir'] = isset($_POST['v4rootdir']) ? true : false;
     $share['options']['alldirs'] = isset($_POST['alldirs']) ? true : false;
     $share['options']['ro'] = isset($_POST['readonly']) ? true : false;
     $share['options']['quiet'] = isset($_POST['quiet']) ? true : false;
     if (isset($uuid) && FALSE !== $cnid) {
         $a_share[$cnid] = $share;
         $mode = UPDATENOTIFY_MODE_MODIFIED;
     } else {
         $a_share[] = $share;
         $mode = UPDATENOTIFY_MODE_NEW;
     }
     updatenotify_set("nfsshare", $mode, $share['uuid']);
     write_config();
     header("Location: services_nfs_share.php");
开发者ID:sdoney,项目名称:nas4free,代码行数:31,代码来源:services_nfs_share_edit.php

示例12: gettext

         if (is_ipaddr_configured($_POST['subnet'], $ignore_if)) {
             $input_errors[] = gettext("This IP address is being used by another interface or VIP.");
         }
         unset($ignore_if, $ignore_mode);
     }
 }
 $natiflist = get_configured_interface_with_descr();
 foreach ($natiflist as $natif => $natdescr) {
     if ($_POST['interface'] == $natif && (empty($config['interfaces'][$natif]['ipaddr']) && empty($config['interfaces'][$natif]['ipaddrv6']))) {
         $input_errors[] = gettext("The interface chosen for the VIP has no IPv4 or IPv6 address configured so it cannot be used as a parent for the VIP.");
     }
 }
 /* ipalias and carp should not use network or broadcast address */
 if ($_POST['mode'] == "ipalias" || $_POST['mode'] == "carp") {
     if (is_ipaddrv4($_POST['subnet']) && $_POST['subnet_bits'] != "32" && $_POST['subnet_bits'] != "31") {
         $network_addr = gen_subnet($_POST['subnet'], $_POST['subnet_bits']);
         $broadcast_addr = gen_subnet_max($_POST['subnet'], $_POST['subnet_bits']);
     } else {
         if (is_ipaddrv6($_POST['subnet']) && $_POST['subnet_bits'] != "128") {
             $network_addr = gen_subnetv6($_POST['subnet'], $_POST['subnet_bits']);
             $broadcast_addr = gen_subnetv6_max($_POST['subnet'], $_POST['subnet_bits']);
         }
     }
     if (isset($network_addr) && $_POST['subnet'] == $network_addr) {
         $input_errors[] = gettext("You cannot use the network address for this VIP");
     } else {
         if (isset($broadcast_addr) && $_POST['subnet'] == $broadcast_addr) {
             $input_errors[] = gettext("You cannot use the broadcast address for this VIP");
         }
     }
 }
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:firewall_virtual_ip_edit.php

示例13: isset

         }
         if (!empty($retval)) {
             $input_errors[] = $retval;
         }
     }
 }
 if (!$input_errors) {
     $ovpnent['enable'] = isset($_POST['disabled']) ? false : true;
     $ovpnent['bind_iface'] = $_POST['bind_iface'];
     $ovpnent['port'] = $_POST['port'];
     $ovpnent['proto'] = $_POST['proto'];
     $ovpnent['type'] = $_POST['type'];
     $ovpnent['method'] = $_POST['method'];
     $ovpnent['authentication_method'] = $_POST['authentication_method'];
     /* convert IP address block to a correct network IP address */
     $ovpnent['ipblock'] = gen_subnet($_POST['ipblock'], $_POST['prefix']);
     $ovpnent['prefix'] = $_POST['prefix'];
     $ovpnent['lipaddr'] = $_POST['lipaddr'];
     $ovpnent['ripaddr'] = $_POST['ripaddr'];
     $ovpnent['netmask'] = $_POST['netmask'];
     $ovpnent['range_from'] = $_POST['range_from'];
     $ovpnent['range_to'] = $_POST['range_to'];
     $ovpnent['gateway'] = $_POST['gateway'];
     $ovpnent['bridge'] = $_POST['bridge'];
     $ovpnent['descr'] = $_POST['descr'];
     $ovpnent['verb'] = $_POST['verb'];
     $ovpnent['maxcli'] = $_POST['maxcli'];
     $ovpnent['crypto'] = $_POST['crypto'];
     $ovpnent['comp_method'] = $_POST['comp_method'];
     $ovpnent['cli2cli'] = $_POST['cli2cli'] ? true : false;
     $ovpnent['dupcn'] = $_POST['dupcn'] ? true : false;
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:vpn_openvpn_srv_edit.php

示例14: foreach

 /* make sure no inbound NAT mappings reference this entry */
 if (is_array($config['nat']['rule'])) {
     foreach ($config['nat']['rule'] as $rule) {
         if ($rule['destination']['address'] != "") {
             if ($rule['destination']['address'] == $a_vip[$_GET['id']]['subnet']) {
                 $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one NAT mapping.");
                 break;
             }
         }
     }
 }
 if ($a_vip[$_GET['id']]['mode'] == "ipalias") {
     $vipiface = $a_vip[$_GET['id']]['interface'];
     foreach ($a_vip as $vip) {
         if ($vip['interface'] == $vipiface && $vip['mode'] == "carp") {
             if (ip_in_subnet($vip['subnet'], gen_subnet($a_vip[$_GET['id']]['subnet'], $a_vip[$_GET['id']]['subnet_bits']) . "/" . $a_vip[$_GET['id']]['subnet_bits'])) {
                 $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by CARP") . " {$vip['descr']}.";
             }
         }
     }
 } else {
     if ($a_vip[$_GET['id']]['mode'] == "carp") {
         $vipiface = "{$a_vip[$_GET['id']]['interface']}_vip{$a_vip[$_GET['id']]['vhid']}";
         foreach ($a_vip as $vip) {
             if ($vipiface == $vip['interface'] && $vip['mode'] == "ipalias") {
                 $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by ip alias entry") . " {$vip['descr']}.";
             }
         }
     }
 }
 if (!$input_errors) {
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:firewall_virtual_ip.php

示例15: build_target_list

function build_target_list()
{
    global $config, $sn, $a_aliases;
    $list = array();
    $list[""] = gettext('Interface Address');
    if (is_array($config['virtualip']['vip'])) {
        foreach ($config['virtualip']['vip'] as $sn) {
            if (isset($sn['noexpand'])) {
                continue;
            }
            if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
                $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
                $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
                $len = $end - $start;
                $list[$sn['subnet'] . '/' . $sn['subnet_bits']] = 'Subnet: ' . $sn['subnet'] . '/' . $sn['subnet_bits'] . ' (' . $sn['descr'] . ')';
                for ($i = 0; $i <= $len; $i++) {
                    $snip = long2ip32($start + $i);
                    $list[$snip] = $snip . ' (' . $sn['descr'] . ')';
                }
            } else {
                $list[$sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')';
            }
        }
    }
    foreach ($a_aliases as $alias) {
        if ($alias['type'] != "host") {
            continue;
        }
        $list[$alias['name']] = gettext('Host Alias: ') . $alias['name'] . ' (' . $alias['descr'] . ')';
    }
    $list['other-subnet'] = gettext('Other Subnet (Enter Below)');
    return $list;
}
开发者ID:curtiszimmerman,项目名称:pfsense,代码行数:33,代码来源:firewall_nat_out_edit.php


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