NetworkManager/0001-explain-dns1-dns2.patch
2014-02-02 11:26:55 +01:00

28 lines
1.2 KiB
Diff

diff -up NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c
--- NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 2010-10-18 18:44:05.000000000 -0500
+++ NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c 2010-11-03 13:51:56.614584001 -0500
@@ -358,7 +358,7 @@ write_resolv_conf (FILE *f, const char *
str = g_string_new ("");
- if (nameservers) {
+ if (nameservers && g_strv_length (nameservers)) {
int num = g_strv_length (nameservers);
for (i = 0; i < num; i++) {
@@ -374,6 +374,14 @@ write_resolv_conf (FILE *f, const char *
g_string_append (str, nameservers[i]);
g_string_append_c (str, '\n');
}
+ } else {
+ g_string_append_printf (str, "\n\n%s%s%s%s%s%s",
+ "# No nameservers found; try putting DNS servers into your\n",
+ "# ifcfg files in /etc/sysconfig/network-scripts like so:\n",
+ "#\n",
+ "# DNS1=xxx.xxx.xxx.xxx\n",
+ "# DNS2=xxx.xxx.xxx.xxx\n",
+ "# DOMAIN=lab.foo.com bar.foo.com\n");
}
nameservers_str = g_string_free (str, FALSE);