On 04/05/18 16:38, Lee wrote:
> On 4/5/18, Keith Mendoza wrote:
>> So again, at what point do we stop adding code to net-snmp because
>> ISP's are messing around as if they're doing us a favor by letting us
>> use their services?
>
> Since people don't read the docs, how about adding a test to see if
> dns is borked; if it is link to a faq entry for possible ways to fix
> it.
>
> verizon 'opt out of dns assistance' link:
>
> https://www.verizon.com/support/residential/internet/home-network/settings/opt-out-of-dns-assist
How about the patch below? With this patch applied Net-SNMP developers can
make the tests pass easily by setting the NETSNMP_DNS_WORKAROUND environment
variable before running the tests and normal operation of snmpd is not
affected.
Thanks,
Bart.
Subject: [PATCH] snmplib: Avoid that test T070com2sec_simple fails due to DNS
filtering
---
snmplib/system.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/snmplib/system.c b/snmplib/system.c
index d7f06f74087f..28b832352247 100644
--- a/snmplib/system.c
+++ b/snmplib/system.c
@@ -762,6 +762,24 @@ netsnmp_validator_context(void)
int
netsnmp_gethostbyname_v4(const char* name, in_addr_t *addr_out)
{
+ if (getenv("NETSNMP_DNS_WORKAROUND")) {
+ /*
+ * A hack that avoids that T070com2sec_simple fails due to the DNS
+ * client filtering out 127.0.0.x addresses and/or redirecting DNS
+ * resolution failures to a web page.
+ */
+ if (strcmp(name, "onea.net-snmp.org") == 0) {
+ *addr_out = htonl(INADDR_LOOPBACK);
+ return 0;
+ } else if (strcmp(name, "twoa.net-snmp.org") == 0) {
+ *addr_out = htonl(INADDR_LOOPBACK + 1);
+ return 0;
+ } else if (strcmp(name, "no.such.address.") == 0) {
+ return -1;
+ }
+ }
+
+ {
#if HAVE_GETADDRINFO
struct addrinfo *addrs = NULL;
struct addrinfo hint;
@@ -826,6 +844,7 @@ netsnmp_gethostbyname_v4(const char* name, in_addr_t
*addr_out)
#else /* HAVE_GETIPNODEBYNAME */
return -1;
#endif
+ }
}
int
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders