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


PHP interface_proxyarp_configure函数代码示例

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


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

示例1: session_start

        }
        if (!$input_errors) {
            if (session_status() == PHP_SESSION_NONE) {
                session_start();
            }
            $user = getUserEntry($_SESSION['Username']);
            if (is_array($user) && userHasPrivilege($user, "user-config-readonly")) {
                header("Location: firewall_virtual_ip.php");
                exit;
            }
            session_write_close();
            // Special case since every proxyarp vip is handled by the same daemon.
            if ($a_vip[$_GET['id']]['mode'] == "proxyarp") {
                $viface = $a_vip[$_GET['id']]['interface'];
                unset($a_vip[$_GET['id']]);
                interface_proxyarp_configure($viface);
            } else {
                interface_vip_bring_down($a_vip[$_GET['id']]);
                unset($a_vip[$_GET['id']]);
            }
            if (count($config['virtualip']['vip']) == 0) {
                unset($config['virtualip']['vip']);
            }
            write_config();
            header("Location: firewall_virtual_ip.php");
            exit;
        }
    }
} else {
    if ($_GET['changes'] == "mods" && is_numericint($_GET['id'])) {
        $id = $_GET['id'];
开发者ID:hlcherub,项目名称:core,代码行数:31,代码来源:firewall_virtual_ip.php

示例2: restore_config_section_xmlrpc


//.........这里部分代码省略.........
                    $oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['interface'] = $vip['interface'];
                    $oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['subnet'] = $vip['subnet'];
                } else {
                    if ($vip['mode'] == "ipalias" && (substr($vip['interface'], 0, 4) == '_vip' || strpos($vip['interface'], "lo0"))) {
                        $oldvips[$vip['subnet']]['content'] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
                        $oldvips[$vip['subnet']]['interface'] = $vip['interface'];
                        $oldvips[$vip['subnet']]['subnet'] = $vip['subnet'];
                    } else {
                        if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(substr($vip['interface'], 0, 4) == '_vip') || strpos($vip['interface'], "lo0")) {
                            $vipbackup[] = $vip;
                        }
                    }
                }
            }
        }
    }
    // For vip section, first keep items sent from the master
    $config = array_merge_recursive_unique($config, $params[0]);
    /* Then add ipalias and proxyarp types already defined on the backup */
    if (is_array($vipbackup) && !empty($vipbackup)) {
        if (!is_array($config['virtualip'])) {
            $config['virtualip'] = array();
        }
        if (!is_array($config['virtualip']['vip'])) {
            $config['virtualip']['vip'] = array();
        }
        foreach ($vipbackup as $vip) {
            array_unshift($config['virtualip']['vip'], $vip);
        }
    }
    /* Log what happened */
    $mergedkeys = implode(",", array_merge(array_keys($params[0]), $sync_full_done));
    write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
    /*
     * The real work on handling the vips specially
     * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps
     */
    if (isset($params[0]['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
        $carp_setuped = false;
        $anyproxyarp = false;
        foreach ($config['virtualip']['vip'] as $vip) {
            if ($vip['mode'] == "carp" && isset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"])) {
                if ($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['content'] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") {
                    if (does_vip_exist($vip)) {
                        unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]);
                        continue;
                        // Skip reconfiguring this vips since nothing has changed.
                    }
                }
            } else {
                if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip") && isset($oldvips[$vip['subnet']])) {
                    if ($oldvips[$vip['subnet']]['content'] == "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") {
                        if (does_vip_exist($vip)) {
                            unset($oldvips[$vip['subnet']]);
                            continue;
                            // Skip reconfiguring this vips since nothing has changed.
                        }
                    }
                    unset($oldvips[$vip['subnet']]);
                }
            }
            switch ($vip['mode']) {
                case "proxyarp":
                    $anyproxyarp = true;
                    break;
                case "ipalias":
                    interface_ipalias_configure($vip);
                    break;
                case "carp":
                    if ($carp_setuped == false) {
                        $carp_setuped = true;
                    }
                    interface_carp_configure($vip);
                    break;
            }
        }
        /* Cleanup remaining old carps */
        foreach ($oldvips as $oldvipar) {
            $oldvipif = get_real_interface($oldvipar['interface']);
            if (!empty($oldvipif)) {
                if (is_ipaddrv6($oldvipar['subnet'])) {
                    mwexec("/sbin/ifconfig " . escapeshellarg($oldvipif) . " inet6 " . escapeshellarg($oldvipar['subnet']) . " delete");
                } else {
                    pfSense_interface_deladdress($oldvipif, $oldvipar['subnet']);
                }
            }
        }
        if ($carp_setuped == true) {
            interfaces_sync_setup();
        }
        if ($anyproxyarp == true) {
            interface_proxyarp_configure();
        }
    }
    if ($old_ipsec_enabled !== ipsec_enabled()) {
        vpn_ipsec_configure();
    }
    unset($old_config);
    return $xmlrpc_g['return']['true'];
}
开发者ID:michaeleino,项目名称:pfsense,代码行数:101,代码来源:xmlrpc.php

示例3: 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

示例4: restore_config_section


//.........这里部分代码省略.........
                     $oldvips[$vip['subnet']]['content'] = $vip['interface'] . $vip['subnet'] . $vip['subnet_bits'];
                     $oldvips[$vip['subnet']]['interface'] = $vip['interface'];
                     $oldvips[$vip['subnet']]['subnet'] = $vip['subnet'];
                 } else {
                     if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(substr($vip['interface'], 0, 4) == '_vip') || strstr($vip['interface'], "lo0")) {
                         $vipbackup[] = $vip;
                     }
                 }
             }
         }
     }
     /* For vip section, first keep items sent from the master */
     $config = array_merge_recursive_unique($config, $sections);
     /*
      * Then add ipalias and proxyarp types already defined
      * on the backup
      */
     if (is_array($vipbackup) && !empty($vipbackup)) {
         if (!is_array($config['virtualip'])) {
             $config['virtualip'] = array();
         }
         if (!is_array($config['virtualip']['vip'])) {
             $config['virtualip']['vip'] = array();
         }
         foreach ($vipbackup as $vip) {
             array_unshift($config['virtualip']['vip'], $vip);
         }
     }
     /* Log what happened */
     $mergedkeys = implode(",", array_merge(array_keys($sections), $syncd_full_sections));
     write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
     /*
      * The real work on handling the vips specially
      * This is a copy of intefaces_vips_configure with addition of
      * not reloading existing/not changed carps
      */
     if (isset($sections['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
         $carp_setuped = false;
         $anyproxyarp = false;
         foreach ($config['virtualip']['vip'] as $vip) {
             $key = "{$vip['interface']}_vip{$vip['vhid']}";
             if ($vip['mode'] == "carp" && isset($oldvips[$key])) {
                 if ($oldvips[$key]['content'] == $vip['password'] . $vip['advskew'] . $vip['subnet'] . $vip['subnet_bits'] . $vip['advbase'] && does_vip_exist($vip)) {
                     unset($oldvips[$key]);
                     /*
                      * Skip reconfiguring this vips
                      * since nothing has changed.
                      */
                     continue;
                 }
             } elseif ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip") && isset($oldvips[$vip['subnet']])) {
                 $key = $vip['subnet'];
                 if ($oldvips[$key]['content'] == $vip['interface'] . $vip['subnet'] . $vip['subnet_bits'] && does_vip_exist($vip)) {
                     unset($oldvips[$key]);
                     /*
                      * Skip reconfiguring this vips
                      * since nothing has changed.
                      */
                     continue;
                 }
                 unset($oldvips[$key]);
             }
             switch ($vip['mode']) {
                 case "proxyarp":
                     $anyproxyarp = true;
                     break;
                 case "ipalias":
                     interface_ipalias_configure($vip);
                     break;
                 case "carp":
                     $carp_setuped = true;
                     interface_carp_configure($vip);
                     break;
             }
         }
         /* Cleanup remaining old carps */
         foreach ($oldvips as $oldvipar) {
             $oldvipif = get_real_interface($oldvipar['interface']);
             if (empty($oldvipif)) {
                 continue;
             }
             if (is_ipaddrv6($oldvipar['subnet'])) {
                 mwexec("/sbin/ifconfig " . escapeshellarg($oldvipif) . " inet6 " . escapeshellarg($oldvipar['subnet']) . " delete");
             } else {
                 pfSense_interface_deladdress($oldvipif, $oldvipar['subnet']);
             }
         }
         if ($carp_setuped == true) {
             interfaces_sync_setup();
         }
         if ($anyproxyarp == true) {
             interface_proxyarp_configure();
         }
     }
     if ($old_ipsec_enabled !== ipsec_enabled()) {
         vpn_ipsec_configure();
     }
     unset($old_config);
     return true;
 }
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:101,代码来源:xmlrpc.php

示例5: restore_config_section_xmlrpc


//.........这里部分代码省略.........
        }
    }
    $vipbackup = array();
    $oldvips = array();
    if (isset($params[0]['virtualip'])) {
        if (is_array($config['virtualip']['vip'])) {
            foreach ($config['virtualip']['vip'] as $vipindex => $vip) {
                if ($vip['mode'] == "carp") {
                    $oldvips["{$vip['interface']}_vip{$vip['vhid']}"] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}";
                } else {
                    if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip")) {
                        $oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
                    } else {
                        if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !strstr($vip['interface'], "_vip")) {
                            $vipbackup[] = $vip;
                        }
                    }
                }
            }
        }
    }
    // For vip section, first keep items sent from the master
    $config = array_merge_recursive_unique($config, $params[0]);
    /* Then add ipalias and proxyarp types already defined on the backup */
    if (is_array($vipbackup) && !empty($vipbackup)) {
        if (!is_array($config['virtualip'])) {
            $config['virtualip'] = array();
        }
        if (!is_array($config['virtualip']['vip'])) {
            $config['virtualip']['vip'] = array();
        }
        foreach ($vipbackup as $vip) {
            array_unshift($config['virtualip']['vip'], $vip);
        }
    }
    /* Log what happened */
    $mergedkeys = implode(",", array_merge(array_keys($params[0]), $sync_full_done));
    write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
    /* 
     * The real work on handling the vips specially
     * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps
     */
    if (isset($params[0]['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
        $carp_setuped = false;
        $anyproxyarp = false;
        foreach ($config['virtualip']['vip'] as $vip) {
            if ($vip['mode'] == "carp" && isset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"])) {
                if ($oldvips["{$vip['interface']}_vip{$vip['vhid']}"] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") {
                    if (does_vip_exist($vip)) {
                        unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]);
                        continue;
                        // Skip reconfiguring this vips since nothing has changed.
                    }
                }
                unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]);
            } else {
                if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip") && isset($oldvips[$vip['subnet']])) {
                    if ($oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") {
                        if (does_vip_exist($vip)) {
                            unset($oldvips[$vip['subnet']]);
                            continue;
                            // Skip reconfiguring this vips since nothing has changed.
                        }
                    }
                    unset($oldvips[$vip['subnet']]);
                }
            }
            switch ($vip['mode']) {
                case "proxyarp":
                    $anyproxyarp = true;
                    break;
                case "ipalias":
                    interface_ipalias_configure(&$vip);
                    break;
                case "carp":
                    if ($carp_setuped == false) {
                        $carp_setuped = true;
                    }
                    interface_carp_configure($vip);
                    break;
                case "carpdev-dhcp":
                    interface_carpdev_configure($vip);
                    break;
            }
        }
        /* Cleanup remaining old carps */
        foreach ($oldvips as $oldvipif => $oldvippar) {
            if (!is_ipaddr($oldvipif) && does_interface_exist($oldvipif)) {
                pfSense_interface_destroy($oldvipif);
            }
        }
        if ($carp_setuped == true) {
            interfaces_carp_setup();
        }
        if ($anyproxyarp == true) {
            interface_proxyarp_configure();
        }
    }
    return $xmlrpc_g['return']['true'];
}
开发者ID:rdmenezes,项目名称:pfsense,代码行数:101,代码来源:xmlrpc.php


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