mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Merge lan configuration to the interfaces_wan.php page wich does the configuration of all
other assigned interfaces.
This commit is contained in:
parent
9f6f3e04c7
commit
4476d44751
@ -412,79 +412,6 @@ function interface_gif_configure(&$gif) {
|
||||
return $gifif;
|
||||
}
|
||||
|
||||
function interfaces_lan_configure() {
|
||||
global $config, $g;
|
||||
|
||||
$lancfg = $config['interfaces']['lan'];
|
||||
|
||||
/* if user has removed ip address, clear it*/
|
||||
if($lancfg['ipaddr'] == "")
|
||||
mwexec("/sbin/ifconfig {$lancfg['if']} delete");
|
||||
|
||||
/* wireless configuration? */
|
||||
if (is_array($lancfg['wireless']))
|
||||
interfaces_wireless_configure($lancfg['if'], $lancfg['wireless']);
|
||||
|
||||
/* MAC spoofing? */
|
||||
if ($lancfg['spoofmac']) {
|
||||
mwexec("/sbin/ifconfig " . escapeshellarg($lancfg['if']) .
|
||||
" link " . escapeshellarg($lancfg['spoofmac']));
|
||||
} else {
|
||||
$mac = get_interface_mac_address($lancfg['if']);
|
||||
if($mac == "ff:ff:ff:ff:ff:ff") {
|
||||
/* this is not a valid mac address. generate a
|
||||
* temporary mac address so the machine can get online.
|
||||
*/
|
||||
echo "Generating new MAC address.";
|
||||
$random_mac = generate_random_mac_address();
|
||||
mwexec("/sbin/ifconfig " . escapeshellarg($lancfg['if']) .
|
||||
" link " . escapeshellarg($random_mac));
|
||||
$lancfg['spoofmac'] = $random_mac;
|
||||
write_config();
|
||||
file_notice("MAC Address altered", "The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface {$lancfg['if']} has been automatically replaced with {$random_mac}", "Interfaces");
|
||||
}
|
||||
}
|
||||
|
||||
/* media */
|
||||
if ($lancfg['media'] || $lancfg['mediaopt']) {
|
||||
$cmd = "/sbin/ifconfig " . escapeshellarg($lancfg['if']);
|
||||
if ($lancfg['media'])
|
||||
$cmd .= " media " . escapeshellarg($lancfg['media']);
|
||||
if ($lancfg['mediaopt'])
|
||||
$cmd .= " mediaopt " . escapeshellarg($lancfg['mediaopt']);
|
||||
mwexec($cmd);
|
||||
}
|
||||
|
||||
mwexec("/sbin/ifconfig " . escapeshellarg($lancfg['if']) . " " .
|
||||
escapeshellarg($lancfg['ipaddr'] . "/" . $lancfg['subnet']));
|
||||
|
||||
if (!$g['booting']) {
|
||||
/* make new hosts file */
|
||||
system_hosts_generate();
|
||||
|
||||
/* reconfigure static routes (kernel may have deleted them) */
|
||||
system_routing_configure();
|
||||
|
||||
/* set the reload filter dity flag */
|
||||
touch("{$g['tmp_path']}/filter_dirty");
|
||||
|
||||
/* reload IPsec tunnels */
|
||||
vpn_ipsec_configure();
|
||||
|
||||
/* reload dhcpd (gateway may have changed) */
|
||||
services_dhcpd_configure();
|
||||
|
||||
/* reload dnsmasq */
|
||||
services_dnsmasq_configure();
|
||||
|
||||
/* reload captive portal */
|
||||
captiveportal_configure();
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function interfaces_configure() {
|
||||
global $g;
|
||||
|
||||
@ -496,10 +423,8 @@ function interfaces_configure() {
|
||||
if($debug)
|
||||
log_error("Configuring {$ifname}");
|
||||
|
||||
if ($if == "lan")
|
||||
interfaces_lan_configure();
|
||||
else
|
||||
interfaces_wan_configure($if);
|
||||
interfaces_wan_configure($if);
|
||||
|
||||
if ($g['booting'])
|
||||
echo "done.\n";
|
||||
}
|
||||
@ -1189,6 +1114,11 @@ function interfaces_wan_configure($interface = "wan") {
|
||||
|
||||
/* XXX: Shouldn't the caller do this?! */
|
||||
if (!$g['booting']) {
|
||||
/* XXX */
|
||||
if ($interface = "lan")
|
||||
/* make new hosts file */
|
||||
system_hosts_generate();
|
||||
|
||||
/* reconfigure static routes (kernel may have deleted them) */
|
||||
system_routing_configure();
|
||||
|
||||
@ -1198,7 +1128,7 @@ function interfaces_wan_configure($interface = "wan") {
|
||||
/* reload ipsec tunnels */
|
||||
vpn_ipsec_configure();
|
||||
|
||||
/* restart ez-ipupdate */
|
||||
/* update dyndns */
|
||||
services_dyndns_configure();
|
||||
|
||||
/* force DNS update */
|
||||
|
||||
@ -414,12 +414,6 @@ $priv_list['page-interfaces-gre-edit']['descr'] = "Allow access to the 'Interfac
|
||||
$priv_list['page-interfaces-gre-edit']['match'] = array();
|
||||
$priv_list['page-interfaces-gre-edit']['match'][] = "interfaces_gre_edit.php*";
|
||||
|
||||
$priv_list['page-interfaces-lan'] = array();
|
||||
$priv_list['page-interfaces-lan']['name'] = "WebCfg - Interfaces: LAN page";
|
||||
$priv_list['page-interfaces-lan']['descr'] = "Allow access to the 'Interfaces: LAN' page.";
|
||||
$priv_list['page-interfaces-lan']['match'] = array();
|
||||
$priv_list['page-interfaces-lan']['match'][] = "interfaces_lan.php*";
|
||||
|
||||
$priv_list['page-interfaces-ppp'] = array();
|
||||
$priv_list['page-interfaces-ppp']['name'] = "WebCfg - Interfaces: PPP page";
|
||||
$priv_list['page-interfaces-ppp']['descr'] = "Allow access to the 'Interfaces: PPP' page.";
|
||||
|
||||
@ -206,7 +206,7 @@
|
||||
$upperifname = strtoupper($interface);
|
||||
echo "\nPlease wait, saving and activating your changes to {$upperifname}...";
|
||||
write_config(gettext("{$interface} IP configuration from console menu"));
|
||||
interfaces_lan_configure();
|
||||
interfaces_wan_configure("lan");
|
||||
echo " Reloading filter...";
|
||||
filter_configure_sync();
|
||||
echo "\n";
|
||||
|
||||
@ -32,6 +32,6 @@
|
||||
require_once("config.inc");
|
||||
require_once("filter.inc");
|
||||
|
||||
interfaces_lan_configure();
|
||||
interfaces_wan_configure("lan");
|
||||
|
||||
?>
|
||||
|
||||
@ -79,24 +79,12 @@
|
||||
exec("/usr/sbin/arp -d -i {$argument1} -a");
|
||||
break;
|
||||
}
|
||||
switch ($iface) {
|
||||
case "wan":
|
||||
if($config['interfaces'][$iface]['ipaddr'] <> "pppoe" and
|
||||
$config['interfaces'][$iface]['ipaddr'] <> "pptp") {
|
||||
/* do not reconfigure on hotplug events when using pppoe or pptp */
|
||||
log_error("HOTPLUG: Configuring wan interface {$argument1}");
|
||||
interfaces_wan_configure();
|
||||
}
|
||||
break;
|
||||
case "lan":
|
||||
log_error("HOTPLUG: Configuring lan interface {$argument1}");
|
||||
interfaces_lan_configure();
|
||||
break;
|
||||
default:
|
||||
interfaces_wan_configure($interface);
|
||||
echo "interfaces_wan_configure($interface);\n";
|
||||
log_error("HOTPLUG: Configuring optional interface {$interface}");
|
||||
break;
|
||||
|
||||
if($config['interfaces'][$iface]['ipaddr'] <> "pppoe" and
|
||||
$config['interfaces'][$iface]['ipaddr'] <> "pptp") {
|
||||
/* do not reconfigure on hotplug events when using pppoe or pptp */
|
||||
log_error("HOTPLUG: Configuring wan interface {$argument1}");
|
||||
interfaces_wan_configure($iface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,13 +139,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
|
||||
<?php if (!isset($config['system']['webgui']['noassigninterfaces'])): ?>
|
||||
<?=output_menu_item("/interfaces_assign.php", "(assign)");?>
|
||||
<?php endif; ?>
|
||||
<?=output_menu_item("/interfaces_wan.php?if=wan", "WAN");?>
|
||||
<?php
|
||||
if($config['interfaces']['lan']) {
|
||||
output_menu_item("/interfaces_lan.php", "LAN");
|
||||
}
|
||||
?>
|
||||
<?php $opts = get_configured_interface_with_descr(true, true);
|
||||
<?php $opts = get_configured_interface_with_descr(false, true);
|
||||
foreach ($opts as $oif => $odescr):
|
||||
if (!isset($config['interfaces'][$oif]['ovpn'])): ?>
|
||||
<?=output_menu_item("/interfaces_wan.php?if={$oif}", htmlspecialchars($odescr))?>
|
||||
|
||||
@ -975,4 +975,4 @@ function echo_array($array,$return_me=false){
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -150,7 +150,10 @@ $pconfig['dhcphostname'] = $wancfg['dhcphostname'];
|
||||
$pconfig['alias-address'] = $wancfg['alias-address'];
|
||||
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
|
||||
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
|
||||
$pconfig['enable'] = $if == "wan" ? true : isset($wancfg['enable']);
|
||||
if ($if == "wan" || $if == "lan")
|
||||
$pconfig['enable'] = true;
|
||||
else
|
||||
$pconfig['enable'] = isset($wancfg['enable']);
|
||||
|
||||
if (is_array($config['aliases']['alias']))
|
||||
foreach($config['aliases']['alias'] as $alias)
|
||||
@ -190,12 +193,12 @@ if (isset($wancfg['wireless'])) {
|
||||
if ($_POST) {
|
||||
|
||||
unset($input_errors);
|
||||
// $pconfig = $_POST;
|
||||
$pconfig = $_POST;
|
||||
|
||||
/* filter out spaces from descriptions */
|
||||
$_POST['descr'] = remove_bad_chars($_POST['descr']);
|
||||
|
||||
if ($_POST['enable'] || $if == "wan") {
|
||||
if ($_POST['enable'] || $if == "wan" || $if = "lan") {
|
||||
/* optional interface if list */
|
||||
$iflist = get_configured_interface_with_descr(true);
|
||||
|
||||
@ -356,7 +359,10 @@ n already exists.";
|
||||
}
|
||||
|
||||
$wancfg['descr'] = remove_bad_chars($_POST['descr']);
|
||||
$wancfg['enable'] = $if == "wan" ? true : $_POST['enable'] ? true : false;
|
||||
if ($if == "wan" || $if == "lan")
|
||||
$wancfg['enable'] = true;
|
||||
else
|
||||
$wancfg['enable'] = $_POST['enable'] ? true : false;
|
||||
|
||||
if ($_POST['type'] == "static") {
|
||||
$wancfg['ipaddr'] = $_POST['ipaddr'];
|
||||
@ -495,7 +501,7 @@ n already exists.";
|
||||
$wancfg['mtu'] = $_POST['mtu'];
|
||||
|
||||
write_config();
|
||||
|
||||
|
||||
if ($if = "lan") {
|
||||
/* restart snmp so that it binds to correct address */
|
||||
services_snmpd_configure();
|
||||
@ -528,6 +534,8 @@ n already exists.";
|
||||
// Populate page descr if it does not exist.
|
||||
if($if == "wan" && !$wancfg['descr'])
|
||||
$wancfg['descr'] = "WAN";
|
||||
else if ($if == "lan" && !$wancfg['descr'])
|
||||
$wancfg['descr'] = "LAN";
|
||||
|
||||
$pgtitle = array("Interfaces", $wancfg['descr']);
|
||||
$closehead = false;
|
||||
@ -586,13 +594,14 @@ function show_mon_config() {
|
||||
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
||||
<?php include("fbegin.inc"); ?>
|
||||
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
||||
|
||||
<?php if ($savemsg) print_info_box($savemsg); ?>
|
||||
<form action="interfaces_wan.php?if=<?php echo "{$if}";?>" method="post" name="iform" id="iform">
|
||||
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" class="listtopic">General configuration</td>
|
||||
</tr>
|
||||
<?php if ($if != "wan"): ?>
|
||||
<?php if ($if != "wan" || $if != "lan"): ?>
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vtable"> </td>
|
||||
<td width="78%" class="vtable">
|
||||
@ -939,7 +948,7 @@ seconds<br>If no qualifying outgoing packets are transmitted for the specified n
|
||||
<script language="JavaScript">
|
||||
<!--
|
||||
<?php
|
||||
if ($if == "wan")
|
||||
if ($if == "wan" || $if = "lan")
|
||||
echo "\$('allcfg').appear();";
|
||||
else
|
||||
echo "show_allcfg(document.iform.enable);";
|
||||
|
||||
@ -101,9 +101,7 @@ if ($_POST) {
|
||||
write_config();
|
||||
|
||||
$confif = convert_real_interface_to_friendly_interface_name($vlan['vlanif']);
|
||||
if ($confif == "lan")
|
||||
interfaces_lan_configure();
|
||||
else if ($confif <> "")
|
||||
if ($confif <> "")
|
||||
interfaces_wan_configure($confif);
|
||||
|
||||
header("Location: interfaces_vlan.php");
|
||||
|
||||
@ -150,7 +150,10 @@ $pconfig['dhcphostname'] = $wancfg['dhcphostname'];
|
||||
$pconfig['alias-address'] = $wancfg['alias-address'];
|
||||
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
|
||||
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
|
||||
$pconfig['enable'] = $if == "wan" ? true : isset($wancfg['enable']);
|
||||
if ($if == "wan" || $if == "lan")
|
||||
$pconfig['enable'] = true;
|
||||
else
|
||||
$pconfig['enable'] = isset($wancfg['enable']);
|
||||
|
||||
if (is_array($config['aliases']['alias']))
|
||||
foreach($config['aliases']['alias'] as $alias)
|
||||
@ -190,12 +193,12 @@ if (isset($wancfg['wireless'])) {
|
||||
if ($_POST) {
|
||||
|
||||
unset($input_errors);
|
||||
// $pconfig = $_POST;
|
||||
$pconfig = $_POST;
|
||||
|
||||
/* filter out spaces from descriptions */
|
||||
$_POST['descr'] = remove_bad_chars($_POST['descr']);
|
||||
|
||||
if ($_POST['enable'] || $if == "wan") {
|
||||
if ($_POST['enable'] || $if == "wan" || $if = "lan") {
|
||||
/* optional interface if list */
|
||||
$iflist = get_configured_interface_with_descr(true);
|
||||
|
||||
@ -356,7 +359,10 @@ n already exists.";
|
||||
}
|
||||
|
||||
$wancfg['descr'] = remove_bad_chars($_POST['descr']);
|
||||
$wancfg['enable'] = $if == "wan" ? true : $_POST['enable'] ? true : false;
|
||||
if ($if == "wan" || $if == "lan")
|
||||
$wancfg['enable'] = true;
|
||||
else
|
||||
$wancfg['enable'] = $_POST['enable'] ? true : false;
|
||||
|
||||
if ($_POST['type'] == "static") {
|
||||
$wancfg['ipaddr'] = $_POST['ipaddr'];
|
||||
@ -495,7 +501,7 @@ n already exists.";
|
||||
$wancfg['mtu'] = $_POST['mtu'];
|
||||
|
||||
write_config();
|
||||
|
||||
|
||||
if ($if = "lan") {
|
||||
/* restart snmp so that it binds to correct address */
|
||||
services_snmpd_configure();
|
||||
@ -528,6 +534,8 @@ n already exists.";
|
||||
// Populate page descr if it does not exist.
|
||||
if($if == "wan" && !$wancfg['descr'])
|
||||
$wancfg['descr'] = "WAN";
|
||||
else if ($if == "lan" && !$wancfg['descr'])
|
||||
$wancfg['descr'] = "LAN";
|
||||
|
||||
$pgtitle = array("Interfaces", $wancfg['descr']);
|
||||
$closehead = false;
|
||||
@ -586,13 +594,14 @@ function show_mon_config() {
|
||||
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
||||
<?php include("fbegin.inc"); ?>
|
||||
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
||||
|
||||
<?php if ($savemsg) print_info_box($savemsg); ?>
|
||||
<form action="interfaces_wan.php?if=<?php echo "{$if}";?>" method="post" name="iform" id="iform">
|
||||
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" class="listtopic">General configuration</td>
|
||||
</tr>
|
||||
<?php if ($if != "wan"): ?>
|
||||
<?php if ($if != "wan" || $if != "lan"): ?>
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vtable"> </td>
|
||||
<td width="78%" class="vtable">
|
||||
@ -939,7 +948,7 @@ seconds<br>If no qualifying outgoing packets are transmitted for the specified n
|
||||
<script language="JavaScript">
|
||||
<!--
|
||||
<?php
|
||||
if ($if == "wan")
|
||||
if ($if == "wan" || $if = "lan")
|
||||
echo "\$('allcfg').appear();";
|
||||
else
|
||||
echo "show_allcfg(document.iform.enable);";
|
||||
|
||||
@ -41,7 +41,7 @@ require_once("/usr/local/www/widgets/include/interfaces.inc");
|
||||
|
||||
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<?php
|
||||
foreach ($ifdescrs as $ifdescr => $ifname){
|
||||
foreach ($ifdescrs as $ifdescr => $ifname) {
|
||||
$ifinfo = get_interface_info($ifdescr);
|
||||
$iswireless = is_interface_wireless($ifdescr);
|
||||
?>
|
||||
@ -57,16 +57,7 @@ require_once("/usr/local/www/widgets/include/interfaces.inc");
|
||||
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_cablenic.gif"/>
|
||||
<? } ?>
|
||||
<strong><u>
|
||||
<?php
|
||||
if ($ifname == "WAN") { ?>
|
||||
<span onClick="location.href='/interfaces_wan.php'" style="cursor:pointer">
|
||||
<? } else if ($ifname == "LAN") { ?>
|
||||
<span onClick="location.href='/interfaces_lan.php'" style="cursor:pointer">
|
||||
<? } else { ?>
|
||||
<span onClick="location.href='/interfaces_wan.php?optif=<?=$ifdescr; ?>'" style="cursor:pointer">
|
||||
<?
|
||||
} ?>
|
||||
|
||||
<span onClick="location.href='/interfaces_wan.php?if=<?=$ifdescr; ?>'" style="cursor:pointer">
|
||||
|
||||
<?=htmlspecialchars($ifname);?></span></u></strong>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user