Commit Graph

47 Commits

Author SHA1 Message Date
Jeff Becker
a24b82119b
fix #1655
* make it so that we don't set up unbound resolver when we have no resolvers provided by config
* clean up dns codepath and make it use llarp::SockAddr instead of llarp::IpAddress
2021-06-20 05:59:22 -04:00
Jeff Becker
5909ad0386
add MarkAddressOutbound to plainquic 2021-06-08 14:36:33 -04:00
Jason Rhinelander
b2b0e904d7 😡 2021-04-21 00:24:35 -03:00
Jason Rhinelander
41e5cf09ed ngtcp2 compat update 2021-04-21 00:18:46 -03:00
Jeff Becker
a3d7590fc8
correct header 2021-04-20 09:47:29 -04:00
Jeff Becker
714f6b0183
macos variant fixes 2021-04-20 09:44:52 -04:00
Jason Rhinelander
869b362572 Attempt fix to work around gcc-8 warning 2021-04-19 13:30:00 -03:00
Jeff Becker
fedc56e3f1
initial commit for #1595 2021-04-19 07:02:46 -04:00
Jeff Becker
545021aa3d
temp commit 2021-04-19 07:02:46 -04:00
Jeff Becker
cf7603f20e
temp commit, closeReset -> close 2021-04-19 06:59:07 -04:00
Jeff Becker
95cd275cdd
liblokinet additions:
* add lokinet_add_bootstrap_rc function for adding an rc from memory
* prevent stack overflow on error closing connection in quic
* add in memory nodedb
* refactor how convotags are set as active
* add initial stubs for endpoint statistics
* refactor time stuff to be a bit cleaner
* update lnproxy script with more arguments
2021-04-19 06:59:07 -04:00
Jason Rhinelander
354f0f63e5
Reduce max number of per-connection active streams to 32
This is the max number of simultaneous open connections to the same port
on the remote.  100 was fairly arbitrary and seems a bit high.
2021-04-19 06:59:07 -04:00
Jason Rhinelander
5e912600f8
Fix connection close handling
Replace stream_reset (which typically isn't called) with a stream_close
handler (which is already called whether or not it was a reset).  Most
importantly, the server side needs to extend the max bidi streams
counter during stream_close (otherwise we run out when we hit the
limit and new connections just stall).
2021-04-19 06:59:07 -04:00
Jason Rhinelander
80d3738531
Increase null_iv to 8 bytes to avoid ngtcp2 stack corruption 2021-04-19 06:59:06 -04:00
Jeff Becker
5b05d22bad
refactors
* add path sequence numbers on routing messages
* reduce log level in debug mode
* wire up loopback style sending to ourself
2021-04-19 06:59:06 -04:00
Jeff Becker
f86a2daf83
fixes
* Add service::Endpoint::HasOutboundConvo
* dont mark outbound convos as inbound
* order quic packets
2021-04-19 06:59:06 -04:00
Jeff Becker
59c9e997f2
build paths faster and limit path builds at edge router instead of via a time counter for all edges 2021-04-19 06:59:05 -04:00
Jason Rhinelander
ff2e79ce38
Remove superfluous log statement
The send_packet() we call here already prints the buffer.
2021-04-19 06:59:05 -04:00
Jason Rhinelander
312222e881
Properly handle ngtcp2 returning UINT64_MAX 2021-04-19 06:59:05 -04:00
Jason Rhinelander
2ea84a61f9
Replace timer->again() with stop/start()
repeat()/again() sets a repeating timer, which we don't want; stop and
start it instead so that it fires just once.
2021-04-19 06:59:05 -04:00
Jason Rhinelander
68e96a4e5d
Remove obsolete fixme
Remote addr and ecn are handled.
2021-04-19 06:59:05 -04:00
Jason Rhinelander
7982581cfd
Revisit/reduce quic logging
Demote many things to Trace.
2021-04-19 06:59:05 -04:00
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).
2021-04-19 06:59:05 -04:00
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).
2021-04-19 06:59:05 -04:00
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.
2021-04-19 06:59:05 -04:00
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.
2021-04-19 06:59:05 -04:00
Jason Rhinelander
71beae5923
Stop retransmit timer when destroying a connection
Otherwise we segfault because it outlives the Connection.
2021-04-19 06:59:05 -04:00
Jason Rhinelander
027243cbcc
Remove obsolete fixme 2021-04-19 06:59:04 -04:00
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.
2021-04-19 06:59:04 -04:00
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.
2021-04-19 06:59:04 -04:00
Jason Rhinelander
99954f7501
Add some more useful debug logging 2021-04-19 06:59:04 -04:00
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.
2021-04-19 06:59:04 -04:00
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.
2021-04-19 06:59:04 -04:00
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).
2021-04-19 06:59:04 -04:00
Jeff Becker
6bb23aa956
patch 2021-04-19 06:58:38 -04:00
Jeff Becker
100a953a23
make the lokinet endpoint code work
still needs the quic sides to work
2021-04-19 06:58:37 -04:00
Jeff Becker
4dafe973c2
comment out member 2021-04-19 06:58:37 -04:00
Jeff Becker
883005d7db
variable is unused for now but i dont want to remove it yet 2021-04-19 06:58:37 -04:00
Jeff Becker
59891d5d5f
wire up snode traffic to quic 2021-04-19 06:58:36 -04:00
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.
2021-04-19 06:58:36 -04:00
Jason Rhinelander
104f63543f
Change MaybeGetLoop to a virtual member func
Minor simplification.
2021-04-19 06:58:36 -04:00
Jeff Becker
618881e65c
update ngtcp2 address/path structs 2021-04-19 06:58:35 -04:00
Jeff Becker
1885b1cae9
more 2021-04-19 06:58:05 -04:00
Jeff Becker
4446f2fc16
fix and format.
* start moving quic code to use lokinet internals
2021-04-19 06:57:46 -04:00
Jason Rhinelander
818b4042e9
Migrate plainquic logging to llarp logging 2021-04-19 06:57:46 -04:00
Jason Rhinelander
5d897781ef
Replace custom random with llarp/sodium random 2021-04-19 06:57:45 -04:00
Jason Rhinelander
aa0f54fa07
WIP plainquic tunnels 2021-04-19 06:57:45 -04:00