summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-05-03 22:22:51 +0000
committerErmal <eri@pfsense.org>2010-05-03 22:22:51 +0000
commite5995f9dd8ae7d5ee76f58d619464d01555cbd6e (patch)
tree4e83b1e6a3eeb8eba2528adcf89c8f6556e30033 /etc
parentb6fe3414969eb2048758826208749b14c82eaf7c (diff)
downloadpfsense-e5995f9dd8ae7d5ee76f58d619464d01555cbd6e.zip
pfsense-e5995f9dd8ae7d5ee76f58d619464d01555cbd6e.tar.gz
Ticket #567. Create an entry on hosts file with the ip address of lan or the first inerface ip without a gateway if lan is not present.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/system.inc16
1 files changed, 13 insertions, 3 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index d26b1bb..530497b 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -192,11 +192,21 @@ function system_hosts_generate() {
$hosts .= "127.0.0.1 localhost localhost.{$syscfg['domain']}\n";
- $sysiflist = get_configured_interface_list();
- foreach ($sysiflist as $sysif) {
- $cfgip = get_interface_ip($sysif);
+ if ($config['interfaces']['lan']) {
+ $cfgip = get_interface_ip("lan");
if (is_ipaddr($cfgip))
$hosts .= "{$cfgip} {$syscfg['hostname']}.{$syscfg['domain']} {$syscfg['hostname']}\n";
+ } else {
+ $sysiflist = get_configured_interface_list();
+ foreach ($sysiflist as $sysif) {
+ if (!interface_has_gateway($sysif)) {
+ $cfgip = get_interface_ip($sysif);
+ if (is_ipaddr($cfgip)) {
+ $hosts .= "{$cfgip} {$syscfg['hostname']}.{$syscfg['domain']} {$syscfg['hostname']}\n";
+ break;
+ }
+ }
+ }
}
foreach ($hostscfg as $host) {
OpenPOWER on IntegriCloud