Commit Graph

4801 Commits

Author SHA1 Message Date
Jason Rhinelander
2a27698016
Fix backwards from/to in PacketSource_Wrapper
This resulted in DNS responses in Windows having reversed direction when
reinjected, and thus not arriving as expected.
2022-09-19 20:26:37 -03:00
Jason Rhinelander
7a0d4a905e
fix speeling 2022-09-19 20:26:37 -03:00
Jason Rhinelander
07231dd9e1
Fixed crash in DNS resolving
The inner lambda here wasn't keeping the `Query` (`this`) alive, so
`src` wasn't valid anymore.  This changes it to copy the `src`
shared_ptr into the lambda instead of capturing `this`, and fixes it.
2022-09-19 20:26:36 -03:00
Jason Rhinelander
d4739d5d47
Fix sockaddr_len initial value 2022-09-19 20:26:36 -03:00
Jason Rhinelander
b856b78de3
format 2022-09-19 20:26:36 -03:00
Jason Rhinelander
05ed9d6de0
llarp/dns logging refactor
Convert everything in llarp/dns to new-style logging.
2022-09-19 20:26:36 -03:00
Jason Rhinelander
49223a7853
bind/close to find free UDP port
The current code isn't working and gives a 0 (which then fails unbound
initialization).  This replaces it by doing a socket+bind to find a free
port then immediately closes (but passes the port we got into unbound).
2022-09-19 20:26:36 -03:00
Jason Rhinelander
9921dd6c77
Simplify dll loading via static function pointers
- Replaces RAII handling of DLLs with global function pointers.  (We
  don't unload the dll this way, but that seems unnecessary anyway).
- Simplifies code by just needing to call an init function, but not
  needing to pass around an object holding the function pointers.
- Adds a templated dll loader that takes the dll and a list of
  name/pointer pairs to load the dll and set the pointers in one shot.
2022-09-19 20:26:36 -03:00
Jeff Becker
281fbe57f7
promote log statement 2022-09-19 20:26:36 -03:00
Jason Rhinelander
aee618e0d7
Fail if wintun can't retrieve its version 2022-09-19 20:26:36 -03:00
Jason Rhinelander
84ad0ab4d3
Slightly DRY thread-setting code, fix warning
There were warnings from the rc variable being unused; this DRYes it to
use the same code as linux (including the failure check on rc).
2022-09-19 20:26:36 -03:00
Jason Rhinelander
4065413977
Simplify/fix ip_header layout
ip_header wasn't 20 bytes on windows compilations for some unholy
reason.  This restructures it to avoid the template and just use two
different structs for le/be with a condition_t for the ifdef, which
resolves it (and *also* apparently avoids the need for the pack).

Also add a static_assert to check the size.

Also do the same for ipv6.
2022-09-19 20:26:35 -03:00
Jason Rhinelander
58eec9ed11
Avoid strict aliasing warning on function pointers
Cast via an ordinary function pointer rather than a function pointer
reference to avoid the warning.

Also make the pointer in `Func_t` explicit rather than implicit (deduced
into the `Func_t` type) to make it clearer what is going on here.
2022-09-19 20:26:35 -03:00
Jason Rhinelander
dd16158081
DNS: default to 127.3.2.1 & high port on Linux
Lots of tools struggle with non-default DNS port, so keep a listener on
127.3.2.1:53 (by default).

This required various changes to the config handling to hold a vector
(instead of an optional) of defaults and values, and now allows passing
in an array of defaults instead of just a single default.
2022-09-19 20:26:35 -03:00
Jeff Becker
beb07bf46f
small optimizations and fixes
- Ensure ip header struct is packed
- Use fmt
- add missing header
2022-09-19 20:26:28 -03:00
Jason Rhinelander
cfd80f6a17
Fix buffer_printer overflow 2022-09-19 20:25:52 -03:00
Jason Rhinelander
f168b7cf72
llarp_buffer_t: rename badly named operator==
It didn't do equality, it did "does the remaining space start with the
argument" (and so the replacement in the previous commit was broken).

This renames it to avoid the confusion and restores to what it was doing
on dev.
2022-09-19 20:25:51 -03:00
Jason Rhinelander
b9c9ee1ca7
Fix read problem in linux
errno is only set if read returns < 0 and won't be set to 0 if read
succeeds, so we were bailing here frequently on successful reads
(whenever errno happened to be non-0).
2022-09-19 20:25:51 -03:00
Jason Rhinelander
15443568db
Apply some lipstick to llarp_buffer_t
This class is cursed, but also broken under gcc-12.  Apply some lipstick
to get it moving again (but we really need to refactor this because it
is a mess).
2022-09-19 20:25:51 -03:00
Jeff Becker
a02679b87a
revise ./contrib/format.sh 2022-09-08 14:25:00 -04:00
Jeff Becker
7f27760c97
disable lokinet-bootstrap on windows builds 2022-09-08 14:25:00 -04: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
d846bab0e1
unbreak android config loading 2022-09-08 14:23:53 -04:00
Jeff
baddad9564
remove compat wrapper 2022-09-08 14:23:53 -04:00
Jeff
253d22db4f
restucture dbus parts
* move dbus into llarp/linux/dbus.hpp and llarp/linux/dbus.cpp
* provide platform abstraction for setting dns in preparation for network manager
2022-09-08 14:23:53 -04:00
Jeff
2d586145ee
wire up dns srv records 2022-09-08 14:23:52 -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 Becker
bf2488d9e8
zero copy compare 2022-09-08 11:22:36 -04:00
majestrate
a8c0f76e1c
Merge pull request #1971 from majestrate/docs-and-such-2022-08-06
more docs
2022-09-03 08:03:28 -04:00
Jason Rhinelander
ceed8e3238
Remove unused parameter names 2022-08-30 15:53:40 -03:00
Jeff
4c897f583c
fix up log statements
* make socket bind errors have a distinct message reported when caught using their own exception type
* omit printing banner in setup when we run from the lokinet executable (but not the liblokinet.so entry point)
2022-08-22 16:50:46 -04:00
Jeff
badf72838e
move all code directory readmes into docs/project-structure.md 2022-08-21 12:18:09 -04:00
Jason Rhinelander
2b7b1fcc79 Working signed macOS GUI build 2022-08-12 21:13:39 -03:00
Jason Rhinelander
496c1d274c Stub out the peer stats sqlite_orm code
This avoids needing to build it and include it in static builds since we
aren't currently making use of it.
2022-08-12 21:13:39 -03:00
jeff
b8896740de build gui and assemble app bundles into one singular app bundle 2022-08-12 21:13:38 -03:00
jeff
279b5710cc maker packet tunnel provider compile 2022-08-12 21:13:38 -03:00
Jason Rhinelander
09372994bb macOS system extension support
Adds support for building Lokinet as a system extension, and fixes
various problems in the macos implementation found during development of
the system extension support.
2022-08-12 21:13:38 -03:00
Jeff
61d7ff3787 on apple write packets back to interface when it is for us because that does not have a route spec for the interace ip on loopback as apple finds having sensible defaults bothersome internally 2022-08-12 20:23:00 -03:00
Jason Rhinelander
e97752734d Fix platform::is_apple value 2022-08-12 20:23:00 -03: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
Jeff
2d1645bfe1 fix up sid ci pipeline 2022-08-06 16:04:25 -04:00
Jeff
58052f5b17 macos ci fixes 2022-08-06 16:04:25 -04:00
majestrate
7a8331e79d
Merge pull request #1961 from majestrate/rc-expiration-reeanble-07-18-2022
re enable rc expiration
2022-07-26 12:07:40 -04:00
Jeff
d0408a1c4e
remove invalid entries on loading nodedb 2022-07-26 11:05:31 -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
cc2b4df676
kill log statements 2022-07-26 09:45:58 -04:00
Jeff
3337125110
re enable rc expiration 2022-07-26 09:43:45 -04:00
Jeff
23fd46c0db
add directory specific readmes 2022-07-26 09:26:28 -04:00
majestrate
769bc1e8df
Merge pull request #1962 from jagerman/dns-parsing-fixes
DNS message parsing fixes and cleanup
2022-07-24 11:16:39 -04:00