mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
Addressing fix
client->server: pseudo-port = 0 Path = local = [::1]:0 remote = [::1]:12345 <-- remote-port server receives: pseudo-port = 0 Path = local = [::1]:0 <-- port is pseudo-port, set in quic/endpoint.cpp remote = [::1]:0 <-- port is pseudo-port, set in quic/tunnel.cpp server sends: pseudo-port = 0 Path = local = [::1]:0 <-- is what it saved above remote = [::1]:0 <-- is what it saved above client receives: pseudo-port = 0 Path = local = [::1]:12345 <-- port is remote-port, set in quic/endpoint.cpp remote = [::1]:12345 <-- port is remote-port, set in quic/tunnel.cpp ^^^^^^ This does not match the stored Path, so dropped.
This commit is contained in:
parent
1b31fb15f6
commit
6c6e705862
53
delete_me
Normal file
53
delete_me
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Directory listing for /</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Directory listing for /</h1>
|
||||
<hr>
|
||||
<ul>
|
||||
<li><a href=".cache/">.cache/</a></li>
|
||||
<li><a href=".clang-format">.clang-format</a></li>
|
||||
<li><a href=".clang-tidy">.clang-tidy</a></li>
|
||||
<li><a href=".dir-locals.el">.dir-locals.el</a></li>
|
||||
<li><a href=".dockerignore">.dockerignore</a></li>
|
||||
<li><a href=".drone.jsonnet">.drone.jsonnet</a></li>
|
||||
<li><a href=".git/">.git/</a></li>
|
||||
<li><a href=".gitattributes">.gitattributes</a></li>
|
||||
<li><a href=".github/">.github/</a></li>
|
||||
<li><a href=".gitignore">.gitignore</a></li>
|
||||
<li><a href=".gitmodules">.gitmodules</a></li>
|
||||
<li><a href=".swift-version">.swift-version</a></li>
|
||||
<li><a href=".vscode/">.vscode/</a></li>
|
||||
<li><a href="build/">build/</a></li>
|
||||
<li><a href="cmake/">cmake/</a></li>
|
||||
<li><a href="CMakeLists.txt">CMakeLists.txt</a></li>
|
||||
<li><a href="contrib/">contrib/</a></li>
|
||||
<li><a href="CONTRIBUTING.md">CONTRIBUTING.md</a></li>
|
||||
<li><a href="CONTRIBUTING_es.md">CONTRIBUTING_es.md</a></li>
|
||||
<li><a href="crypto/">crypto/</a></li>
|
||||
<li><a href="daemon/">daemon/</a></li>
|
||||
<li><a href="delete_me">delete_me</a></li>
|
||||
<li><a href="docs/">docs/</a></li>
|
||||
<li><a href="external/">external/</a></li>
|
||||
<li><a href="gui/">gui/</a></li>
|
||||
<li><a href="https%3A/">https:/</a></li>
|
||||
<li><a href="include/">include/</a></li>
|
||||
<li><a href="jni/">jni/</a></li>
|
||||
<li><a href="LICENSE">LICENSE</a></li>
|
||||
<li><a href="llarp/">llarp/</a></li>
|
||||
<li><a href="misc_notes.txt">misc_notes.txt</a></li>
|
||||
<li><a href="pybind/">pybind/</a></li>
|
||||
<li><a href="readme.md">readme.md</a></li>
|
||||
<li><a href="readme_es.md">readme_es.md</a></li>
|
||||
<li><a href="readme_fr.md">readme_fr.md</a></li>
|
||||
<li><a href="readme_ru.md">readme_ru.md</a></li>
|
||||
<li><a href="rebuild.sh">rebuild.sh</a></li>
|
||||
<li><a href="test/">test/</a></li>
|
||||
<li><a href="win32-setup/">win32-setup/</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
|
@ -134,7 +134,9 @@ namespace llarp
|
|||
|
||||
virtual bool
|
||||
SendToOrQueue(
|
||||
std::variant<service::Address, RouterID> addr, const llarp_buffer_t& payload, service::ProtocolType t) = 0;
|
||||
std::variant<service::Address, RouterID> addr,
|
||||
const llarp_buffer_t& payload,
|
||||
service::ProtocolType t) = 0;
|
||||
|
||||
/// lookup srv records async
|
||||
virtual void
|
||||
|
|
|
@ -120,7 +120,6 @@ namespace llarp
|
|||
return false;
|
||||
m_TxRate += buf.size();
|
||||
|
||||
|
||||
std::variant<service::Address, RouterID> addr;
|
||||
|
||||
if (auto maybe = m_Parent->GetEndpointWithConvoTag(tag))
|
||||
|
|
|
@ -97,7 +97,9 @@ namespace llarp
|
|||
|
||||
bool
|
||||
ExitEndpoint::SendToOrQueue(
|
||||
std::variant<service::Address, RouterID> addr, const llarp_buffer_t& payload, service::ProtocolType type)
|
||||
std::variant<service::Address, RouterID> addr,
|
||||
const llarp_buffer_t& payload,
|
||||
service::ProtocolType type)
|
||||
{
|
||||
if (std::holds_alternative<service::Address>(addr))
|
||||
return false;
|
||||
|
|
|
@ -64,7 +64,9 @@ namespace llarp
|
|||
|
||||
bool
|
||||
SendToOrQueue(
|
||||
std::variant<service::Address, RouterID> addr, const llarp_buffer_t& payload, service::ProtocolType t) override;
|
||||
std::variant<service::Address, RouterID> addr,
|
||||
const llarp_buffer_t& payload,
|
||||
service::ProtocolType t) override;
|
||||
|
||||
void
|
||||
Tick(llarp_time_t now);
|
||||
|
|
|
@ -1255,7 +1255,8 @@ namespace llarp
|
|||
}
|
||||
// try sending it on an existing convotag
|
||||
// this succeds for inbound convos, probably.
|
||||
if (auto maybe_tag = GetBestConvoTagFor(to); auto maybe_addr = GetEndpointWithConvoTag(*maybe_tag))
|
||||
if (auto maybe_tag = GetBestConvoTagFor(to);
|
||||
auto maybe_addr = GetEndpointWithConvoTag(*maybe_tag))
|
||||
{
|
||||
if (SendToOrQueue(*maybe_addr, pkt.ConstBuffer(), type))
|
||||
{
|
||||
|
|
|
@ -998,7 +998,8 @@ extern "C"
|
|||
ctx->impl->router->loop()->call([addr = *maybe, pkt = std::move(pkt), ep, &ret]() {
|
||||
if (auto tag = ep->GetBestConvoTagFor(addr); auto addr = ep->GetEndpointWithConvoTag(*tag))
|
||||
{
|
||||
if (ep->SendToOrQueue(std::move(*addr), pkt.ConstBuffer(), llarp::service::ProtocolType::TrafficV4))
|
||||
if (ep->SendToOrQueue(
|
||||
std::move(*addr), pkt.ConstBuffer(), llarp::service::ProtocolType::TrafficV4))
|
||||
{
|
||||
ret.set_value(0);
|
||||
return;
|
||||
|
|
|
@ -27,7 +27,9 @@ namespace llarp::quic
|
|||
|
||||
public:
|
||||
Address() = default;
|
||||
Address(const SockAddr& addr, std::optional<std::variant<service::Address, RouterID>> ep = std::nullopt);
|
||||
Address(
|
||||
const SockAddr& addr,
|
||||
std::optional<std::variant<service::Address, RouterID>> ep = std::nullopt);
|
||||
|
||||
Address(const Address& other)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,8 @@ namespace llarp::quic
|
|||
EndpointBase& ep,
|
||||
const uint16_t port,
|
||||
std::variant<service::Address, RouterID>&& remote,
|
||||
uint16_t pseudo_port) : Endpoint{ep}
|
||||
uint16_t pseudo_port)
|
||||
: Endpoint{ep}
|
||||
{
|
||||
default_stream_buffer_size =
|
||||
0; // We steal uvw's provided buffers so don't need an outgoing data buffer
|
||||
|
@ -40,14 +41,22 @@ namespace llarp::quic
|
|||
//
|
||||
// - key_update_timer
|
||||
|
||||
// to try: set ports to 0
|
||||
Path path{
|
||||
Address{SockAddr{"::1"sv, huint16_t{pseudo_port}}, std::nullopt},
|
||||
Address{SockAddr{"::1"sv, huint16_t{port}}, std::move(remote)}
|
||||
};
|
||||
Address{SockAddr{"::1"sv, huint16_t{0}}, std::nullopt},
|
||||
Address{SockAddr{"::1"sv, huint16_t{0}}, std::move(remote)}};
|
||||
|
||||
log::debug(logcat, "Connecting to {} with addr_variant {}", path.remote, *path.remote.endpoint);
|
||||
log::debug(logcat, "psuedo_port = {}, port = {} at {}", port, __LINE__);
|
||||
|
||||
auto conn = std::make_shared<Connection>(*this, ConnectionID::random(), std::move(path), port);
|
||||
|
||||
log::debug(
|
||||
logcat,
|
||||
"Made connection object with path.remote = {} and addr_variant {} ",
|
||||
conn->path.remote,
|
||||
*conn->path.remote.endpoint);
|
||||
|
||||
auto conn = std::make_shared<Connection>(*this, ConnectionID::random(), path, port);
|
||||
conn->io_ready();
|
||||
conns.emplace(conn->base_cid, std::move(conn));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "external/ngtcp2/lib/ngtcp2_conn.h"
|
||||
#include "llarp/crypto/crypto.hpp"
|
||||
#include "llarp/quic/stream.hpp"
|
||||
#include "oxen/log.hpp"
|
||||
#include "server.hpp"
|
||||
#include <ngtcp2/ngtcp2.h>
|
||||
#include <external/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h>
|
||||
|
@ -423,7 +424,7 @@ namespace llarp::quic
|
|||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
if (vsnprintf(buf.data(), buf.size(), fmt, ap) >= 0)
|
||||
log::trace(logcat, "{}", buf.data());
|
||||
log::debug(logcat, "{}", buf.data());
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
@ -437,6 +438,12 @@ namespace llarp::quic
|
|||
|
||||
if (!send_data.empty())
|
||||
{
|
||||
log::debug(
|
||||
logcat,
|
||||
"Sending packet to {} at port {} on {}",
|
||||
*path.remote.endpoint,
|
||||
path.remote.port(),
|
||||
__LINE__);
|
||||
rv = endpoint.send_packet(path.remote, send_data, send_pkt_info.ecn);
|
||||
}
|
||||
return rv;
|
||||
|
@ -708,12 +715,17 @@ namespace llarp::quic
|
|||
{
|
||||
for (auto it = strs.begin(); it != strs.end();)
|
||||
{
|
||||
log::debug(logcat, "Max stream packets: {}\nCurrent stream packets: {}", max_stream_packets, stream_packets);
|
||||
log::debug(
|
||||
logcat,
|
||||
"Max stream packets: {}\nCurrent stream packets: {}",
|
||||
max_stream_packets,
|
||||
stream_packets);
|
||||
|
||||
auto& stream = **it;
|
||||
auto bufs = stream.pending();
|
||||
|
||||
if (bufs.empty()) {
|
||||
if (bufs.empty())
|
||||
{
|
||||
log::debug(logcat, "Stream buffer empty, have you considered moving on");
|
||||
}
|
||||
|
||||
|
@ -765,7 +777,8 @@ namespace llarp::quic
|
|||
vecs.size(),
|
||||
(!ts) ? get_timestamp() : ts);
|
||||
|
||||
log::debug(logcat,
|
||||
log::debug(
|
||||
logcat,
|
||||
"add_stream_data for stream {} returned [{},{}]",
|
||||
stream.id(),
|
||||
nwrite,
|
||||
|
@ -775,7 +788,8 @@ namespace llarp::quic
|
|||
{
|
||||
if (nwrite == -240) // NGTCP2_ERR_WRITE_MORE
|
||||
{
|
||||
log::debug(logcat,
|
||||
log::debug(
|
||||
logcat,
|
||||
"Consumed {} bytes from stream {} and have space left",
|
||||
ndatalen,
|
||||
stream.id());
|
||||
|
@ -817,15 +831,19 @@ namespace llarp::quic
|
|||
|
||||
if (nwrite == 0) // we are probably done, but maybe congested
|
||||
{
|
||||
log::debug(logcat,
|
||||
log::debug(
|
||||
logcat,
|
||||
"Done stream writing to {} (either stream is congested or we have nothing else to "
|
||||
"send right now)",
|
||||
stream.id());
|
||||
|
||||
ngtcp2_conn_stat cstat;
|
||||
ngtcp2_conn_get_conn_stat(conn.get(), &cstat);
|
||||
log::debug(logcat, "Current unacked bytes in flight: {}, Congestion window: {}",
|
||||
cstat.bytes_in_flight, cstat.cwnd);
|
||||
log::debug(
|
||||
logcat,
|
||||
"Current unacked bytes in flight: {}, Congestion window: {}",
|
||||
cstat.bytes_in_flight,
|
||||
cstat.cwnd);
|
||||
log::debug(logcat, "Updating pkt tx time at {}", __LINE__);
|
||||
ngtcp2_conn_update_pkt_tx_time(conn.get(), ts);
|
||||
it = strs.erase(it);
|
||||
|
@ -884,8 +902,11 @@ namespace llarp::quic
|
|||
|
||||
ngtcp2_conn_stat cstat;
|
||||
ngtcp2_conn_get_conn_stat(conn.get(), &cstat);
|
||||
log::debug(logcat, "Current unacked bytes in flight: {}, Congestion window: {}",
|
||||
cstat.bytes_in_flight, cstat.cwnd);
|
||||
log::debug(
|
||||
logcat,
|
||||
"Current unacked bytes in flight: {}, Congestion window: {}",
|
||||
cstat.bytes_in_flight,
|
||||
cstat.cwnd);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1155,7 +1176,8 @@ namespace llarp::quic
|
|||
{
|
||||
std::shared_ptr<Stream> stream{new Stream{
|
||||
*this, std::move(data_cb), std::move(close_cb), endpoint.default_stream_buffer_size}};
|
||||
if (int rv = ngtcp2_conn_open_bidi_stream(conn.get(), &stream->stream_id.id, stream.get()); rv != 0)
|
||||
if (int rv = ngtcp2_conn_open_bidi_stream(conn.get(), &stream->stream_id.id, stream.get());
|
||||
rv != 0)
|
||||
throw std::runtime_error{"Stream creation failed: "s + ngtcp2_strerror(rv)};
|
||||
|
||||
auto& str = streams[stream->stream_id];
|
||||
|
@ -1245,7 +1267,6 @@ namespace llarp::quic
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ngtcp2 doesn't expose the varint encoding, but it's fairly simple:
|
||||
// 0bXXyyyyyy -- XX indicates the encoded size (00=1, 01=2, 10=4, 11=8) and the rest of the bits
|
||||
// (6, 14, 30, or 62) are the number, with bytes in network order for >6-bit values.
|
||||
|
@ -1351,9 +1372,14 @@ namespace llarp::quic
|
|||
|
||||
const bool is_server = ngtcp2_conn_is_server(conn.get());
|
||||
|
||||
// debug
|
||||
log::debug(logcat, "Transport param port = {} at line {}", tunnel_port, __LINE__);
|
||||
|
||||
if (is_server)
|
||||
{
|
||||
tunnel_port = port;
|
||||
// debug
|
||||
log::debug(logcat, "Transport param tunnel_port = {} at line {}", tunnel_port, __LINE__);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1457,7 +1483,8 @@ namespace llarp::quic
|
|||
return nwrite;
|
||||
}
|
||||
log::debug(logcat, "encoded transport params: {}", buffer_printer{conn_buffer});
|
||||
return ngtcp2_conn_submit_crypto_data(conn.get(), level, u8data(conn_buffer), conn_buffer.size());
|
||||
return ngtcp2_conn_submit_crypto_data(
|
||||
conn.get(), level, u8data(conn_buffer), conn_buffer.size());
|
||||
}
|
||||
|
||||
} // namespace llarp::quic
|
||||
|
|
|
@ -730,7 +730,8 @@ namespace llarp::quic
|
|||
auto& stream = **it;
|
||||
auto bufs = stream.pending();
|
||||
|
||||
if (bufs.empty()) {
|
||||
if (bufs.empty())
|
||||
{
|
||||
log::debug(logcat, "Stream empty, moving on");
|
||||
// it = strs.erase(it);
|
||||
// continue;
|
||||
|
@ -906,9 +907,7 @@ namespace llarp::quic
|
|||
if (nwrite == -210) // NGTCP2_ERR_STREAM_DATA_BLOCKED
|
||||
{
|
||||
log::debug(logcat, "cannot add to empty stream right now: stream is blocked");
|
||||
fprintf(
|
||||
stderr,
|
||||
"cannot add to empty stream right now: stream is blocked\n");
|
||||
fprintf(stderr, "cannot add to empty stream right now: stream is blocked\n");
|
||||
ngtcp2_conn_update_pkt_tx_time(*this, *ts);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "endpoint.hpp"
|
||||
#include "client.hpp"
|
||||
#include "llarp/net/net_int.hpp"
|
||||
#include "ngtcp2/ngtcp2.h"
|
||||
#include "server.hpp"
|
||||
#include "uvw/async.h"
|
||||
|
@ -61,6 +62,9 @@ namespace llarp::quic
|
|||
// IPv4 or IPv6 "unspecified" address (0.0.0.0 or ::)
|
||||
// SockAddr local = src.isIPv6() ? SockAddr{in6addr_any} : SockAddr{nuint32_t{INADDR_ANY}};
|
||||
|
||||
// to try: set remote port to 0
|
||||
remote_port = 0;
|
||||
|
||||
Packet pkt{
|
||||
Path{Address{SockAddr{"::1"sv, huint16_t{remote_port}}, std::nullopt}, remote},
|
||||
data,
|
||||
|
@ -164,9 +168,13 @@ namespace llarp::quic
|
|||
io_result
|
||||
Endpoint::read_packet(const Packet& p, Connection& conn)
|
||||
{
|
||||
log::trace(logcat, "Reading packet from {}", p.path);
|
||||
// debug
|
||||
log::debug(logcat, "Reading packet from {}", p.path);
|
||||
log::debug(
|
||||
logcat,
|
||||
"Reading packet from {} with path.remote = {}, path.remote.endpoint = {}",
|
||||
p.path,
|
||||
p.path.remote,
|
||||
*p.path.remote.endpoint);
|
||||
auto rv =
|
||||
ngtcp2_conn_read_pkt(conn, p.path, &p.info, u8data(p.data), p.data.size(), get_timestamp());
|
||||
|
||||
|
@ -214,9 +222,10 @@ namespace llarp::quic
|
|||
log::debug(logcat, "to.port: {}, to.remote: {}", to.port(), *to.endpoint);
|
||||
|
||||
if (service_endpoint.SendToOrQueue(
|
||||
*to.endpoint, llarp_buffer_t{outgoing.data(), outgoing.size()}, service::ProtocolType::QUIC))
|
||||
*to.endpoint,
|
||||
llarp_buffer_t{outgoing.data(), outgoing.size()},
|
||||
service::ProtocolType::QUIC))
|
||||
{
|
||||
log::trace(logcat, "[{}]: sent {}", to, buffer_printer{outgoing});
|
||||
// debug
|
||||
log::debug(logcat, "[{}]: sent {}", to, buffer_printer{outgoing});
|
||||
}
|
||||
|
@ -254,6 +263,9 @@ namespace llarp::quic
|
|||
if (nwrote <= 0)
|
||||
return;
|
||||
|
||||
log::debug(
|
||||
logcat, "Sending packet to {} at port {} on {}", *source.endpoint, source.port(), __LINE__);
|
||||
|
||||
send_packet(source, bstring_view{buf.data(), static_cast<size_t>(nwrote)}, 0);
|
||||
}
|
||||
|
||||
|
@ -277,23 +289,14 @@ namespace llarp::quic
|
|||
ngtcp2_pkt_info pi;
|
||||
|
||||
auto written = ngtcp2_conn_write_connection_close(
|
||||
conn,
|
||||
path,
|
||||
&pi,
|
||||
u8data(conn.conn_buffer),
|
||||
conn.conn_buffer.size(),
|
||||
&err,
|
||||
get_timestamp());
|
||||
conn, path, &pi, u8data(conn.conn_buffer), conn.conn_buffer.size(), &err, get_timestamp());
|
||||
if (written <= 0)
|
||||
{
|
||||
log::warning(
|
||||
logcat,
|
||||
"Failed to write connection close packet: {}",
|
||||
written < 0 ? ngtcp2_strerror(written) : "unknown error: closing is 0 bytes??");
|
||||
log::warning(
|
||||
logcat,
|
||||
"Failed to write packet: removing connection {}",
|
||||
conn.base_cid);
|
||||
log::warning(logcat, "Failed to write packet: removing connection {}", conn.base_cid);
|
||||
delete_conn(conn.base_cid);
|
||||
return;
|
||||
}
|
||||
|
@ -305,6 +308,13 @@ namespace llarp::quic
|
|||
|
||||
assert(conn.closing && !conn.conn_buffer.empty());
|
||||
|
||||
log::debug(
|
||||
logcat,
|
||||
"Sending packet to {} at port {} on {}",
|
||||
*conn.path.remote.endpoint,
|
||||
conn.path.remote.port(),
|
||||
__LINE__);
|
||||
|
||||
if (auto sent = send_packet(conn.path.remote, conn.conn_buffer, 0); not sent)
|
||||
{
|
||||
log::warning(
|
||||
|
|
|
@ -103,13 +103,7 @@ namespace llarp::quic
|
|||
{
|
||||
log::debug(logcat, "Calling {}", __PRETTY_FUNCTION__);
|
||||
return ngtcp2_conn_install_rx_key(
|
||||
conn,
|
||||
nullptr,
|
||||
0,
|
||||
&null_aead_ctx,
|
||||
null_iv.data(),
|
||||
null_iv.size(),
|
||||
&null_cipher_ctx)
|
||||
conn, nullptr, 0, &null_aead_ctx, null_iv.data(), null_iv.size(), &null_cipher_ctx)
|
||||
== 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,20 +263,15 @@ namespace llarp::quic
|
|||
server_->stream_open_callback = [this](Stream& stream, uint16_t port) -> bool {
|
||||
stream.close_callback = close_tcp_pair;
|
||||
|
||||
// FIXME
|
||||
auto& conn = stream.get_connection();
|
||||
auto remote = service_endpoint_.GetEndpointWithConvoTag(conn.path.remote);
|
||||
if (!remote)
|
||||
{
|
||||
log::warning(
|
||||
logcat, "Received new stream open from invalid/unknown convo tag, dropping stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto lokinet_addr = var::visit([](auto&& remote) { return remote.ToString(); }, *remote);
|
||||
auto lokinet_addr =
|
||||
var::visit([](auto&& remote) { return remote.ToString(); }, *conn.path.remote.endpoint);
|
||||
auto tunnel_to = allow_connection(lokinet_addr, port);
|
||||
if (not tunnel_to)
|
||||
return false;
|
||||
log::info(
|
||||
log::debug(
|
||||
logcat, "quic stream from {} to {} tunnelling to {}", lokinet_addr, port, *tunnel_to);
|
||||
|
||||
auto tcp = get_loop()->resource<uvw::TCPHandle>();
|
||||
|
@ -514,7 +509,8 @@ namespace llarp::quic
|
|||
"Unable to open an outgoing quic connection: too many existing connections"};
|
||||
(next_pseudo_port_ = pport)++;
|
||||
|
||||
log::info(logcat, "Bound TCP tunnel {} for quic client :{}", saddr, pport);
|
||||
// debug
|
||||
log::debug(logcat, "Bound TCP tunnel {} for quic client :{}", saddr, pport);
|
||||
|
||||
// We are emplacing into client_tunnels_ here: beyond this point we must not throw until we
|
||||
// return (or if we do, make sure we remove this row from client_tunnels_ first).
|
||||
|
@ -686,7 +682,8 @@ namespace llarp::quic
|
|||
}
|
||||
|
||||
void
|
||||
TunnelManager::receive_packet(std::variant<service::Address, RouterID> remote, const llarp_buffer_t& buf)
|
||||
TunnelManager::receive_packet(
|
||||
std::variant<service::Address, RouterID> remote, const llarp_buffer_t& buf)
|
||||
{
|
||||
if (buf.sz <= 4)
|
||||
{
|
||||
|
@ -751,7 +748,25 @@ namespace llarp::quic
|
|||
return;
|
||||
}
|
||||
|
||||
auto remote_addr = Address{SockAddr{"::1"sv, huint16_t{remote_port}}, std::move(remote)};
|
||||
log::debug(
|
||||
logcat,
|
||||
"remote_port = {}, pseudo_port = {} at line {}",
|
||||
remote_port,
|
||||
pseudo_port,
|
||||
__LINE__);
|
||||
|
||||
// to try: set remote_port to 0
|
||||
remote_port = huint16_t{0};
|
||||
pseudo_port = 0;
|
||||
|
||||
auto remote_addr = Address{SockAddr{"::1"sv, remote_port}, std::move(remote)};
|
||||
log::debug(
|
||||
logcat,
|
||||
"Receiving packet from {} with port = {}, remote = {} at line {}",
|
||||
remote_addr,
|
||||
remote_addr.port(),
|
||||
*remote_addr.endpoint,
|
||||
__LINE__);
|
||||
ep->receive_packet(std::move(remote_addr), ecn, data, pseudo_port);
|
||||
}
|
||||
} // namespace llarp::quic
|
||||
|
|
|
@ -1703,7 +1703,6 @@ namespace llarp
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Endpoint::SendToOrQueue(const RouterID& addr, const llarp_buffer_t& buf, ProtocolType t)
|
||||
{
|
||||
|
@ -1722,7 +1721,6 @@ namespace llarp
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Endpoint::Pump(llarp_time_t now)
|
||||
{
|
||||
|
|
|
@ -469,7 +469,8 @@ namespace llarp
|
|||
// Looks up the ConvoTag and, if it exists, calls SendToOrQueue to send it to a remote client
|
||||
// or a snode (or nothing, if the convo tag is unknown).
|
||||
// bool
|
||||
//SendToOrQueue(std::variant<service::Address, RouterID> addr, const llarp_buffer_t& payload, ProtocolType t) override;
|
||||
// SendToOrQueue(std::variant<service::Address, RouterID> addr, const llarp_buffer_t& payload,
|
||||
// ProtocolType t) override;
|
||||
|
||||
// Send a to (or queues for sending) to either an address or router id
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue