Commit Graph

677 Commits

Author SHA1 Message Date
Jason Rhinelander
6df83b613d
Fix log level being forced to warning
This code shouldn't be here; the log level was already set to its proper
default value via the earlier FromConfig call.
2022-07-21 11:34:11 -03:00
Jeff
b819ed21d2
clean up build helper scripts:
* cleanup of android build shims
* cleanup of windows build shims
2022-07-20 13:36:04 -04:00
Jeff
68148e098f
* add mockable network functions
* add unit tests with ability to pretend to be different network setups
2022-07-20 13:36:03 -04:00
Jason Rhinelander
c82ade2d81
Make test code work with new logging 2022-07-18 12:59:13 -03:00
Jason Rhinelander
b81f7025c9
Replace logging with oxen-logger
Replaces custom logging system with spdlog-based oxen logging.  This
commit mainly replaces the backend logging with the spdlog-based system,
but doesn't (yet) convert all the existing LogWarn, etc. to use the new
format-based logging.

New logging statements will look like:

    llarp::log::warning(cat, "blah: {}", val);

where `cat` should be set up in each .cpp or cluster of .cpp files, as
described in the oxen-logging README.

As part of spdlog we get fmt, which gives us nice format strings, where
are applied generously in this commit.

Making types printable now requires two steps:
- add a ToString() method
- add this specialization:

      template <>
      constexpr inline bool llarp::IsToStringFormattable<llarp::Whatever> = true;

This will then allow the type to be printed as a "{}" value in a
fmt::format string.  This is applied to all our printable types here,
and all of the `operator<<` are removed.

This commit also:
- replaces various uses of `operator<<` to ToString()
- replaces various uses of std::stringstream with either fmt::format or
  plain std::string
- Rename some to_string and toString() methods to ToString() for
  consistency (and to work with fmt)
- Replace `stringify(...)` and `make_exception` usage with fmt::format
  (and remove stringify/make_exception from util/str.hpp).
2022-07-15 22:17:59 -03:00
Jason Rhinelander
3cd699fa7f
Show router pubkey at startup 2022-06-15 21:23:15 -03:00
Jeff
1eba0f836e
replace LLARP_PROTO_VERSION macro 2022-05-28 13:18:43 -04:00
Jeff
98b3860655
set source ip on service nodes for outbound link to not use all interfaces 2022-05-27 13:26:30 -04:00
Jeff
60ada470db
format systemd status as time deltas from now 2022-05-27 13:21:09 -04:00
Jeff
18e1272c76
add gossip info to systemd status
* adds next and last gossip datetimes
* adds a few things for time points, like ostream operator overloads for time point
2022-05-27 13:21:08 -04:00
Jeff
3c44a06403
publish our rc out to the network when we regenerate them 2022-05-27 13:21:08 -04:00
Jeff
5f496259b7
if we are decommissioned or deregistered, do not test other routers so we do not spam them.
disambiguiate error message to distinguish between decomissioned and deregistered.
2022-05-27 13:21:08 -04:00
Jeff
706e34c082
connect to routers even if we are decomissioned 2022-05-27 13:21:07 -04:00
majestrate
5b0ece3f9e
Update llarp/router/outbound_message_handler.cpp
add comment

Co-authored-by: Thomas Winget <tewinget@gmail.com>
2022-05-02 16:24:54 -04:00
Jeff
26c8063fc9
convert priority queues 2022-05-02 15:27:08 -04:00
Jeff
8960ca08f3
propagate link layer message priority to link layer so it can order retransmissions with that in mind 2022-05-02 15:27:07 -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
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
Audric Ackermann
d9467f4dee fix numPaths value in Router::ExtractSummaryStatus 2022-02-16 13:07:55 +11: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
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
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
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
Jason Rhinelander
09c2b31b25 Move paths pumping into PumpLL 2021-11-15 18:24:07 -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
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
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
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
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
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
Sean
e11a94c95c
RPC call for summary get_status (#1742)
* RPC call for summary get_status

* lint

* update with review notes

* further review points

* uint64_t
2021-10-13 07:20:36 -04:00
Jeff Becker
5c457ff486
refactor logging to use std::source_location
* use std::source_location instead of godawful macros in logging
* remove unused/absolutely haram af json logstream
* fix bug in android logger where it doesn't respect eLogNone
2021-10-06 11:10:48 -04:00
Jeff Becker
d1246947f7
SystemD DNS fix:
when dns is port 53 call SetLinKDNS otherwise call SetLinkDNSEx as on older versions of systemd-resolved SetLinkDNSEx is not available.
2021-09-16 17:52:30 -04:00
Jeff Becker
9ad63140f2
use std::sample to grab MaxGossipPeers when populating std::unordered_set 2021-09-03 17:45:08 -04:00
Jeff Becker
a739e7b532
try not to prefer outbound vs inbound link sessions
before when we get the list of router ids for gossip it was highly bias towards outbound sessions.
instead now we get a full list of link session router ids in random order, truncate them to be at most MaxGossipPeers number of keys, and then put them into an unordered set
2021-09-03 17:45:08 -04:00
Jeff Becker
d91ce53da1
limit RC gossip to 20 peers max 2021-09-03 17:45:08 -04:00