Commit Graph

557 Commits

Author SHA1 Message Date
Jason Rhinelander bd869b3b07 Log demotion
Demote a couple spammy messages to trace level.
2022-10-14 20:37:19 -03:00
Jason Rhinelander 82e2e6fb10
bake in bootstrap fallbacks at build time
also change the defailt/fallback bootstrap file for testnet to be a list
of RCs (albeit of size 1) rather than just an RC dict.
2022-10-06 13:59:49 -03:00
Thomas Winget 82c95a2486
don't ping core if active with too few peers
If running as a service node, we ping core on a regular interval to
inform it we're running and in a good state.  If we're an active
(not decommissioned or deregistered) service node and have too few
peers and thus we're not actually connected to lokinet, we should skip
that ping so core doesn't think we're ok.
2022-10-06 13:59:49 -03:00
Thomas Winget cc1bcf86fa
Fallback bootstrap router build parameter
Adds a fallback bootstrap file path parameter to CMake, specify
-DBOOTSTRAP_SYSTEM_PATH="/path/to/file" to use.

Adds a list of (currently 1) obsolete bootstrap RouterIDs to check
bootstrap RCs against.  Will not use bootstrap RCs if they're on that
list.

Log an error periodically if we appear to be an active service node but
have fewer than a set number (5) known peers.

Bumps oxen-logging version for literal _format.
2022-10-06 13:59:47 -03:00
Jason Rhinelander ebdb37ac77
Significantly decrease decomm warning frequency
30s is insanely fast for a error level log statement and spams logs
incessantly; reduce it to repeating once every 5 minutes.
2022-10-06 13:58:26 -03:00
Thomas Winget eaf30de1fd
omq rpc log subscription
respects whether RPC is enabled, removes the log sink otherwise

bumps oxen-mq and oxen-logging
2022-10-06 11:56:04 -03:00
Jeff 871c3e3281
changeset for windows port
* wintun vpn platform for windows
* bundle config snippets into nsis installer for exit node, keyfile persisting, reduced hops mode.
* use wintun for vpn platform
* isolate all windows platform specific code into their own compilation units and libraries
* split up internal libraries into more specific components
* rename liblokinet.a target to liblokinet-amalgum.a to elimiate ambiguity with liblokinet.so
* DNS platform for win32
* rename llarp/ev/ev_libuv.{c,h}pp to llarp/ev/libuv.{c,h}pp as the old name was idiotic
* split up net platform into win32 and posix specific compilation units
* rename lokinet_init.c to easter_eggs.cpp as that is what they are for and it does not need to be a c compilation target
* add cmake option STRIP_SYMBOLS for seperating out debug symbols for windows builds
* intercept dns traffic on all interfaces on windows using windivert and feed it into lokinet
2022-09-08 14:24:59 -04:00
Jeff 74362149eb
refactor dns subsystem
we want to be able to have multiple locally bound dns sockets in lokinet so
i restructured most of the dns subsystem in order to make this easier.

specifically, we have a new structure to dns subsystem:

* dns::QueryJob_Base

base type for holding a dns query and response with virtual methods
in charge of sending a reply to whoever requested.

* dns::PacketSource_Base

base type for reading and writing dns messages to and from wherever they came from

* dns::Resolver_Base

base type for filtering and handling of dns messages asynchronously.

* dns::Server

contextualized per endpoint dns object, responsible for all dns related isms.

this change hides all impelementation details of all of the dns components.
adds some more helper functions for parsing dns and dealing with OwnedBuffer.

overall dns becomes less of a pain with this new structure. probably.
2022-09-08 14:23:52 -04:00
Jeff 4341b8c684 do not clear out entries that are valid from nodedb when we are a service node.
this logic was inverted.
2022-08-07 13:44:48 -04:00
Jason Rhinelander f230a3f695
Add debug logging for RC removal 2022-07-26 11:26:35 -03:00
Jason Rhinelander a190c14889
Fix comment 2022-07-26 11:26:07 -03:00
Jeff 3337125110
re enable rc expiration 2022-07-26 09:43:45 -04:00
Jason Rhinelander 874221db70
Merge pull request #1965 from jagerman/fix-double-logging
Remove the initial sink before reconfiguring logging
2022-07-22 12:20:18 -03:00
Jason Rhinelander 841abffaf5
Make outbound wildcard default to inbound IP
outbound=:1234
    outbound=0.0.0.0:1234
    outbound=
    outbound=0.0.0.0

now all default to use the inbound= IP.  (If multiple inbound= IPs are
given, we raise an exception to abort startup).

Only applies to routers (since clients don't have inbound IPs), and
eliminates potential weird edge cases with local system IP and routing
shenanigans.
2022-07-21 17:53:25 -03:00
Jason Rhinelander f0590a9672
Remove the initial sink before reconfiguring logging
Without this, the original sink set up very early in daemon/lokinet.cpp
(which goes to stderr) is still around, and so we get double logging.
2022-07-21 15:02:23 -03:00
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
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
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
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 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