Project

General

Profile

« Previous | Next » 

Revision e5995f9d

Added by Ermal LUÇI about 15 years ago

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.

View differences:

etc/inc/system.inc
192 192

  
193 193
	$hosts .= "127.0.0.1	localhost localhost.{$syscfg['domain']}\n";
194 194

  
195
	$sysiflist = get_configured_interface_list();
196
	foreach ($sysiflist as $sysif) {
197
		$cfgip = get_interface_ip($sysif);
195
	if ($config['interfaces']['lan']) {
196
		$cfgip = get_interface_ip("lan");
198 197
		if (is_ipaddr($cfgip))
199 198
			$hosts .= "{$cfgip}	{$syscfg['hostname']}.{$syscfg['domain']} {$syscfg['hostname']}\n";
199
	} else {
200
		$sysiflist = get_configured_interface_list();
201
		foreach ($sysiflist as $sysif) {
202
			if (!interface_has_gateway($sysif)) {
203
				$cfgip = get_interface_ip($sysif);
204
				if (is_ipaddr($cfgip)) {
205
					$hosts .= "{$cfgip}	{$syscfg['hostname']}.{$syscfg['domain']} {$syscfg['hostname']}\n";
206
					break;
207
				}
208
			}
209
		}
200 210
	}
201 211

  
202 212
	foreach ($hostscfg as $host) {

Also available in: Unified diff