aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/fs_hostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firejail/fs_hostname.c')
-rw-r--r--src/firejail/fs_hostname.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/firejail/fs_hostname.c b/src/firejail/fs_hostname.c
index 9da01b24c..60c65746b 100644
--- a/src/firejail/fs_hostname.c
+++ b/src/firejail/fs_hostname.c
@@ -89,7 +89,7 @@ errexit:
89} 89}
90 90
91void fs_resolvconf(void) { 91void fs_resolvconf(void) {
92 if (cfg.dns1 == NULL) 92 if (cfg.dns1 == NULL && !any_dhcp())
93 return; 93 return;
94 94
95 if (arg_debug) 95 if (arg_debug)
@@ -108,7 +108,8 @@ void fs_resolvconf(void) {
108 if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) 108 if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
109 continue; 109 continue;
110 // for resolv.conf we create a brand new file 110 // for resolv.conf we create a brand new file
111 if (strcmp(entry->d_name, "resolv.conf") == 0) 111 if (strcmp(entry->d_name, "resolv.conf") == 0 ||
112 strcmp(entry->d_name, "resolv.conf.dhclient-new") == 0)
112 continue; 113 continue;
113// printf("linking %s\n", entry->d_name); 114// printf("linking %s\n", entry->d_name);
114 115
@@ -169,8 +170,11 @@ void fs_resolvconf(void) {
169 exit(1); 170 exit(1);
170 } 171 }
171 172
172 if (cfg.dns1) 173 if (cfg.dns1) {
174 if (any_dhcp())
175 fwarning("network setup uses DHCP, nameservers will likely be overwritten\n");
173 fprintf(fp, "nameserver %s\n", cfg.dns1); 176 fprintf(fp, "nameserver %s\n", cfg.dns1);
177 }
174 if (cfg.dns2) 178 if (cfg.dns2)
175 fprintf(fp, "nameserver %s\n", cfg.dns2); 179 fprintf(fp, "nameserver %s\n", cfg.dns2);
176 if (cfg.dns3) 180 if (cfg.dns3)