From a725736eee095d13b3c0d4df77f415b869f632bd Mon Sep 17 00:00:00 2001 From: Augusto Bott Date: Mon, 5 Dec 2011 06:18:25 -0200 Subject: [PATCH] /etc/hosts completeness * Populate /etc/hosts with the IP address of all configured LAN bridges, including all router IPs on /etc/hosts (besides localhost and primary LAN) --- release/src/router/rc/network.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/release/src/router/rc/network.c b/release/src/router/rc/network.c index 954d08d535..70e37d6a2c 100644 --- a/release/src/router/rc/network.c +++ b/release/src/router/rc/network.c @@ -96,7 +96,15 @@ static void set_lan_hostname(const char *wan_hostname) if ((f = fopen("/etc/hosts", "w"))) { fprintf(f, "127.0.0.1 localhost\n"); if ((s = nvram_get("lan_ipaddr")) && (*s)) - fprintf(f, "%s %s\n", s, nvram_safe_get("lan_hostname")); + fprintf(f, "%s %s %s-lan\n", s, nvram_safe_get("lan_hostname"), nvram_safe_get("lan_hostname")); +#ifdef TCONFIG_VLAN + if ((s = nvram_get("lan1_ipaddr")) && (*s) && (strcmp(s,"") != 0)) + fprintf(f, "%s %s-lan1\n", s, nvram_safe_get("lan_hostname")); + if ((s = nvram_get("lan2_ipaddr")) && (*s) && (strcmp(s,"") != 0)) + fprintf(f, "%s %s-lan2\n", s, nvram_safe_get("lan_hostname")); + if ((s = nvram_get("lan3_ipaddr")) && (*s) && (strcmp(s,"") != 0)) + fprintf(f, "%s %s-lan3\n", s, nvram_safe_get("lan_hostname")); +#endif #ifdef TCONFIG_IPV6 if (ipv6_enabled()) { fprintf(f, "::1 localhost\n"); -- 2.11.4.GIT