Commit Graph

6960 Commits (0bc8d9f477cd89b598bca35f6c14afab446833ce)
 

Author SHA1 Message Date
Jason Rhinelander 7982581cfd
Revisit/reduce quic logging
Demote many things to Trace.
4 years ago
Jason Rhinelander 3c630b260a
Don't install stream forwarding here
Stream forward on the client-side TCP connection gets set up within in
initial_client_data_handler (which also handles reading the initial
stream version byte).
4 years ago
Jason Rhinelander f534103971
Simplify/fix expiry timer logic
Also fix a potential transmission delay because `again()` wasn't being
called when the expiry is already passed (i.e. meaning we should run
immediately).
4 years ago
Jason Rhinelander ac34835c12
Fix/refactor stream closing
Make stream closing with expiring connections work better.  Fixes an
issue where the stream's uv_async could outlive the stream and/or
connection and segfault.
4 years ago
Jason Rhinelander 60c813d306
Schedule retransmit after blocked send
In the standalone plainquic code we triggered a retransmit when the
socket became writeable again, but that doesn't work here, so just
schedule it right away to let ngtcp2 worry about retrying.
4 years ago
Jason Rhinelander 71beae5923
Stop retransmit timer when destroying a connection
Otherwise we segfault because it outlives the Connection.
4 years ago
Jason Rhinelander 027243cbcc
Remove obsolete fixme 4 years ago
Jason Rhinelander db2344505f
Update ngtcp2 4 years ago
Jason Rhinelander 233cb86191
Sever tunnel links earlier
When we get an error on the tcp connection immediately sever the link to
the quic tunnel so that it doesn't keep trying to forward data to it.
4 years ago
Jeff Becker 73572b317b
stuff 4 years ago
Jason Rhinelander 4cea33a139
Fix Server's missing opt-out of ring buffer
For now we still steal buffers from uvw.

In the future I'd like to change that, but it's still uvw
work-in-progress to support custom data allocators, and so for now we
still steal data buffers from uvw.
4 years ago
Jason Rhinelander 99954f7501
Add some more useful debug logging 4 years ago
Jason Rhinelander b8be889291
Add missing client TCP accept/forwarding handlers
Somehow the TCP client connection accept and stream forwarding got
dropped in the quic refactor.
4 years ago
Jason Rhinelander 738f16366b
Try outbound convos if no inbound convos work (FIXME)
FIXME - eliminate this block of code that used to be an `else` before
PR'ing.
4 years ago
Jason Rhinelander 183abd58aa
Add more checks and logging
Most of the logging here is Trace level so needs a Debug build to not
get compiled away.
4 years ago
Jason Rhinelander 44fc941c32
Set port properly in server-to-client reply packets
ngtcp2 was rejecting them because we have the port when constructing,
but then it was 0 on the return packet (which ngtcp2 drops because it's
coming from an unknown/invalid path).
4 years ago
Jason Rhinelander a1a152b5c3
Disable building ngtcp2 example code 4 years ago
Jeff Becker 6bb23aa956
patch 4 years ago
Jeff Becker 3977c12da6
dont try to build untracked file 4 years ago
Jeff Becker 708e408c30
various fixups and cleanups
* wire up last of the quic stuff
* clean up udp packet generation code
* pass EndpointBase not quic tunnel for quic stuff
* add {n,h}uint16_t::FromString
* add nuint_t::FromString
* make AlignedBuffer::IsZero non constant time call for speed
4 years ago
Jeff Becker 211a051444
add quic_tester.py script for hitting rpc endpoints to test quic 4 years ago
Jeff Becker 100a953a23
make the lokinet endpoint code work
still needs the quic sides to work
4 years ago
Jeff Becker 7098f46d60
rpc endpoint for triggering quic tunnel 4 years ago
Jeff Becker 838b968d8f
re add static build for all internal lokinet libs 4 years ago
Jeff Becker c88406fb27
move lokinet-quic into the big giant amalgum of liblokinet 4 years ago
Jeff Becker 4dafe973c2
comment out member 4 years ago
Jeff Becker 883005d7db
variable is unused for now but i dont want to remove it yet 4 years ago
Jeff Becker 2360700911
add virtual default destructor to appease clang 4 years ago
Jeff Becker 8b95f9945a
fix compiler errors 4 years ago
Jeff Becker f5700c560e
try inbound paths first 4 years ago
Jeff Becker 59891d5d5f
wire up snode traffic to quic 4 years ago
Jeff Becker 58bec09232
fix compile error 4 years ago
Jason Rhinelander 752879d712
QUIC lokinet integration refactor
Refactors how quic packets get handled: the actual tunnels now live in
tunnel.hpp's TunnelManager which holds and manages all the quic<->tcp
tunnelling.  service::Endpoint now holds a TunnelManager rather than a
quic::Server.  We only need one quic server, but we need a separate quic
client instance per outgoing quic tunnel, and TunnelManager handles all
that glue now.

Adds QUIC packet handling to get to the right tunnel code.  This
required multiplexing incoming quic packets, as follows:

Adds a very small quic tunnel packet header of 4 bytes:

    [1, SPORT, ECN] for client->server packets, where SPORT is our
    source "port" (really: just a uint16_t unique quic instance
    identifier)

or

    [2, DPORT, ECN] for server->client packets where the DPORT is the SPORT
    from above.

(This also reworks ECN bits to get properly carried over lokinet.)

We don't need a destination/source port for the server-side because
there is only ever one quic server (and we know we're going to it when
the first byte of the header is 1).

Removes the config option for quic exposing ports; a full lokinet will
simply accept anything incoming on quic and tunnel it to the requested
port on the the local endpoint IP (this handler will come in a following
commit).

Replace ConvoTags with full addresses: we need to carry the port, as
well, which the ConvoTag can't give us, so change those to more general
SockAddrs from which we can extract both the ConvoTag *and* the port.

Add a pending connection queue along with new quic-side handlers to call
when a stream becomes available (TunnelManager uses this to wire up
pending incoming conns with quic streams as streams open up).

Completely get rid of tunnel_server/tunnel_client.cpp code; it is now
moved to tunnel.hpp.

Add listen()/forget() methods in TunnelManager for setting up quic
listening sockets (for liblokinet usage).

Add open()/close() methods in TunnelManager for spinning up new quic
clients for outgoing quic connections.
4 years ago
Jason Rhinelander 158ea4a951
Add isIPv4/isIPv6 to SockAddr 4 years ago
Jason Rhinelander 2ca7ef7f5f
Rename isRouter -> isSNode
The isRouter wording was quite confusing, especially in a call such as:

    router->Configure(config, opts.isRouter, nodedb)
4 years ago
Jason Rhinelander 1d6ad7284c
Fix cursed formatting 4 years ago
Jason Rhinelander d588f777c7
Fix logging of std::byte values
They were failing to compile if output because implicit integer
promotion doesn't work for std::byte's (but rather needs an explicit
std::to_integer call).
4 years ago
Jason Rhinelander e27fdf4c9a
Simplify/unify SendTo* methods
Overload them to the same name to make it easier to call and/or visit
them with either a RouterID, Address, Variant, or ConvoTag.
4 years ago
Jason Rhinelander 104f63543f
Change MaybeGetLoop to a virtual member func
Minor simplification.
4 years ago
Jeff Becker a1a1b2e2bc
remove superflous include 4 years ago
Jeff Becker a61f846d33
* add convotags to ensure path to snode
* add service::Endpoint::EnsurePathTo which gives you a std::optional<Convotag>
4 years ago
Jeff Becker fe32475cad
use more variants 4 years ago
Jeff Becker 9d483a12db
* add protocol type to snode traffic
* make path::PathSet::SendPacketToRemote know about protocol type
4 years ago
Jeff Becker e4ca7ce4de
get rid of uneeded type 4 years ago
Jeff Becker 618881e65c
update ngtcp2 address/path structs 4 years ago
Jeff Becker eb965c8323
fix link error in ngtcp2 4 years ago
Jeff Becker fc9b09bdbc
clean up address/ip management code to use std::variant and std::optional 4 years ago
Jeff Becker 1885b1cae9
more 4 years ago
Jeff Becker 4446f2fc16
fix and format.
* start moving quic code to use lokinet internals
4 years ago
Jason Rhinelander 39d31df059
no-op LogTrace(); print chars as ints
- LogTrace() (and LogTraceTag, etc.) are now no-ops for release builds.
(hoping there are no side effects in trace logging!)
- renamed llarp::_Log to llarp::_log because _Log is a reserved keyword
- change logging code to implicitly convert 1-byte types (char, unsigned
char, uint8_t) to ints so that we print them as numeric values rather
than raw chars because, more often than not, printing a single char is
trying to log an 8-bit value.
4 years ago