summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-09-07 19:34:18 +0000
committerErmal Luçi <eri@pfsense.org>2008-09-07 19:34:18 +0000
commit4476d4475167263b170ea831dece50426655398a (patch)
tree16b1d9407d4f435d8ba4395e8221431ded72dc32 /etc
parent9f6f3e04c7527781692165adcdf1b392fd0fb765 (diff)
downloadpfsense-4476d4475167263b170ea831dece50426655398a.zip
pfsense-4476d4475167263b170ea831dece50426655398a.tar.gz
Merge lan configuration to the interfaces_wan.php page wich does the configuration of all
other assigned interfaces.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/interfaces.inc86
-rw-r--r--etc/inc/priv.defs.inc6
-rwxr-xr-xetc/rc.initial.setlanip2
-rwxr-xr-xetc/rc.interfaces_lan_configure2
-rwxr-xr-xetc/rc.linkup24
5 files changed, 16 insertions, 104 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index f95246a..620b413 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -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 */
diff --git a/etc/inc/priv.defs.inc b/etc/inc/priv.defs.inc
index dcd81b6..c4a2d7e 100644
--- a/etc/inc/priv.defs.inc
+++ b/etc/inc/priv.defs.inc
@@ -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.";
diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip
index 9eaaa3c..609e722 100755
--- a/etc/rc.initial.setlanip
+++ b/etc/rc.initial.setlanip
@@ -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";
diff --git a/etc/rc.interfaces_lan_configure b/etc/rc.interfaces_lan_configure
index 7f4d36e..0ee2d5b 100755
--- a/etc/rc.interfaces_lan_configure
+++ b/etc/rc.interfaces_lan_configure
@@ -32,6 +32,6 @@
require_once("config.inc");
require_once("filter.inc");
-interfaces_lan_configure();
+interfaces_wan_configure("lan");
?>
diff --git a/etc/rc.linkup b/etc/rc.linkup
index e948175..262cc20 100755
--- a/etc/rc.linkup
+++ b/etc/rc.linkup
@@ -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);
}
}
}
OpenPOWER on IntegriCloud