Skip to content

Commit

Permalink
Remove obsolete/extraneous WouldLoop function
Browse files Browse the repository at this point in the history
The DNS resolver code should not and can not be responsible for
preventing packet looping.
  • Loading branch information
tewinget committed Nov 22, 2022
1 parent a518e65 commit 133cee0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
17 changes: 0 additions & 17 deletions llarp/dns/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,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 @@ -486,9 +472,6 @@ 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())
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

0 comments on commit 133cee0

Please sign in to comment.