function get_ipsec_tunnel_src($tunnel) { global $g, $config, $sad; $if = "WAN"; if ($tunnel['interface']) { $if = $tunnel['interface']; $realinterface = convert_friendly_interface_to_real_interface_name($if); $interfaceip = find_interface_ip($realinterface); } return $interfaceip; }
$pools = remove_duplicate($pools, "name"); asort($pools); } // Put this in an easy to use form $dhcpmac = array(); $dhcpip = array(); foreach ($leases as $value) { $dhcpmac[$value['mac']] = $value['hostname']; $dhcpip[$value['ip']] = $value['hostname']; } exec("/usr/sbin/arp -an", $rawdata); $i = 0; /* if list */ $ifdescrs = get_configured_interface_with_descr(); foreach ($ifdescrs as $key => $interface) { $thisif = convert_friendly_interface_to_real_interface_name($key); if (!empty($thisif)) { $hwif[$thisif] = $interface; } } $data = array(); foreach ($rawdata as $line) { $elements = explode(' ', $line); if ($elements[3] != "(incomplete)") { $arpent = array(); $arpent['ip'] = trim(str_replace(array('(', ')'), '', $elements[1])); $arpent['mac'] = trim($elements[3]); $arpent['interface'] = trim($elements[5]); $data[] = $arpent; } }
foreach ($hosts as $h) { $h = fixup_host($h, $hostcount++); if (!empty($h)) { $hostmatch .= " " . $h; } } if (!empty($hostmatch)) { $matches[] = "({$hostmatch})"; } } if ($count != "0") { $searchcount = "-c " . $count; } else { $searchcount = ""; } $selectedif = convert_friendly_interface_to_real_interface_name($selectedif); if ($action == gettext("Start")) { $matchstr = implode($matches, " and "); print_info_box(gettext('Packet Capture is running'), 'info'); $cmd = "/usr/sbin/tcpdump -i {$selectedif} {$disablepromiscuous} {$searchcount} -s {$snaplen} -w {$fp}{$fn} " . escapeshellarg($matchstr); // Debug //echo $cmd; mwexec_bg($cmd); } else { ?> <div class="panel panel-default"> <div class="panel-heading"><h2 class="panel-title"><?php echo gettext('Packets Captured'); ?> </h2></div>
echo $ifinfo['bridge']; ?> </td> </tr> <?php } ?> <?php if (file_exists("/usr/bin/vmstat")) { ?> <?php $real_interface = ""; $interrupt_total = ""; $interrupt_sec = ""; $real_interface = convert_friendly_interface_to_real_interface_name($ifname); $interrupt_total = `vmstat -i | grep {$real_interface} | awk '{ print \$3 }'`; $interrupt_sec = `vmstat -i | grep {$real_interface} | awk '{ print \$4 }'`; if (strstr($interrupt_total, "hci")) { $interrupt_total = `vmstat -i | grep {$real_interface} | awk '{ print \$4 }'`; $interrupt_sec = `vmstat -i | grep {$real_interface} | awk '{ print \$5 }'`; } $interrupt_total = ""; ?> <?php if ($interrupt_total) { ?> <tr> <td width="22%" class="vncellt">Kesmeler/Saniye</td> <td width="78%" class="listr"> <?php
?> )" id="frd<?php echo $nnats; ?> " ondblclick="document.location='firewall_nat_edit.php?id=<?php echo $nnats; ?> ';"> <?php echo $natent['target']; ?> <?php if ($natent['external-address']) { echo "<br>(ext.: " . $natent['external-address'] . ")"; } else { echo "<br>(ext.: " . find_interface_ip(convert_friendly_interface_to_real_interface_name($natent['interface'])) . ")"; } ?> </td> <td class="listr" onClick="fr_toggle(<?php echo $nnats; ?> )" id="frd<?php echo $nnats; ?> " ondblclick="document.location='firewall_nat_edit.php?id=<?php echo $nnats; ?> ';"> <?php if (!$endport || $beginport == $endport) {
<?php foreach ($periods as $period => $interval) { /* check which databases are valid for our category */ foreach ($databases as $curdatabase) { if (!stristr($curdatabase, $curcat)) { continue; } $optionc = split("-", $curdatabase); $search = array("-", ".rrd", $optionc); $replace = array(" :: ", "", $friendly); switch ($curoption) { case "outbound": /* only show interfaces with a gateway */ $optionc = "{$optionc['0']}"; $friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc)); $realif = convert_friendly_interface_to_real_interface_name(strtolower($optionc)); $monitorip = get_interface_gateway(strtolower($optionc)); if ($monitorip == "") { continue 2; } if (!stristr($curdatabase, $optionc)) { continue 2; } break; case "allgraphs": /* make sure we do not show the placeholder databases in the all view */ if (stristr($curdatabase, "outbound") || stristr($curdatabase, "allgraphs")) { continue 2; } break; default:
function sqstat_get_real_interface_address($iface) { global $config; $iface = convert_friendly_interface_to_real_interface_name($iface); $line = trim(shell_exec("ifconfig {$iface} | grep inet | grep -v inet6")); list($dummy, $ip, $dummy2, $netmask) = explode(" ", $line); return array($ip, long2ip(hexdec($netmask))); }