function interface_assign_description($portinfo, $portname) { global $ovpn_descrs; if ($portinfo['isvlan']) { $descr = sprintf(gettext('VLAN %1$s on %2$s'), $portinfo['tag'], $portinfo['if']); $iface = convert_real_interface_to_friendly_interface_name($portinfo['if']); if (isset($iface) && strlen($iface) > 0) { $descr .= " - {$iface}"; } if ($portinfo['descr']) { $descr .= " (" . $portinfo['descr'] . ")"; } } elseif ($portinfo['iswlclone']) { $descr = $portinfo['cloneif']; if ($portinfo['descr']) { $descr .= " (" . $portinfo['descr'] . ")"; } } elseif ($portinfo['isppp']) { $descr = $portinfo['descr']; } elseif ($portinfo['isbridge']) { $descr = strtoupper($portinfo['bridgeif']); if ($portinfo['descr']) { $descr .= " (" . $portinfo['descr'] . ")"; } } elseif ($portinfo['isgre']) { $descr = "GRE {$portinfo['remote-addr']}"; if ($portinfo['descr']) { $descr .= " (" . $portinfo['descr'] . ")"; } } elseif ($portinfo['isgif']) { $descr = "GIF {$portinfo['remote-addr']}"; if ($portinfo['descr']) { $descr .= " (" . $portinfo['descr'] . ")"; } } elseif ($portinfo['islagg']) { $descr = strtoupper($portinfo['laggif']); if ($portinfo['descr']) { $descr .= " (" . $portinfo['descr'] . ")"; } } elseif ($portinfo['isqinq']) { $descr = $portinfo['descr']; } elseif (substr($portname, 0, 4) == 'ovpn') { $descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")"; } else { $descr = $portname . " (" . $portinfo['mac'] . ")"; } return htmlspecialchars($descr); }
if (substr($wancfg['if'], 0, 3) == 'gif') { $min_mtu = 1280; $max_mtu = 8192; } else { $min_mtu = 576; $max_mtu = 9000; } if ($_POST['mtu'] < $min_mtu || $_POST['mtu'] > $max_mtu) { $input_errors[] = sprintf(gettext("The MTU must be between %d and %d bytes."), $min_mtu, $max_mtu); } unset($min_mtu, $max_mtu); if (stristr($wancfg['if'], "_vlan")) { $realhwif_array = get_parent_interface($wancfg['if']); // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling $parent_realhwif = $realhwif_array[0]; $parent_if = convert_real_interface_to_friendly_interface_name($parent_realhwif); if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) { if ($_POST['mtu'] > intval($config['interfaces'][$parent_if]['mtu'])) { $input_errors[] = gettext("The MTU of a VLAN cannot be greater than that of its parent interface."); } } } else { foreach ($config['interfaces'] as $idx => $ifdata) { if ($idx == $if || !preg_match('/_vlan[0-9]/', $ifdata['if'])) { continue; } $realhwif_array = get_parent_interface($ifdata['if']); // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling $parent_realhwif = $realhwif_array[0]; if ($parent_realhwif != $wancfg['if']) { continue;
} if (isset($_POST['autoptp'])) { $bridge['autoptp'] = implode(',', $_POST['autoptp']); } $bridge['bridgeif'] = $_POST['bridgeif']; interface_bridge_configure($bridge); if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge")) { $input_errors[] = gettext("Error occurred creating interface, please retry."); } else { if (isset($id) && $a_bridges[$id]) { $a_bridges[$id] = $bridge; } else { $a_bridges[] = $bridge; } write_config(); $confif = convert_real_interface_to_friendly_interface_name($bridge['bridgeif']); if ($confif != "") { interface_configure($confif); } header("Location: interfaces_bridge.php"); exit; } } } // port list with the exception of assigned bridge interfaces to prevent invalid configs function build_port_list($selecton) { global $config, $ifacelist; $portlist = array('list' => array(), 'selected' => array()); foreach ($ifacelist as $ifn => $ifdescr) { if (substr($config['interfaces'][$ifn]['if'], 0, 6) != "bridge") {
function fixup_string($string) { global $config, $g, $myurl, $title; $newstring = $string; // fixup #1: $myurl -> http[s]://ip_address:port/ switch ($config['system']['webgui']['protocol']) { case "http": $proto = "http"; break; case "https": $proto = "https"; break; default: $proto = "http"; break; } $port = $config['system']['webgui']['port']; if ($port != "") { if ($port == "443" and $proto != "https" or $port == "80" and $proto != "http") { $urlport = ":" . $port; } elseif ($port != "80" and $port != "443") { $urlport = ":" . $port; } else { $urlport = ""; } } $http_host = explode(":", $_SERVER['HTTP_HOST']); $http_host = $http_host[0]; $urlhost = $http_host; // If finishing the setup wizard, check if accessing on a LAN or WAN address that changed if ($title == "Reload in progress") { if (is_ipaddr($urlhost)) { $host_if = find_ip_interface($urlhost); if ($host_if) { $host_if = convert_real_interface_to_friendly_interface_name($host_if); if ($host_if && is_ipaddr($config['interfaces'][$host_if]['ipaddr'])) { $urlhost = $config['interfaces'][$host_if]['ipaddr']; } } } else { if ($urlhost == $config['system']['hostname']) { $urlhost = $config['wizardtemp']['system']['hostname']; } else { if ($urlhost == $config['system']['hostname'] . '.' . $config['system']['domain']) { $urlhost = $config['wizardtemp']['system']['hostname'] . '.' . $config['wizardtemp']['system']['domain']; } } } } if ($urlhost != $http_host) { file_put_contents("{$g['tmp_path']}/setupwizard_lastreferrer", $proto . "://" . $http_host . $urlport . $_SERVER['REQUEST_URI']); } $myurl = $proto . "://" . $urlhost . $urlport . "/"; if (strstr($newstring, "\$myurl")) { $newstring = str_replace("\$myurl", $myurl, $newstring); } // fixup #2: $wanip if (strstr($newstring, "\$wanip")) { $curwanip = get_interface_ip(); $newstring = str_replace("\$wanip", $curwanip, $newstring); } // fixup #3: $lanip if (strstr($newstring, "\$lanip")) { $lanip = get_interface_ip("lan"); $newstring = str_replace("\$lanip", $lanip, $newstring); } // fixup #4: fix'r'up here. return $newstring; }
$input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."), $iface); } if ($_POST['mru'][$iface] && $_POST['mru'][$iface] < 576) { $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface); } } // Loop through fields associated with an individual link/port and make an array of the data $port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru"); foreach ($_POST['interfaces'] as $iface) { foreach ($port_fields as $field_label) { if (isset($_POST[$field_label . $iface]) && strlen($_POST[$field_label . $iface]) > 0) { $port_data[$field_label][] = $_POST[$field_label . $iface]; $pconfig[$field_label][$iface] = $_POST[$field_label . $iface]; $parent_array = get_parent_interface($iface); $parent = $parent_array[0]; $friendly = convert_real_interface_to_friendly_interface_name($parent); if ($field_label == "mtu" && isset($config['interfaces'][$friendly]['mtu']) && $_POST[$field_label . $iface] > $config['interfaces'][$friendly]['mtu'] - 8) { $input_errors[] = sprintf(gettext("The MTU (%d) is too big for %s (maximum allowed with current settings: %d)."), $_POST[$field_label . $iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8); } } } } } if (!$input_errors) { $ppp = array(); if (!isset($id)) { $ppp['ptpid'] = interfaces_ptpid_next(); } else { $ppp['ptpid'] = $a_ppps[$id]['ptpid']; } $ppp['type'] = $_POST['type'];
<th><?php echo gettext('Actions'); ?> </th> </tr> </thead> <tbody> <?php $i = 0; foreach ($a_vlans as $vlan) { ?> <tr> <td> <?php printf("%s", htmlspecialchars($vlan['if'])); $iface = convert_real_interface_to_friendly_interface_name($vlan['if']); if (isset($iface) && strlen($iface) > 0) { printf(" (%s)", htmlspecialchars($iface)); } ?> </td> <td><?php echo htmlspecialchars($vlan['tag']); ?> </td> <td><?php echo htmlspecialchars($vlan['pcp']); ?> </td> <td><?php echo htmlspecialchars($vlan['descr']);
foreach ($config['qinqs']['qinqentry'] as $qinq) { if ($qinq['tag'] == $_POST['tag'] && $qinq['if'] == $_POST['if']) { $input_errors[] = gettext("A QinQ VLAN exists with this tag please remove it to use this tag with."); } } } if (!$input_errors) { if (isset($id) && $a_vlans[$id]) { if ($a_vlans[$id]['if'] != $_POST['if'] || $a_vlans[$id]['tag'] != $_POST['tag']) { if (!empty($a_vlans[$id]['vlanif'])) { $confif = convert_real_interface_to_friendly_interface_name($vlan['vlanif']); // Destroy previous vlan pfSense_interface_destroy($a_vlans[$id]['vlanif']); } else { pfSense_interface_destroy("{$a_vlans[$id]['if']}_vlan{$a_vlans[$id]['tag']}"); $confif = convert_real_interface_to_friendly_interface_name("{$a_vlans[$id]['if']}_vlan{$a_vlans[$id]['tag']}"); } if ($confif != "") { $config['interfaces'][$confif]['if'] = "{$_POST['if']}_vlan{$_POST['tag']}"; } } } $vlan = array(); $vlan['if'] = $_POST['if']; $vlan['tag'] = $_POST['tag']; $vlan['descr'] = $_POST['descr']; $vlan['vlanif'] = "{$_POST['if']}_vlan{$_POST['tag']}"; $vlan['vlanif'] = interface_vlan_configure($vlan); if ($vlan['vlanif'] == "" || !stristr($vlan['vlanif'], "vlan")) { $input_errors[] = gettext("Error occured creating interface, please retry."); } else {
$gif['remote-addr'] = $_POST['remote-addr']; $gif['descr'] = $_POST['descr']; $gif['link1'] = isset($_POST['link1']); $gif['link0'] = isset($_POST['link0']); $gif['gifif'] = $_POST['gifif']; $gif['gifif'] = interface_gif_configure($gif); if ($gif['gifif'] == "" || !stristr($gif['gifif'], "gif")) { $input_errors[] = gettext("Error occurred creating interface, please retry."); } else { if (isset($id) && $a_gifs[$id]) { $a_gifs[$id] = $gif; } else { $a_gifs[] = $gif; } write_config(); $confif = convert_real_interface_to_friendly_interface_name($gif['gifif']); if ($confif != "") { interface_configure($confif); } header("Location: interfaces_gif.php"); exit; } } } $pgtitle = array(gettext("Interfaces"), gettext("GIF"), gettext("Edit")); $shortcut_section = "interfaces"; include "head.inc"; ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
if (isset($id) && $a_laggs[$id]) { $a_laggs[$id] = $lagg; } else { $a_laggs[] = $lagg; } write_config(); $confif = convert_real_interface_to_friendly_interface_name($lagg['laggif']); if ($confif != "") { interface_configure($confif); } // reconfigure any VLANs with this lagg as their parent if (is_array($config['vlans']['vlan'])) { foreach ($config['vlans']['vlan'] as $vlan) { if ($vlan['if'] == $lagg['laggif']) { interface_vlan_configure($vlan); $confif = convert_real_interface_to_friendly_interface_name($vlan['vlanif']); if ($confif != "") { interface_configure($confif); } } } } header("Location: interfaces_lagg.php"); exit; } } } function build_member_list() { global $pconfig, $portlist, $realifchecklist; $memberlist = array('list' => array(), 'selected' => array());
$lagg['laggif'] = $_POST['laggif']; $lagg['proto'] = $_POST['proto']; if (isset($id) && $a_laggs[$id]) { $lagg['laggif'] = $a_laggs[$id]['laggif']; } $lagg['laggif'] = interface_lagg_configure($lagg); if ($lagg['laggif'] == "" || !stristr($lagg['laggif'], "lagg")) { $input_errors[] = gettext("Error occurred creating interface, please retry."); } else { if (isset($id) && $a_laggs[$id]) { $a_laggs[$id] = $lagg; } else { $a_laggs[] = $lagg; } write_config(); $confif = convert_real_interface_to_friendly_interface_name($lagg['laggif']); if ($confif != "") { interface_configure($confif); } header("Location: interfaces_lagg.php"); exit; } } } include "head.inc"; ?> <body> <?php include "fbegin.inc"; ?>
foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) { if (is_array($dhcpifconf['staticmap'])) { foreach ($dhcpifconf['staticmap'] as $staticent) { if ($data['ip'] == $staticent['ipaddr']) { $data['if'] = $dhcpif; break; } } } /* exit as soon as we have an interface */ if ($data['if'] != "") { break; } } } else { $data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip'])); } echo "<tr>\n"; if ($mappings[$data['iaid'] . $data['duid']]) { $dip = "<br />Routed To: {$mappings[$data['iaid'] . $data['duid']]}"; } echo "<td class=\"listlr\">{$fspans}{$data['prefix']}{$dip}{$fspane}</td>\n"; echo "<td class=\"listr\">{$fspans}{$data['iaid']}{$fspane}</td>\n"; echo "<td class=\"listr\">{$fspans}{$data['duid']}{$fspane}</td>\n"; if ($data['type'] != "static") { echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n"; echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n"; } else { echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n"; echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n"; }
function build_interfaces_list() { global $portlist; $list = array(); foreach ($portlist as $ifn => $ifinfo) { if (is_jumbo_capable($ifn)) { $list[$ifn] = $ifn . " (" . $ifinfo['mac'] . ")"; $iface = convert_real_interface_to_friendly_interface_name($ifn); if (isset($iface) && strlen($iface) > 0) { $list[$ifn] .= " - {$iface}"; } } } return $list; }
$img = "/themes/{$g['theme']}/images/icons/icon_reject.gif"; } else { $img = "/themes/{$g['theme']}/images/icons/icon_block.gif"; } } ?> <img border="0" src="<?php echo $img; ?> " width="11" height="11" align="absmiddle"></a></span> <span class="log-time" ><?php echo htmlspecialchars($filterent['time']); ?> </span> <span class="log-interface" ><?php echo htmlspecialchars(convert_real_interface_to_friendly_interface_name($filterent['interface'])); ?> </span> <span class="log-source" ><?php echo htmlspecialchars($filterent['src']); ?> </span> <span class="log-destination" ><?php echo htmlspecialchars($filterent['dst']); ?> </span> <?php if ($filterent['proto'] == "TCP") { $filterent['proto'] .= ":" . $filterent['tcpflags']; } ?>
?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td> <?php $tab_array = array(); $mode = ""; foreach ($config['interfaces'] as $interface) { if ($interface['wireless'] != "") { if ($if == $interface['if']) { $enabled = true; $mode = $interface['wireless']['mode']; } else { $enabled = false; } $friendly = convert_real_interface_to_friendly_interface_name($interface['if']); if ($interface['descr'] != "") { $friendly = $interface['descr']; } $tab_array[] = array("Durum ({$friendly})", $enabled, "status_wireless.php?if={$interface['if']}"); } } /* XXX: add other wireless interfaces here */ display_top_tabs($tab_array); ?> </td></tr> <tr><td> <div id="mainarea"> <table class="tabcont" colspan="3" cellpadding="3" width="100%"> <?php /* table header */