Commit Graph

4739 Commits

Author SHA1 Message Date
Jeff
1a254a4301 kill/restore ipv6 with powershell because windows is vile 2022-04-18 17:50:48 -04:00
majestrate
d972b04fe0
Merge pull request #1891 from majestrate/idempotent-flush-path-builds-2022-04-12
idempotent flush queues on path builds
2022-04-18 15:54:09 -04:00
Jeff
9765eeee7e handle edge case better
when our path is fine but the recipiant's path on the pivot router isn't we should pivot to another router
2022-04-17 21:22:53 -04:00
Jeff
768ed30c05 add public key in rpc ping 2022-04-13 22:49:24 -04:00
Jeff
3fbddac464 idempotent flush queues on path builds 2022-04-12 11:48:08 -04:00
Jeff
ffadcb2e93 clean up paths that are ignored and inactive 2022-04-01 10:32:38 -04:00
Jeff
af041cfee4 try not to spam builds 2022-04-01 10:32:34 -04:00
Jeff
38a157808e Cache best paths determined by GetPathByRouter to reduce cpu usage 2022-03-30 17:11:04 -04:00
majestrate
1fc901330c
Merge pull request #1851 from majestrate/ci-docs-generation-2022-02-04
ci docs generation
2022-03-30 16:45:53 -04:00
Jeff
a76acd4956 fix wire protocol race condition
only send close packet once, before we were sending a close after we got a close causing excess log spam.
include handshake phase when checking for connection timeouts.

when we change our rc make sure to put it into nodedb too when we are a service node to prevent weirdness in dht lookups.
2022-03-05 21:08:53 -05:00
Jeff
b4c4c3977a oxenc 2022-02-28 10:49:23 -05:00
Jeff
eeb93343c0 rpc fixes for lokinet gui
only add stats for services when we have them
2022-02-23 09:24:50 -05:00
audric
41405be612 summary status: no services means not running 2022-02-23 14:21:47 +11:00
Audric Ackermann
ad6d206aa6
add version and uptime to summary status endpoint 2022-02-21 10:57:47 +11:00
Jeff
6bb438ca33 make comments with colins in them not have them in it 2022-02-17 18:01:53 -05:00
majestrate
8a849e81df
Merge pull request #1858 from jagerman/omq-11
Crank oxen-mq to (1.2.)11; switch to oxen-encoding
2022-02-17 16:18:28 -05:00
Jason Rhinelander
d02558350a
Crank oxen-mq to (1.2.)11; switch to oxen-encoding
- Update oxen-mq submodule to latest stable
- Add oxen-encoding submodule
- Convert all oxenmq encoding usage to oxenc
- Modernize cmake handling of oxenmq/oxenc
2022-02-17 16:30:17 -04:00
majestrate
f8b6b9d34b
Merge pull request #1856 from Bilb/fix-num-path-built-summary-status
fix numPaths value in Router::ExtractSummaryStatus
2022-02-15 21:09:58 -05:00
Audric Ackermann
d9467f4dee fix numPaths value in Router::ExtractSummaryStatus 2022-02-16 13:07:55 +11:00
Jeff
ac9fb9d479 use quad nine as default upstream dns 2022-02-15 20:29:55 -05:00
Jeff
810e3cc9c2 dont capture flow_addr, results in compiler error on sid 2022-02-06 13:27:19 -05:00
majestrate
838183e36e
Merge pull request #1748 from majestrate/liblokinet-udp-api-2021-09-19
liblokinet updates
2022-02-06 13:19:08 -05:00
Jeff
582fdeda27 add close_reason parameter to quic::Endpoint::close_connection defaulting to emtpy string 2022-01-31 14:43:38 -05:00
Jeff
95efe8f4e5 bump ngtcp2 to v0.1.0 tag 2022-01-31 13:05:03 -05:00
Jeff Becker
04b23416ed do less allocations in lokinet_hex_tobase32z 2022-01-31 10:53:48 -05:00
Jeff Becker
743bc2433a resolve race condition in udp flow and packet handling 2022-01-31 10:53:48 -05:00
Jeff Becker
635f4bcd8c make it compile 2022-01-31 10:53:48 -05:00
Jeff Becker
5286d442fb updates:
* add udptest example
* fix up udp codepath in liblokinet
2022-01-31 10:53:48 -05:00
Jeff Becker
65b29a1b70 add liblokinet custom logger 2022-01-31 10:53:48 -05:00
Jeff Becker
f5157c31da make it compile 2022-01-31 10:53:48 -05:00
Jeff Becker
b225ec1043 thread safety stuff 2022-01-31 10:53:48 -05:00
Jeff Becker
ba57ab04aa wire up liblokient_udp_* 2022-01-31 10:53:48 -05:00
Jeff Becker
1c70b0f42f add lokinet_hex_to_base32z 2022-01-31 10:53:48 -05:00
Jeff Becker
bbb082931a more logging 2022-01-31 10:53:48 -05:00
Jeff Becker
66de680884 sanity check 2022-01-31 10:53:48 -05:00
Jeff Becker
8c8f97adda more logging 2022-01-31 10:53:48 -05:00
Jeff Becker
38d4cec7d1 log errors on decoding 2022-01-31 10:53:48 -05:00
Jeff Becker
c5b5ff7810 typo fix 2022-01-31 10:53:48 -05:00
Jeff Becker
2428cc189e llarp::BootstrapConfig update
* make routers member a llarp::BootstrapList
2022-01-31 10:53:48 -05:00
Jeff Becker
c4b1a9c074 lokinet_add_bootstrap_rc
* allow bootstrap lists to be passed in
2022-01-31 10:53:48 -05:00
Jeff
fc444741f1 move constant to new header
create llarp/constants/time.hpp for time/duration constants
2022-01-27 11:11:57 -05:00
Jeff
5fac6c84d8 detect timeskip and thaw network when we think it happened. 2022-01-27 10:59:04 -05:00
Jeff
38c6d99375 wire up sigusr1 to trigger a network thaw on non win32 platforms 2022-01-27 09:59:52 -05:00
majestrate
27619f5fb4
Merge pull request #1838 from majestrate/sd_notify_extra_info-2022-01-13
redo systemd status line
2022-01-14 17:01:52 -05:00
Jeff
b3d9cd463f route poker: allow not blackholing routes.
allow runtime configuration to disable ip blackholing.
2022-01-14 13:03:01 -05:00
Jeff
205584acdf redo systemd status line to include number of paths and endpoint count. optionally warn about low path success. 2022-01-14 11:18:07 -05:00
majestrate
2c44ffe85b
Update llarp/router/route_poker.cpp
Co-authored-by: Jason Rhinelander <jason@imaginary.ca>
2022-01-11 12:44:05 -05:00
Jeff
27ba3e044d
prevent segfault in route poker if Init() is not called 2022-01-03 10:16:08 -05:00
majestrate
9e4bd2cd44
Merge pull request #1801 from majestrate/introset-publish-spam-fix-2021-11-16
prevent introset publish spam
2021-12-27 10:04:48 -05:00
Jeff Becker
061aebc964
reword auto-routing config comment 2021-12-15 18:42:22 -05:00
Jeff Becker
14ffdb6639
configurable route poker
this allows you to use exit nodes without forcing routes over the interface, useful for using lokinet with an exit and selectively routing over the lokinet interface using an external socks proxy or binding to device explicitly.

* make route poker configurable, defaults to enabled but allows disabling it on runtime if desired
* add config option [network]:auto-routing to enable/disable route poker
2021-12-15 18:42:22 -05:00
Jeff Becker
da887dc559
implement exit node pooling, allows users to use multiple exits for an address range.
mappings per ip stick to the same exit, each new ip is mapped to a random exit in the specified pool.

make exit-auth multi value
2021-12-15 16:26:21 -05:00
Jeff
776e9227fd
make serivce::Endpoint::EnsurePathToService have a default timeout as a named constant. 2021-12-15 15:25:53 -05:00
Jeff
301b19bd0f
do not send buggy reply as rpc 2021-12-15 15:25:53 -05:00
Jeff
388fc53380
match io loop event order on windows/apple to match linux.
on win32/apple reading packets from the interface does not count as an io operation.
manually trigger pump on win32/apple to pretend that it is an io event.
add platform quark function MaybeWakeUpperLayers on vpn::Interface to manaully wake up the other components on platforms that need that (ones on which packet io is not done via io events).
on non linux platforms, use uv_prepare_t instead of uv_check_t as the former triggers before blocking for io, instead of after. this better matches linux's order of operations in libuv.
2021-12-15 15:25:53 -05:00
Jeff Becker
0e2b0edaf6
when lokinet looses ip4 connectivity libunbound used to freak out and only use ip6 after such an event.
as a result dns queries stop working because we blackhole ip6 routes if exit mode is on.
this prevents this case from being hit.
2021-12-03 16:12:10 -05:00
Jeff Becker
ec8d990163
demote log statement levels 2021-11-28 09:57:10 -05:00
Jeff Becker
172c2dec45
create new constexpr for the staleness window for introsets and use it in publishing introsets and intro selection 2021-11-16 12:22:08 -05:00
Jason Rhinelander
189c4bfba4
Also consider last publish; eliminate unwanted condition
We don't really carry about when the last regen was attempted, but
rather about when the last publish was attempted (or succeeded).
2021-11-16 12:21:57 -05:00
Jeff Becker
8ba03de44e
match timeouts in introset selection spread with logic for publishing 2021-11-16 10:57:17 -05:00
Jason Rhinelander
5115162066 Use libuv's cached current time for time_now()
We are calling time_now() a huge amount, and it is a major consumer of
CPU cycles, but we don't need it: most of the time the current event
loop time is enough.
2021-11-15 18:32:05 -04:00
Jason Rhinelander
b2ee003329 Optimization: eliminate unneeded shared_ptrs
We have a few cases where we're making an extra shared_ptr which we copy
into a lambda, which then results in an extra unnecessary refcount
decrement in the parent; this changes them to give an rvalue reference
to the lambda to avoid the extra incr/decr instead.

The one in Session::Pump is particularly noticeable and shows up in
profiling.
2021-11-15 18:32:03 -04:00
Jason Rhinelander
7a04911b9b Avoid std::function in hot pump code
We're seeing overhead here of the std::function invocation, which we can
easily avoid in this case by not using a std::function around the
callback.
2021-11-15 18:29:26 -04:00
Jason Rhinelander
09c2b31b25 Move paths pumping into PumpLL 2021-11-15 18:24:07 -04:00
Jason Rhinelander
687b54f860 Abstract & simplify logic 2021-11-15 17:15:16 -04:00
Jason Rhinelander
711038d150 Remove debug comment 2021-11-15 16:57:17 -04:00
Jason Rhinelander
0fe7153f6e Fix client latency bug; De-shared_ptr IHopHandler queues
- Replace m_FlushWakeup with a call to the router's god mode pump
  method.  m_FlushWakeup apparently isn't enough to get things out, and
  we can end up with incoming packets that don't get properly handled
  right away without it.

- The shared_ptr around the ihophandler queues isn't needed and is just
  adding a layer of obfuscation; instead just exchange the list directly
  into the lambda.

- Use std::exchange rather than swap

- A couple other small code cleanups.
2021-11-15 13:39:57 -04:00
Jason Rhinelander
70553c7627 Remove hopeless flush
The TriggerPump just below this is *already* going to trigger a flush,
so the extra flush call here can't do anything useful (and in
particular, it won't clear up the queue *immediately*, which is what
this code looks like it was aimed at doing).
2021-11-15 13:39:52 -04:00
Jason Rhinelander
fbc5cb0a6d Add another missing pump trigger 2021-11-15 13:38:24 -04:00
Jason Rhinelander
bce7e2e56d Pump outbound context 2021-11-15 13:38:21 -04:00
Jason Rhinelander
846577a0aa Add missing inbound traffic pump trigger 2021-11-15 13:38:10 -04:00
Jason Rhinelander
8cdde74020 Simplify 2021-11-15 13:38:08 -04:00
Jason Rhinelander
b3a8160c89 Pump hidden context sooner
This has to happen before pumping links because it is putting things on
links.
2021-11-15 13:38:05 -04:00
Jason Rhinelander
0924dd8862 Remove dead declaration 2021-11-15 13:38:02 -04:00
Jason Rhinelander
f9395cd5dd Cleanup: avoid pointless copy of this pointer 2021-11-15 13:38:00 -04:00
Jason Rhinelander
9844d358e6 Fix packet delay creep
- Make the main PumpLL also pump hidden services, rather than using
  separate wakers in each TunEndpoint.  It seems there is some
  interactions that just one or the other is not enough.

- Eliminate TunEndpoint send queue -- it isn't needed as we can just
  send directly.
2021-11-15 13:37:57 -04:00
Jason Rhinelander
99b12940ad Cleanups 2021-11-15 13:37:54 -04:00
Jason Rhinelander
e47d3098ac Increase plaintext queue size from 32 to 512
In testing we were sometimes hitting a full queue error, which makes
sense because the queue size seems really small.

Increase it to 512.
2021-11-15 13:37:49 -04:00
Jason Rhinelander
78cc466bf2 Rename PumpLL -> TriggerPump
And rename the actual pump implementation back to PumpLL.
2021-11-15 13:37:47 -04:00
Jason Rhinelander
031ea7aa37 Get rid of external event loop direct wakeups
If something needs to wake up the event loop it should be using an
async, as we are now with PumpLL(); but we had various code triggering a
wakeup, expecting that PumpLL gets called on every wakeup, which isn't
true anymore.
2021-11-15 13:36:44 -04:00
Jason Rhinelander
74215fc44c Fix link layer delivery race condition (fix random ping delays)
We trigger a pump immediately, but this is racey because we add to our
plaintext data in a worker thread; if the worker thread runs after the
pump then it ends up leaving plaintext to be handled, but there's no
wakeup until the next one.

This was the cause of seeing a random +1s and bunching added to ping
responses sometimes: it wasn't until the *next* ping goes through the
network that the plaintext queue gets processed, at which point it
flushes the old one and often the new one together.

The fix here gets rid of the map of sessions needing wakeups and instead
adds an atomic flag to all of them to let us figure out which ones
need to be flushed.
2021-11-15 13:36:28 -04:00
Jason Rhinelander
aa1dc83459 Simplify 2021-11-15 13:36:13 -04:00
Jason Rhinelander
362fda5a56 Combine empty + pop into single call 2021-11-15 13:36:09 -04:00
Jason Rhinelander
b03f3c2d79 Remove another unwanted unconditional PumpLL 2021-11-15 13:36:03 -04:00
Jason Rhinelander
9113a6b36b Triggered pumping
This redoes how/when we pump so that we should only be calling the
idempotent PumpLL() when we actually have (or may have) something to
pump.
2021-11-15 13:35:57 -04:00
Jason Rhinelander
bfc6d35b33 Simplifications & C++17
- Modernize some iterator loops
- Simplify a couple places by using `if (init; ...)`
- Replace various std::binds with lambdas
2021-11-14 10:11:00 -04:00
Jason Rhinelander
41807f1763 transit hop: drop instead of flushing when full
If full happens we are going to trigger a bunch of flushes which
probably isn't very useful, so drop instead.
2021-11-14 10:10:58 -04:00
Jason Rhinelander
cf5c4e7284 outbound_message_handler: skip instead of aborting on removed paths 2021-11-14 10:10:19 -04:00
Jason Rhinelander
633431be66 Make outbound message queue PumpLL again if it doesn't send all 2021-11-14 10:10:19 -04:00
Jason Rhinelander
faf95cbd0a Allow a nullptr callback for event loop PumpLL 2021-11-14 10:07:31 -04:00
Jeff Becker
8a9025e234 only pump path context in idempotent pumpll 2021-11-14 10:07:31 -04:00
Jeff Becker
bb86996acf make event loop pump function non idempotent 2021-11-14 10:07:31 -04:00
Jeff Becker
8744c93944 prevent 100% cpu usage on service nodes
call_soon wakes up the mainloop and is often reentrant, we dont want to
ever way up the event loop but we also want to always defer the call so
we always use the workers
2021-11-14 10:07:11 -04:00
Jeff Becker
22d4b88edc
make PumpLL idempotent to reduce cpu use a bit 2021-11-09 11:59:57 -05:00
Jason Rhinelander
1ddfb7420a
Merge pull request #1791 from majestrate/exclude-failing-from-queue-2021-10-29
exclude fully failed nodes from service node testing list
2021-10-29 14:44:16 -03:00
Jason Rhinelander
0ec50e6624 Fix comment typo 2021-10-29 11:52:54 -03:00
Jeff Becker
fcba709fcb
do not requeue nodes for testing from failing queue if we do not have them marked as failing anymore 2021-10-29 10:46:50 -04:00
Jeff Becker
6c70022dcc
check for intersecting ip ranges correctly, add unit test 2021-10-22 15:53:19 -04:00
Jason Rhinelander
52492c6253 make format 2021-10-16 15:16:55 -03:00
Jason Rhinelander
1e22417ade Add missing deprecated copy assignment operator
Clang-13 warns (and -Werror dies) without it.
2021-10-16 15:16:55 -03:00