diff --git a/repos/gems/recipes/raw/depot_download/depot_download.config b/repos/gems/recipes/raw/depot_download/depot_download.config
index 15e700f331..21e2fe7a86 100644
--- a/repos/gems/recipes/raw/depot_download/depot_download.config
+++ b/repos/gems/recipes/raw/depot_download/depot_download.config
@@ -43,10 +43,6 @@
-
- nameserver 1.1.1.1
-
-
diff --git a/repos/libports/ports/libc.hash b/repos/libports/ports/libc.hash
index 6daf39aa19..3016ab30aa 100644
--- a/repos/libports/ports/libc.hash
+++ b/repos/libports/ports/libc.hash
@@ -1 +1 @@
-c9c17345f57cb2f827c271806df456d829e32ce3
+5a5de5baab6e3ce23f24012a7604abf070fa990c
diff --git a/repos/libports/run/fetchurl.run b/repos/libports/run/fetchurl.run
index 39435e297b..c1a88c3aae 100644
--- a/repos/libports/run/fetchurl.run
+++ b/repos/libports/run/fetchurl.run
@@ -85,9 +85,6 @@ append config {
-
- nameserver 1.1.1.1
-
2000-01-01 00:00
01234567890123456789
diff --git a/repos/libports/run/libc_getaddrinfo.run b/repos/libports/run/libc_getaddrinfo.run
index 119a57a102..bb6db735f1 100644
--- a/repos/libports/run/libc_getaddrinfo.run
+++ b/repos/libports/run/libc_getaddrinfo.run
@@ -52,9 +52,6 @@ append config {
-
- nameserver 10.0.2.3
-
diff --git a/repos/libports/src/lib/libc/patches/res_init_c.patch b/repos/libports/src/lib/libc/patches/res_init_c.patch
new file mode 100644
index 0000000000..03622278ff
--- /dev/null
+++ b/repos/libports/src/lib/libc/patches/res_init_c.patch
@@ -0,0 +1,69 @@
++++ src/lib/libc/lib/libc/resolv/res_init.c
+@@ -152,6 +152,10 @@
+ return (__res_vinit(statp, 0));
+ }
+
++
++extern char const *libc_resolv_path;
++
++
+ /*% This function has to be reachable by res_data.c but not publically. */
+ int
+ __res_vinit(res_state statp, int preinit) {
+@@ -304,8 +308,47 @@
+ line[sizeof(name) - 1] == '\t'))
+
+ nserv = 0;
+- if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
++ if ((fp = fopen(libc_resolv_path, "r")) != NULL) {
+ /* read the config file */
++#if 1
++ if (fgets(buf, sizeof(buf), fp) != NULL) {
++ /* read nameservers to query */
++ struct addrinfo hints, *ai;
++ char sbuf[NI_MAXSERV];
++ const size_t minsiz = sizeof(statp->_u._ext.ext->nsaddrs[0]);
++
++ cp = buf;
++ cp[strcspn(cp, "\n")] = '\0';
++
++ if ((*cp != '\0') && (*cp != '\n')) {
++
++ memset(&hints, 0, sizeof(hints));
++ hints.ai_family = PF_UNSPEC;
++ hints.ai_socktype = SOCK_DGRAM; /*dummy*/
++ hints.ai_flags = AI_NUMERICHOST;
++ sprintf(sbuf, "%u", NAMESERVER_PORT);
++
++ if (getaddrinfo(cp, sbuf, &hints, &ai) == 0 &&
++ ai->ai_addrlen <= minsiz) {
++ if (statp->_u._ext.ext != NULL) {
++ memcpy(&statp->_u._ext.ext->nsaddrs[nserv],
++ ai->ai_addr, ai->ai_addrlen);
++ }
++
++ if (ai->ai_addrlen <=
++ sizeof(statp->nsaddr_list[nserv])) {
++ memcpy(&statp->nsaddr_list[nserv],
++ ai->ai_addr, ai->ai_addrlen);
++ } else {
++ statp->nsaddr_list[nserv].sin_family = 0;
++ }
++
++ freeaddrinfo(ai);
++ nserv++;
++ }
++ }
++ }
++#else
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ /* skip comments */
+ if (*buf == ';' || *buf == '#')
+@@ -502,6 +545,7 @@
+ continue;
+ }
+ }
++#endif /* 1 */
+ if (nserv > 0)
+ statp->nscount = nserv;
+ #ifdef RESOLVSORT
diff --git a/repos/libports/src/lib/libc/vfs_plugin.cc b/repos/libports/src/lib/libc/vfs_plugin.cc
index bbcee6ffd5..a21f11c51c 100644
--- a/repos/libports/src/lib/libc/vfs_plugin.cc
+++ b/repos/libports/src/lib/libc/vfs_plugin.cc
@@ -91,15 +91,11 @@ static void vfs_stat_to_libc_stat_struct(Vfs::Directory_service::Stat const &src
static Genode::Xml_node *_config_node;
+char const *libc_resolv_path;
+
namespace Libc {
- void libc_config_init(Genode::Xml_node node)
- {
- static Genode::Xml_node config = node;
- _config_node = &config;
- }
-
Genode::Xml_node config() __attribute__((weak));
Genode::Xml_node config()
{
@@ -143,6 +139,22 @@ namespace Libc {
return socket.string();
}
+ char const *config_nameserver_file() __attribute__((weak));
+ char const *config_nameserver_file()
+ {
+ static Config_attr ns_file("nameserver_file",
+ "/socket/nameserver");
+ return ns_file.string();
+ }
+
+ void libc_config_init(Genode::Xml_node node)
+ {
+ static Genode::Xml_node config = node;
+ _config_node = &config;
+
+ libc_resolv_path = config_nameserver_file();
+ }
+
void notify_read_ready(Vfs::Vfs_handle *handle)
{
struct Check : Libc::Suspend_functor
diff --git a/repos/libports/src/lib/libc_lwip_nic_dhcp/plugin.cc b/repos/libports/src/lib/libc_lwip_nic_dhcp/plugin.cc
index ca6c3e9127..6af2864476 100644
--- a/repos/libports/src/lib/libc_lwip_nic_dhcp/plugin.cc
+++ b/repos/libports/src/lib/libc_lwip_nic_dhcp/plugin.cc
@@ -1,6 +1,6 @@
/*
* \brief Libc plugin providing lwIP's DNS server address in the
- * '/etc/resolv.conf' file
+ * '/socket/nameserver' file
* \author Christian Prochaska
* \date 2013-05-02
*/
@@ -122,13 +122,13 @@ namespace {
/**
* File name this plugin feels responsible for
*/
- static char const *_file_name() { return "/etc/resolv.conf"; }
+ static char const *_file_name() { return "/socket/nameserver"; }
const char *_file_content()
{
static char result[32];
ip_addr_t nameserver_ip = dns_getserver(0);
- snprintf(result, sizeof(result), "nameserver %s\n",
+ snprintf(result, sizeof(result), "%s\n",
ipaddr_ntoa(&nameserver_ip));
return result;
}
@@ -150,7 +150,7 @@ namespace {
bool supports_stat(const char *path)
{
- return (Genode::strcmp(path, "/etc") == 0) ||
+ return (Genode::strcmp(path, "/socket") == 0) ||
(Genode::strcmp(path, _file_name()) == 0);
}
@@ -177,7 +177,7 @@ namespace {
{
if (buf) {
Genode::memset(buf, 0, sizeof(struct stat));
- if (Genode::strcmp(path, "/etc") == 0)
+ if (Genode::strcmp(path, "/socket") == 0)
buf->st_mode = S_IFDIR;
else if (Genode::strcmp(path, _file_name()) == 0) {
buf->st_mode = S_IFREG;
diff --git a/repos/ports/recipes/pkg/nic_router-nat-dns/runtime b/repos/ports/recipes/pkg/nic_router-nat-dns/runtime
index f752d6c70e..0500134704 100644
--- a/repos/ports/recipes/pkg/nic_router-nat-dns/runtime
+++ b/repos/ports/recipes/pkg/nic_router-nat-dns/runtime
@@ -45,14 +45,12 @@
-
- nameserver 9.9.9.9
-
+
listen_addresses:
diff --git a/repos/ports/run/arora.run b/repos/ports/run/arora.run
index ad5ae6ca8b..fe32d9a071 100644
--- a/repos/ports/run/arora.run
+++ b/repos/ports/run/arora.run
@@ -106,9 +106,6 @@ append config {
2018-01-01 00:01
-
- nameserver 10.0.2.3
-
diff --git a/repos/ports/run/noux_net_netcat.run b/repos/ports/run/noux_net_netcat.run
index f0b51065d6..7999934a7c 100644
--- a/repos/ports/run/noux_net_netcat.run
+++ b/repos/ports/run/noux_net_netcat.run
@@ -40,7 +40,7 @@ build $build_components
#
# The '/bin/etc/' directory is expected to contain the
-# files 'services', 'protocols', 'hosts', and 'resolv.conf'.
+# files 'services', 'protocols', and 'hosts'.
# Download these files from the FreeBSD source tree is possible.
#
exec mkdir -p bin/etc
@@ -48,7 +48,6 @@ set freebsd_url "http://svn.freebsd.org/base/release/8.2.0/etc"
foreach etc_file { services protocols hosts } {
if {![file exists bin/etc/$etc_file]} {
catch { exec wget -c -P bin/etc $freebsd_url/$etc_file } } }
-exec touch bin/etc/resolv.conf
exec tar rfv bin/netcat.tar -h -C bin/ etc
diff --git a/repos/ports/run/stubby.run b/repos/ports/run/stubby.run
index 55b1087021..c904abb014 100644
--- a/repos/ports/run/stubby.run
+++ b/repos/ports/run/stubby.run
@@ -99,14 +99,12 @@ append config {
-
- nameserver 10.0.2.3
-
+
listen_addresses:
@@ -125,9 +123,6 @@ listen_addresses:
-
- nameserver 10.0.53.2
-
diff --git a/repos/ports/run/stubby_deploy.run b/repos/ports/run/stubby_deploy.run
index 6fd64d5430..e70bcc664b 100644
--- a/repos/ports/run/stubby_deploy.run
+++ b/repos/ports/run/stubby_deploy.run
@@ -176,9 +176,6 @@ append config {
-
- nameserver 10.0.1.2
-
diff --git a/repos/ports/src/noux-pkg/noux-etc/target.mk b/repos/ports/src/noux-pkg/noux-etc/target.mk
index b484b5b012..06eab3a650 100644
--- a/repos/ports/src/noux-pkg/noux-etc/target.mk
+++ b/repos/ports/src/noux-pkg/noux-etc/target.mk
@@ -22,7 +22,6 @@ copy-contrib-files:
done
generate-files: copy-contrib-files
- $(VERBOSE)echo 'nameserver 8.8.8.8' > $(TARGET_DIR)/resolv.conf
$(BUILD_BIN_DIR)/$(TARGET): generate-files