dns port configurable at compile time (make this configurable on runtime plz)

pull/18/head
Jeff Becker 6 years ago
parent 2b8bd11f5e
commit 138c222a1a
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -65,6 +65,10 @@ if(STATIC_LINK)
add_cxxflags("-static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive")
endif()
if(DNS_PORT)
add_definitions(-DDNS_PORT=${DNS_PORT})
endif()
if(SHADOW)
set(WITH_STATIC OFF)
else()

@ -36,6 +36,8 @@ TESTNET_CLIENTS ?= 50
TESTNET_SERVERS ?= 50
TESTNET_DEBUG ?= 0
DNS_PORT ?= 53
LINT_FILES = $(wildcard llarp/*.cpp)
LINT_CHECK = $(LINT_FILES:.cpp=.cpp-check)
@ -49,7 +51,7 @@ clean:
rm -f *.a *.so
debug-configure:
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DHAVE_CXX17_FILESYSTEM=OFF
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DHAVE_CXX17_FILESYSTEM=OFF -DDNS_PORT=$(DNS_PORT)
release-configure: clean
cmake -GNinja -DSTATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)

@ -35,10 +35,10 @@ namespace llarp
}
bool
ExpiresSoon(llarp_time_t now, llarp_time_t dlt = 5000) const
ExpiresSoon(llarp_time_t now, llarp_time_t dlt = 15000) const
{
if(dlt)
return now >= (expiresAt - (llarp_randint() % dlt));
return now >= (expiresAt - dlt);
return IsExpired(now);
}

@ -6,6 +6,10 @@
#include <sys/socket.h>
#include <netdb.h>
#ifndef DNS_PORT
#define DNS_PORT (53)
#endif
namespace llarp
{
namespace handlers
@ -246,7 +250,7 @@ namespace llarp
m_TunSetupResult.set_value(result);
#endif
if(!llarp_dnsd_init(&this->dnsd, EndpointLogic(), EndpointNetLoop(),
tunif.ifname, 1153, "8.8.8.8", 53))
tunif.ifname, DNS_PORT, "8.8.8.8", 53))
{
llarp::LogError("Couldnt init dns daemon");
}

Loading…
Cancel
Save