2022-04-20 20:55:11 -04:00
|
|
|
From f5cc53d8d4dfcffe5d1c7b029078803112e79919 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:52 -0400
|
|
|
|
Subject: [PATCH] Add a toggle to disable /etc/hosts lookup
|
|
|
|
|
|
|
|
Signed-off-by: Tad <tad@spotco.us>
|
|
|
|
Change-Id: I92679c57e73228dc194e61a86ea1a18b2ac90e04
|
|
|
|
---
|
2022-04-20 20:55:11 -04:00
|
|
|
libc/dns/net/getaddrinfo.c | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
2022-04-20 00:42:18 -04:00
|
|
|
|
|
|
|
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
|
2022-04-20 20:55:11 -04:00
|
|
|
index cc94b21e2..36c887a38 100644
|
2022-04-20 00:42:18 -04:00
|
|
|
--- a/libc/dns/net/getaddrinfo.c
|
|
|
|
+++ b/libc/dns/net/getaddrinfo.c
|
|
|
|
@@ -83,6 +83,7 @@
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
+#include <sys/system_properties.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <netinet/in.h>
|
2022-04-20 20:55:11 -04:00
|
|
|
@@ -2118,6 +2119,11 @@ found:
|
|
|
|
static int
|
|
|
|
_files_getaddrinfo(void *rv, void *cb_data, va_list ap)
|
|
|
|
{
|
2022-04-20 00:42:18 -04:00
|
|
|
+ char value[PROP_VALUE_MAX] = { 0 };
|
|
|
|
+ if (__system_property_get("persist.security.hosts_disable", value) != 0)
|
2022-04-20 20:55:11 -04:00
|
|
|
+ if (atoi(value) != 0)
|
|
|
|
+ return NS_NOTFOUND;
|
2022-04-20 00:42:18 -04:00
|
|
|
+
|
2022-04-20 20:55:11 -04:00
|
|
|
const char *name;
|
|
|
|
const struct addrinfo *pai;
|
|
|
|
struct addrinfo sentinel, *cur;
|
2022-04-20 00:42:18 -04:00
|
|
|
--
|
|
|
|
2.36.0
|
|
|
|
|