2022-04-20 21:49:54 -04:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2022-04-20 00:42:18 -04:00
|
|
|
From: Tad <tad@spotco.us>
|
|
|
|
Date: Wed, 20 Apr 2022 00:40:53 -0400
|
|
|
|
Subject: [PATCH] Add a toggle to disable /etc/hosts lookup
|
|
|
|
|
|
|
|
Signed-off-by: Tad <tad@spotco.us>
|
|
|
|
Change-Id: Iea165003474e1107dc77980985bf9928c369dbb5
|
|
|
|
---
|
2022-04-20 20:55:11 -04:00
|
|
|
getaddrinfo.cpp | 4 ++++
|
|
|
|
1 file changed, 4 insertions(+)
|
2022-04-20 00:42:18 -04:00
|
|
|
|
|
|
|
diff --git a/getaddrinfo.cpp b/getaddrinfo.cpp
|
2022-04-20 21:09:28 -04:00
|
|
|
index 071f6ac..955b5c2 100644
|
2022-04-20 00:42:18 -04:00
|
|
|
--- a/getaddrinfo.cpp
|
|
|
|
+++ b/getaddrinfo.cpp
|
|
|
|
@@ -57,6 +57,7 @@
|
|
|
|
#include <future>
|
|
|
|
|
|
|
|
#include <android-base/logging.h>
|
|
|
|
+#include <android-base/properties.h>
|
|
|
|
|
|
|
|
#include "Experiments.h"
|
|
|
|
#include "netd_resolv/resolv.h"
|
2022-04-20 20:55:11 -04:00
|
|
|
@@ -1556,6 +1557,9 @@ static struct addrinfo* getCustomHosts(const size_t netid, const char* _Nonnull
|
2022-04-20 00:42:18 -04:00
|
|
|
|
2022-04-20 20:55:11 -04:00
|
|
|
static bool files_getaddrinfo(const size_t netid, const char* name, const addrinfo* pai,
|
|
|
|
addrinfo** res) {
|
2022-04-20 21:09:28 -04:00
|
|
|
+ if (android::base::GetIntProperty("persist.security.hosts_disable", 0) != 0 && name != "localhost" && name != "ip6-localhost")
|
2022-04-20 20:55:11 -04:00
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
struct addrinfo sentinel = {};
|
|
|
|
struct addrinfo *p, *cur;
|
|
|
|
FILE* hostf = nullptr;
|