Skip to content

Commit

Permalink
Merge pull request #2080 from oxen-io/dev
Browse files Browse the repository at this point in the history
0.9.11 release
  • Loading branch information
jagerman committed Nov 29, 2022
2 parents 1e5e34b + 8959e84 commit 81a61f3
Show file tree
Hide file tree
Showing 14 changed files with 247 additions and 113 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif()


project(lokinet
VERSION 0.9.10
VERSION 0.9.11
DESCRIPTION "lokinet - IP packet onion router"
LANGUAGES ${LANGS})

Expand Down
12 changes: 6 additions & 6 deletions cmake/StaticBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ set(OPENSSL_SOURCE openssl-${OPENSSL_VERSION}.tar.gz)
set(OPENSSL_HASH SHA256=83049d042a260e696f62406ac5c08bf706fd84383f945cf21bd61e9ed95c396e
CACHE STRING "openssl source hash")

set(EXPAT_VERSION 2.4.9 CACHE STRING "expat version")
set(EXPAT_VERSION 2.5.0 CACHE STRING "expat version")
string(REPLACE "." "_" EXPAT_TAG "R_${EXPAT_VERSION}")
set(EXPAT_MIRROR ${LOCAL_MIRROR} https://github.com/libexpat/libexpat/releases/download/${EXPAT_TAG}
CACHE STRING "expat download mirror(s)")
set(EXPAT_SOURCE expat-${EXPAT_VERSION}.tar.xz)
set(EXPAT_HASH SHA512=8508379b4915d84d50f3638678a90792179c98247d1cb5e6e6387d117af4dc148ac7031c1debea8b96e7b710ef436cf0dd5da91f3d22b8186a00cfafe1201169
set(EXPAT_HASH SHA512=2da73b991b7c0c54440485c787e5edeb3567230204e31b3cac1c3a6713ec6f9f1554d3afffc0f8336168dfd5df02db4a69bcf21b4d959723d14162d13ab87516
CACHE STRING "expat source hash")

set(UNBOUND_VERSION 1.17.0 CACHE STRING "unbound version")
Expand All @@ -25,11 +25,11 @@ set(UNBOUND_SOURCE unbound-${UNBOUND_VERSION}.tar.gz)
set(UNBOUND_HASH SHA512=f6b9f279330fb19b5feca09524959940aad8c4e064528aa82b369c726d77e9e8e5ca23f366f6e9edcf2c061b96f482ed7a2c26ac70fc15ae5762b3d7e36a5284
CACHE STRING "unbound source hash")

set(SQLITE3_VERSION 3390400 CACHE STRING "sqlite3 version")
set(SQLITE3_VERSION 3400000 CACHE STRING "sqlite3 version")
set(SQLITE3_MIRROR ${LOCAL_MIRROR} https://www.sqlite.org/2022
CACHE STRING "sqlite3 download mirror(s)")
set(SQLITE3_SOURCE sqlite-autoconf-${SQLITE3_VERSION}.tar.gz)
set(SQLITE3_HASH SHA3_256=431328e30d12c551da9ba7ef2122b269076058512014afa799caaf62ca567090
set(SQLITE3_HASH SHA3_256=7ee8f02b21edb4489df5082b5cf5b7ef47bcebcdb0e209bf14240db69633c878
CACHE STRING "sqlite3 source hash")

set(SODIUM_VERSION 1.0.18 CACHE STRING "libsodium version")
Expand Down Expand Up @@ -62,11 +62,11 @@ set(ZLIB_SOURCE zlib-${ZLIB_VERSION}.tar.xz)
set(ZLIB_HASH SHA256=d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98
CACHE STRING "zlib source hash")

set(CURL_VERSION 7.85.0 CACHE STRING "curl version")
set(CURL_VERSION 7.86.0 CACHE STRING "curl version")
set(CURL_MIRROR ${LOCAL_MIRROR} https://curl.haxx.se/download https://curl.askapache.com
CACHE STRING "curl mirror(s)")
set(CURL_SOURCE curl-${CURL_VERSION}.tar.xz)
set(CURL_HASH SHA512=b57cc31649a4f47cc4b482f56a85c86c8e8aaeaf01bc1b51b065fdb9145a9092bc52535e52a85a66432eb163605b2edbf5bc5c33ea6e40e50f26a69ad1365cbd
set(CURL_HASH SHA512=18e03a3c00f22125e07bddb18becbf5acdca22baeb7b29f45ef189a5c56f95b2d51247813f7a9a90f04eb051739e9aa7d3a1c5be397bae75d763a2b918d1b656
CACHE STRING "curl source hash")

include(ExternalProject)
Expand Down
2 changes: 1 addition & 1 deletion gui
1 change: 1 addition & 0 deletions llarp/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,7 @@ namespace llarp
"lokid",
"rpc",
RelayOnly,
Required,
Comment{
"oxenmq control address for for communicating with oxend. Depends on oxend's",
"lmq-local-control configuration option. By default this value should be",
Expand Down
23 changes: 15 additions & 8 deletions llarp/config/definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,8 @@ namespace llarp
const std::string& section, std::vector<std::string> comments)
{
auto& sectionComments = m_sectionComments[section];
for (size_t i = 0; i < comments.size(); ++i)
{
sectionComments.emplace_back(std::move(comments[i]));
}
for (auto& c : comments)
sectionComments.emplace_back(std::move(c));
}

void
Expand Down Expand Up @@ -198,13 +196,22 @@ namespace llarp
if (useValues and def->getNumberFound() > 0)
{
for (const auto& val : def->valuesAsString())
fmt::format_to(sect_append, "\n{}={}\n", name, val);
fmt::format_to(sect_append, "\n{}={}", name, val);
*sect_append = '\n';
}
else if (not(def->hidden and not has_comment))
else if (not def->hidden)
{
for (const auto& val : def->defaultValuesAsString())
fmt::format_to(sect_append, "\n{}{}={}\n", def->required ? "" : "#", name, val);
if (auto defaults = def->defaultValuesAsString(); not defaults.empty())
for (const auto& val : defaults)
fmt::format_to(sect_append, "\n{}{}={}", def->required ? "" : "#", name, val);
else
// We have no defaults so we append it as "#opt-name=" so that we show the option name,
// and make it simple to uncomment and edit to the desired value.
fmt::format_to(sect_append, "\n#{}=", name);
*sect_append = '\n';
}
else if (has_comment)
*sect_append = '\n';
});

if (sect_str.empty())
Expand Down
10 changes: 10 additions & 0 deletions llarp/config/definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ namespace llarp
OptionDefinition(std::string section_, std::string name_, Options&&... opts)
: OptionDefinitionBase(section_, name_, opts...)
{
constexpr bool has_default =
((config::is_default_array<Options> || config::is_default<Options>) || ...);
constexpr bool has_required =
(std::is_same_v<config::remove_cvref_t<Options>, config::Required_t> || ...);
constexpr bool has_hidden =
(std::is_same_v<config::remove_cvref_t<Options>, config::Hidden_t> || ...);
static_assert(
not(has_default and has_required), "Default{...} and Required are mutually exclusive");
static_assert(not(has_hidden and has_required), "Hidden and Required are mutually exclusive");

(extractDefault(std::forward<Options>(opts)), ...);
(extractAcceptor(std::forward<Options>(opts)), ...);
(extractComments(std::forward<Options>(opts)), ...);
Expand Down
58 changes: 40 additions & 18 deletions llarp/dns/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ namespace llarp::dns
static void
Callback(void* data, int err, ub_result* _result)
{
log::debug(logcat, "got dns response from libunbound");
// take ownership of ub_result
std::unique_ptr<ub_result, ub_result_deleter> result{_result};
// borrow query
Expand All @@ -158,6 +159,8 @@ namespace llarp::dns
return;
}

log::trace(logcat, "queueing dns response from libunbound to userland");

// rewrite response
OwnedBuffer pkt{(const byte_t*)result->answer_packet, (size_t)result->answer_len};
llarp_buffer_t buf{pkt};
Expand Down Expand Up @@ -452,20 +455,6 @@ namespace llarp::dns
Up(m_conf);
}

bool
WouldLoop(const SockAddr& to, const SockAddr& from) const override
{
#if defined(ANDROID)
(void)to;
(void)from;
return false;
#else
const auto& vec = m_conf.m_upstreamDNS;
return std::find(vec.begin(), vec.end(), to) != std::end(vec)
or std::find(vec.begin(), vec.end(), from) != std::end(vec);
#endif
}

template <typename Callable>
void
call(Callable&& f)
Expand All @@ -483,13 +472,15 @@ namespace llarp::dns
const SockAddr& to,
const SockAddr& from) override
{
if (WouldLoop(to, from))
return false;

auto tmp = std::make_shared<Query>(weak_from_this(), query, source, to, from);
// no questions, send fail
if (query.questions.empty())
{
log::info(
logcat,
"dns from {} to {} has empty query questions, sending failure reply",
from,
to);
tmp->Cancel();
return true;
}
Expand All @@ -499,13 +490,25 @@ namespace llarp::dns
// dont process .loki or .snode
if (q.HasTLD(".loki") or q.HasTLD(".snode"))
{
log::warning(
logcat,
"dns from {} to {} is for .loki or .snode but got to the unbound resolver, sending "
"failure reply",
from,
to);
tmp->Cancel();
return true;
}
}
if (not m_ctx)
{
// we are down
log::debug(
logcat,
"dns from {} to {} got to the unbound resolver, but the resolver isn't set up, "
"sending failure reply",
from,
to);
tmp->Cancel();
return true;
}
Expand All @@ -514,6 +517,12 @@ namespace llarp::dns
if (not running)
{
// we are stopping the win32 thread
log::debug(
logcat,
"dns from {} to {} got to the unbound resolver, but the resolver isn't running, "
"sending failure reply",
from,
to);
tmp->Cancel();
return true;
}
Expand All @@ -533,7 +542,10 @@ namespace llarp::dns
tmp->Cancel();
}
else
{
log::trace(logcat, "dns from {} to {} processing via libunbound", from, to);
m_Pending.insert(std::move(tmp));
}

return true;
}
Expand All @@ -549,6 +561,12 @@ namespace llarp::dns
{
parent_ptr->call(
[self = shared_from_this(), parent_ptr = std::move(parent_ptr), buf = replyBuf.copy()] {
log::trace(
logcat,
"forwarding dns response from libunbound to userland (resolverAddr: {}, "
"askerAddr: {})",
self->resolverAddr,
self->askerAddr);
self->src->SendTo(self->askerAddr, self->resolverAddr, OwnedBuffer::copy_from(buf));
// remove query
parent_ptr->RemovePending(self);
Expand Down Expand Up @@ -742,10 +760,14 @@ namespace llarp::dns
{
if (auto res_ptr = resolver.lock())
{
log::debug(
log::trace(
logcat, "check resolver {} for dns from {} to {}", res_ptr->ResolverName(), from, to);
if (res_ptr->MaybeHookDNS(ptr, msg, to, from))
{
log::trace(
logcat, "resolver {} handling dns from {} to {}", res_ptr->ResolverName(), from, to);
return true;
}
}
}
return false;
Expand Down
10 changes: 0 additions & 10 deletions llarp/dns/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,6 @@ namespace llarp::dns
const Message& query,
const SockAddr& to,
const SockAddr& from) = 0;

/// Returns true if a packet with to and from addresses is something that would cause a
/// resolution loop and thus should not be used on this resolver
virtual bool
WouldLoop(const SockAddr& to, const SockAddr& from) const
{
(void)to;
(void)from;
return false;
}
};

// Base class for DNS proxy
Expand Down
4 changes: 3 additions & 1 deletion llarp/router_contact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ namespace llarp
}

static constexpr std::array obsolete_bootstraps = {
"7a16ac0b85290bcf69b2f3b52456d7e989ac8913b4afbb980614e249a3723218"sv};
"7a16ac0b85290bcf69b2f3b52456d7e989ac8913b4afbb980614e249a3723218"sv,
"e6b3a6fe5e32c379b64212c72232d65b0b88ddf9bbaed4997409d329f8519e0b"sv,
};

bool
RouterContact::IsObsoleteBootstrap() const
Expand Down
Loading

0 comments on commit 81a61f3

Please sign in to comment.