Respect settings RESOLVE_IPV4 and RESOLVE_IPv6 also when trying to resolve host names from the database (network table)

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-11-29 13:21:24 +01:00
parent dad2d6fc15
commit d25f05d339
3 changed files with 55 additions and 17 deletions
+17
View File
@@ -1695,6 +1695,15 @@ char *__attribute__((malloc)) getNameFromIP(const char *ipaddr)
return NULL;
}
// Check if we want to resolve host names
if(!resolve_this_name(ipaddr))
{
if(config.debug & DEBUG_DATABASE)
logg("getNameFromIP(\"%s\") - configured to not resolve host name", ipaddr);
return NULL;
}
// Check for a host name associated with the same IP address
sqlite3_stmt *stmt = NULL;
const char *querystr = "SELECT name FROM network_addresses WHERE name IS NOT NULL AND ip = ?;";
@@ -1858,6 +1867,14 @@ void resolveNetworkTableNames(void)
return;
}
// Check if we want to resolve host names
if(!resolve_names())
{
if(config.debug & DEBUG_DATABASE)
logg("resolveNetworkTableNames() - configured to not resolve host names");
return;
}
const char sql[] = "BEGIN TRANSACTION IMMEDIATE";
int rc = dbquery(sql);
if( rc != SQLITE_OK )