Example #1
0
function find_ip_interface($ip, $bits = null)
{
    if (!is_ipaddr($ip)) {
        return false;
    }
    $isv6ip = is_ipaddrv6($ip);
    /* if list */
    $ifdescrs = get_configured_interface_list();
    foreach ($ifdescrs as $ifdescr => $ifname) {
        $ifip = $isv6ip ? get_interface_ipv6($ifname) : get_interface_ip($ifname);
        if (is_null($ifip)) {
            continue;
        }
        if (is_null($bits)) {
            if ($ip == $ifip) {
                $int = get_real_interface($ifname);
                return $int;
            }
        } else {
            if (ip_in_subnet($ifip, $ip . "/" . $bits)) {
                $int = get_real_interface($ifname);
                return $int;
            }
        }
    }
    return false;
}
         $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:
     if ($_POST['interface'] == 'lo0') {
         $input_errors[] = gettext("For this type of vip localhost is not allowed.");
     } else {
Example #3
0
?>
">
				</td>
				</tr>
				<tr>
				<td valign="top" colspan="2">
				<? if ($do_ping) {
					echo "<font face='terminal' size='2'>";
					echo "<strong>" . gettext("Ping output") . ":</strong><br>";
					echo('<pre>');
					$ifaddr = get_interface_ip($interface);
					if ($ifaddr)
						system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
					else
						system("/sbin/ping -c$count " . escapeshellarg($host));
					$ifaddr = get_interface_ipv6($interface);
					if ($ifaddr)
						system("/sbin/ping6 -S$ifaddr -c$count " . escapeshellarg($host));
					else
						system("/sbin/ping6 -c$count " . escapeshellarg($host));
					
					echo('</pre>');
				}
				?>
				</td>
				</tr>
				<tr>
				  <td width="22%" valign="top">&nbsp;</td>
				  <td width="78%"> 
				 </td>
				</tr>			
Example #4
0
 /* 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 (is_ipaddrv6($a_vip[$_GET['id']]['subnet'])) {
     $is_ipv6 = true;
     $subnet = gen_subnetv6($a_vip[$_GET['id']]['subnet'], $a_vip[$_GET['id']]['subnet_bits']);
     $if_subnet_bits = get_interface_subnetv6($a_vip[$_GET['id']]['interface']);
     $if_subnet = gen_subnetv6(get_interface_ipv6($a_vip[$_GET['id']]['interface']), $if_subnet_bits);
 } else {
     $is_ipv6 = false;
     $subnet = gen_subnet($a_vip[$_GET['id']]['subnet'], $a_vip[$_GET['id']]['subnet_bits']);
     $if_subnet_bits = get_interface_subnet($a_vip[$_GET['id']]['interface']);
     $if_subnet = gen_subnet(get_interface_ip($a_vip[$_GET['id']]['interface']), $if_subnet_bits);
 }
 $subnet .= "/" . $a_vip[$_GET['id']]['subnet_bits'];
 $if_subnet .= "/" . $if_subnet_bits;
 if (is_array($config['gateways']['gateway_item'])) {
     foreach ($config['gateways']['gateway_item'] as $gateway) {
         if ($a_vip[$_GET['id']]['interface'] != $gateway['interface']) {
             continue;
         }
         if ($is_ipv6 && $gateway['ipprotocol'] == 'inet') {
             continue;
Example #5
0
        $cached_ip_s = explode("|", file_get_contents($filename));
        $cached_ip = $cached_ip_s[0];
        if ($ipaddr != $cached_ip) {
            print '<span class="text-danger">';
        } else {
            print '<span class="text-success">';
        }
        print htmlspecialchars($cached_ip);
        print '</span>';
    } else {
        print 'IPv4: N/A';
    }
    print '<br />';
    if (file_exists("{$filename}.ipv6")) {
        print 'IPv6: ';
        $ipaddr = get_interface_ipv6($rfc2136['interface']);
        $cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
        $cached_ip = $cached_ip_s[0];
        if ($ipaddr != $cached_ip) {
            print '<span class="text-danger">';
        } else {
            print '<span class="text-success">';
        }
        print htmlspecialchars($cached_ip);
        print '</span>';
    } else {
        print 'IPv6: N/A';
    }
    ?>
					</td>
					<td>
Example #6
0
    $filename = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
    $filename_v6 = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
    if (file_exists($filename)) {
        $ipaddr = dyndnsCheckIP($dyndns['interface']);
        $cached_ip_s = explode(":", file_get_contents($filename));
        $cached_ip = $cached_ip_s[0];
        if ($ipaddr != $cached_ip) {
            echo "<font color='red'>";
        } else {
            echo "<font color='green'>";
        }
        echo htmlspecialchars($cached_ip);
        echo "</font>";
    } else {
        if (file_exists($filename_v6)) {
            $ipv6addr = get_interface_ipv6($dyndns['interface']);
            $cached_ipv6_s = explode("|", file_get_contents($filename_v6));
            $cached_ipv6 = $cached_ipv6_s[0];
            if ($ipv6addr != $cached_ipv6) {
                echo "<font color='red'>";
            } else {
                echo "<font color='green'>";
            }
            echo htmlspecialchars($cached_ipv6);
            echo "</font>";
        } else {
            echo "N/A";
        }
    }
    ?>
										  </td>
Example #7
0
function build_interface_list()
{
    global $pconfig;
    $iflist = array('options' => array(), 'selected' => array());
    $interfaces = get_configured_interface_with_descr();
    foreach ($interfaces as $iface => $ifacename) {
        if (!is_ipaddr(get_interface_ip($iface)) && !is_ipaddrv6(get_interface_ipv6($iface))) {
            continue;
        }
        $iflist['options'][$iface] = $ifacename;
        if (in_array($iface, $pconfig['interface'])) {
            array_push($iflist['selected'], $iface);
        }
    }
    return $iflist;
}
##|+PRIV
##|*IDENT=page-services-dhcpv6relay
##|*NAME=Services: DHCPv6 Relay
##|*DESCR=Allow access to the 'Services: DHCPv6 Relay' page.
##|*MATCH=services_dhcpv6_relay.php*
##|-PRIV
require "guiconfig.inc";
$pconfig['enable'] = isset($config['dhcrelay6']['enable']);
if (empty($config['dhcrelay6']['interface'])) {
    $pconfig['interface'] = array();
} else {
    $pconfig['interface'] = explode(",", $config['dhcrelay6']['interface']);
}
$pconfig['agentoption'] = isset($config['dhcrelay6']['agentoption']);
$iflist = array_intersect_key(get_configured_interface_with_descr(), array_flip(array_filter(array_keys(get_configured_interface_with_descr()), function ($if) {
    return is_ipaddrv6(get_interface_ipv6($if));
})));
/*   set the enabled flag which will tell us if DHCP server is enabled
 *   on any interface.   We will use this to disable dhcp-relay since
 *   the two are not compatible with each other.
 */
$dhcpd_enabled = false;
if (is_array($config['dhcpdv6'])) {
    foreach ($config['dhcpdv6'] as $dhcp) {
        if (isset($dhcp['enable']) && isset($config['interfaces'][$dhcpif]['enable'])) {
            $dhcpd_enabled = true;
            break;
        }
    }
}
if ($_POST) {
Example #9
0
         }
         $found = false;
         foreach ($subnets as $subnet) {
             if (ip_in_subnet($pconfig['gateway'], $subnet)) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             $input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within one of the chosen interface's subnets."), $pconfig['gateway']);
         }
     }
 } elseif (is_ipaddrv6($pconfig['gateway'])) {
     /* do not do a subnet match on a link local address, it's valid */
     if (!is_linklocal($pconfig['gateway'])) {
         $parent_ip = get_interface_ipv6($pconfig['interface']);
         $parent_sn = get_interface_subnetv6($pconfig['interface']);
         if (empty($parent_ip) || empty($parent_sn)) {
             $input_errors[] = gettext("Cannot add IPv6 Gateway Address because no IPv6 address could be found on the interface.");
         } else {
             $subnets = array(gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn);
             $vips = link_interface_to_vips($pconfig['interface']);
             if (is_array($vips)) {
                 foreach ($vips as $vip) {
                     if (!is_ipaddrv6($vip['subnet'])) {
                         continue;
                     }
                     $subnets[] = gen_subnetv6($vip['subnet'], $vip['subnet_bits']) . "/" . $vip['subnet_bits'];
                 }
             }
             $found = false;
Example #10
0
     $nc_args .= " -6";
 } else {
     switch ($ipprotocol) {
         case "ipv4":
             $ifaddr = get_interface_ip($sourceip);
             $nc_ipproto = " -4";
             break;
         case "ipv6":
             $ifaddr = is_linklocal($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
             $nc_ipproto = " -6";
             break;
         case "any":
             $ifaddr = get_interface_ip($sourceip);
             $nc_ipproto = !empty($ifaddr) ? " -4" : "";
             if (empty($ifaddr)) {
                 $ifaddr = is_linklocal($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
                 $nc_ipproto = !empty($ifaddr) ? " -6" : "";
             }
             break;
     }
     /* Netcat doesn't like it if we try to connect using a certain type of IP without specifying the family. */
     if (!empty($ifaddr)) {
         $nc_args .= $nc_ipproto;
     } elseif ($sourceip == "any") {
         switch ($ipprotocol) {
             case "ipv4":
                 $nc_ipproto = " -4";
                 break;
             case "ipv6":
                 $nc_ipproto = " -6";
                 break;
        $cached_ip_s = explode("|", file_get_contents($filename));
        $cached_ip = $cached_ip_s[0];
        if ($ipaddr != $cached_ip) {
            print '<span class="text-danger">';
        } else {
            print '<span class="text-success">';
        }
        print htmlspecialchars($cached_ip);
        print '</span>';
    } else {
        print 'IPv4: N/A';
    }
    print '<br />';
    if (file_exists("{$filename}.ipv6")) {
        print 'IPv6: ';
        $ipaddr = get_interface_ipv6($if);
        $cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
        $cached_ip = $cached_ip_s[0];
        if ($ipaddr != $cached_ip) {
            print '<span class="text-danger">';
        } else {
            print '<span class="text-success">';
        }
        print htmlspecialchars($cached_ip);
        print '</span>';
    } else {
        print 'IPv6: N/A';
    }
    ?>
					</td>
					<td>
/**
 * 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;
}
Example #13
0
 }
 if (count($input_errors) == 0) {
     $nc_args = "-w 10";
     if (empty($pconfig['showtext'])) {
         $nc_args .= " -z ";
     }
     if (!empty($pconfig['srcport'])) {
         $nc_args .= " -p " . escapeshellarg($pconfig['srcport']) . " ";
     }
     switch ($pconfig['ipprotocol']) {
         case "ipv4":
             $ifaddr = $pconfig['sourceip'] == "any" ? "" : get_interface_ip($pconfig['sourceip']);
             $nc_args .= " -4";
             break;
         case "ipv6":
             $ifaddr = is_linklocal($pconfig['sourceip']) ? $pconfig['sourceip'] : get_interface_ipv6($pconfig['sourceip']);
             $nc_args .= " -6";
             break;
     }
     if (!empty($ifaddr)) {
         $nc_args .= " -s " . escapeshellarg($ifaddr) . " ";
         $scope = get_ll_scope($ifaddr);
         if (!empty($scope) && !strstr($host, "%")) {
             $host .= "%{$scope}";
         }
     }
     $cmd_action = "/usr/bin/nc {$nc_args} " . escapeshellarg($pconfig['host']) . " " . escapeshellarg($pconfig['port']) . " 2>&1";
     $process = proc_open($cmd_action, array(array("pipe", "r"), array("pipe", "w"), array("pipe", "w")), $pipes);
     if (is_resource($process)) {
         $cmd_output = stream_get_contents($pipes[1]);
         $cmd_output .= stream_get_contents($pipes[2]);
Example #14
0
    $host = trim($pconfig['host']);
    $ipproto = $pconfig['ipproto'];
    if ($pconfig['ipproto'] == "ipv4" && is_ipaddrv6($host)) {
        $input_errors[] = gettext("When using IPv4, the target host must be an IPv4 address or hostname.");
    } elseif ($pconfig['ipproto'] == "ipv6" && is_ipaddrv4($host)) {
        $input_errors[] = gettext("When using IPv6, the target host must be an IPv6 address or hostname.");
    }
    if (count($input_errors) == 0) {
        $cmd_args = "-w 2";
        $cmd_args .= !empty($pconfig['useicmp']) ? " -I " : "";
        $cmd_args .= !empty($pconfig['resolve']) ? "" : " -n ";
        $cmd_args .= " -m " . escapeshellarg($pconfig['ttl']);
        $command = "/usr/sbin/traceroute";
        if ($pconfig['ipproto'] == "ipv6") {
            $command .= "6";
            $ifaddr = is_ipaddr($pconfig['sourceip']) ? $pconfig['sourceip'] : get_interface_ipv6($pconfig['sourceip']);
        } else {
            $ifaddr = is_ipaddr($pconfig['sourceip']) ? $pconfig['sourceip'] : get_interface_ip($pconfig['sourceip']);
        }
        if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
            $cmd_args .= " -s " . escapeshellarg($ifaddr) . " ";
        }
        $cmd_action = "{$command} {$cmd_args} " . " " . escapeshellarg($host);
        $process = proc_open($cmd_action, array(array("pipe", "r"), array("pipe", "w"), array("pipe", "w")), $pipes);
        if (is_resource($process)) {
            $cmd_output = stream_get_contents($pipes[2]);
            $cmd_output .= stream_get_contents($pipes[1]);
        }
    }
}
legacy_html_escape_form_data($pconfig);
Example #15
0
     $pconfig['shared_key'] = openvpn_create_key();
 }
 // all input validators
 if (strpos($pconfig['interface'], '|') !== false) {
     list($iv_iface, $iv_ip) = explode("|", $pconfig['interface']);
 } else {
     $iv_iface = $pconfig['interface'];
     $iv_ip = null;
 }
 if (is_ipaddrv4($iv_ip) && stristr($pconfig['protocol'], "6") !== false) {
     $input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv6 protocol and an IPv4 IP address.");
 } elseif (is_ipaddrv6($iv_ip) && stristr($pconfig['protocol'], "6") === false) {
     $input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv4 protocol and an IPv6 IP address.");
 } elseif (stristr($pconfig['protocol'], "6") === false && !get_interface_ip($iv_iface) && $pconfig['interface'] != "any") {
     $input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address.");
 } elseif (stristr($pconfig['protocol'], "6") !== false && !get_interface_ipv6($iv_iface) && $pconfig['interface'] != "any") {
     $input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address.");
 }
 if (empty($pconfig['authmode']) && ($pconfig['mode'] == "server_user" || $pconfig['mode'] == "server_tls_user")) {
     $input_errors[] = gettext("You must select a Backend for Authentication if the server mode requires User Auth.");
 }
 if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port')) {
     $input_errors[] = $result;
 }
 if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4")) {
     $input_errors[] = $result;
 }
 if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6")) {
     $input_errors[] = $result;
 }
 if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4")) {
}
require "guiconfig.inc";
$if = $_GET['if'];
if ($_POST['if']) {
    $if = $_POST['if'];
}
if (!$if) {
    header("Location: services_dhcpv6.php");
    exit;
}
if (!is_array($config['dhcpdv6'][$if]['staticmap'])) {
    $config['dhcpdv6'][$if]['staticmap'] = array();
}
$netboot_enabled = isset($config['dhcpdv6'][$if]['netboot']);
$a_maps =& $config['dhcpdv6'][$if]['staticmap'];
$ifcfgipv6 = get_interface_ipv6($if);
$ifcfgsnv6 = get_interface_subnetv6($if);
$ifcfgdescr = convert_friendly_interface_to_friendly_descr($if);
$id = $_GET['id'];
if (isset($_POST['id'])) {
    $id = $_POST['id'];
}
if (isset($id) && $a_maps[$id]) {
    $pconfig['duid'] = $a_maps[$id]['duid'];
    $pconfig['hostname'] = $a_maps[$id]['hostname'];
    $pconfig['ipaddrv6'] = $a_maps[$id]['ipaddrv6'];
    $pconfig['filename'] = $a_maps[$id]['filename'];
    $pconfig['rootpath'] = $a_maps[$id]['rootpath'];
    $pconfig['descr'] = $a_maps[$id]['descr'];
} else {
    $pconfig['duid'] = $_GET['duid'];
Example #17
0
 }
 $entered_localid_data = ipsec_idinfo_to_cidr($entered_local, false, $pconfig['mode']);
 list($entered_local_network, $entered_local_mask) = explode('/', $entered_localid_data);
 $entered_remote = array();
 $entered_remote['type'] = $pconfig['remoteid_type'];
 if (isset($pconfig['remoteid_address'])) {
     $entered_remote['address'] = $pconfig['remoteid_address'];
 }
 if (isset($pconfig['remoteid_netbits'])) {
     $entered_remote['netbits'] = $pconfig['remoteid_netbits'];
 }
 $entered_remoteid_data = ipsec_idinfo_to_cidr($entered_remote, false, $pconfig['mode']);
 list($entered_remote_network, $entered_remote_mask) = explode('/', $entered_remoteid_data);
 if ($phase1['protocol'] == "inet6") {
     $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.");
Example #18
0
                    <header class="content-box-head container-fluid">
				        <h3><?=gettext("Traceroute output"); ?></h3>
				    </header>

					<div class="content-box-main col-xs-12">
						<pre>

<?php

							$useicmp = isset($_REQUEST['useicmp']) ? "-I" : "";
							$n = isset($resolve) ? "" : "-n";

							$command = "/usr/sbin/traceroute";
							if ($ipproto == "ipv6") {
								$command .= "6";
								$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
							} else {
								$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
							}

							if ($ifaddr && (is_ipaddr($host) || is_hostname($host)))
								$srcip = "-s " . escapeshellarg($ifaddr);

							$cmd = "{$command} {$n} {$srcip} -w 2 {$useicmp} -m " . escapeshellarg($ttl) . " " . escapeshellarg($host);

							//echo "Traceroute command: {$cmd}\n";
							system($cmd);

?>
						</pre>
					</div>
Example #19
0
							                          <strong><?php 
    printf(gettext("Enable DHCPv6 relay on interface"));
    ?>
</strong>
										</td>
									</tr>
									<tr>
                                      <td width="22%" valign="top" class="vncellreq"><?php 
    echo gettext('Interface(s)');
    ?>
</td>
							                        <td width="78%" class="vtable">
											<select id="interface" name="interface[]" multiple="multiple" class="formselect" size="3">
										<?php 
    foreach ($iflist as $ifent => $ifdesc) {
        if (!is_ipaddrv6(get_interface_ipv6($ifent))) {
            continue;
        }
        echo "<option value=\"{$ifent}\"";
        if (!empty($pconfig['interface']) && in_array($ifent, $pconfig['interface'])) {
            echo " selected=\"selected\"";
        }
        echo ">{$ifdesc}</option>\n";
    }
    ?>
							                                </select>
											<br /><?php 
    echo gettext("Interfaces without an IPv6 address will not be shown.");
    ?>
										</td>
									</tr>