Commit Graph

263 Commits

Author SHA1 Message Date
Hamish Coleman
439939dc7b Simplify tuntap_open by using one function prototype for all OS 2023-08-03 21:40:31 +01:00
Hamish Coleman
6ddaaaa917 Move win32 specific file to the right dir 2023-07-31 20:56:49 +01:00
Hamish Coleman
83078c8104 Simplify win32 build process
When building on win32 systems, simply add the win32 specific functions
to the libn2n.a, which simplifies the commands needed.

By moving the win32 source code into the src directory, the source code
is better consolidated.
2023-07-31 20:56:49 +01:00
Hamish Coleman
b22c57a16f Dont require special build flags for just one header 2023-07-03 02:51:20 +08:00
Hamish Coleman
e79616dc8b Dont include unneeded headers 2023-07-03 02:51:20 +08:00
Hamish Coleman
433b14c52f Simplify openssl library detection and macros 2023-07-02 22:18:09 +08:00
Hamish Coleman
473b89c963 Simplify build system by using standard macro
Most environments have predefined macros that identify the environment
to the source code.  If we use these macros instead of defining our own
then there is one less parameter difference to keep track of with
different builds

cf:
    http://web.archive.org/web/20191012035921/http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
    https://sourceforge.net/p/predef/wiki/OperatingSystems/
2023-07-01 19:08:43 +08:00
Hamish Coleman
3c9a170b12 Some header simplification 2023-06-25 22:40:46 +08:00
Hamish Coleman
a2c78e140a Minor fixes for FreeBSD 2023-06-25 19:25:00 +08:00
Hamish Coleman
cfc9c8c10d Simplify and make more consistant the pthread library 2023-06-25 17:56:09 +08:00
Hamish Coleman
21ac30c121 Use the correct modern windows sockets header
As suggested in a PR from @Legend-Master (this change is basically
unrelated to the main point of his PR, so extracted here)

Windows is a confusing and disappointing development environment.  They
completely replaced all the definitions in winsock.h with exact
equivalents in winsock2.h (except for a small number of deprecated
functions).

However they didnt make them mutually exclusive - so if you include
both, you get errors.  They also automatically include winsock.h from
windows.h, so you must remember to include winsock2.h first.  They also
didnt just remove winsock.h and replace it with the new contents.

(Probably in the name of "compatibility", whilst swearing that the new
winsock is the same as the old one - because if you cannot believe two
inconsistent things simultaneously, you shouldnt be a windows
programmer)

All these things are totally nuts.  Thanks, windows dev environment,
for not noticing that this is nuts
2023-06-25 02:46:03 +08:00
Hamish Coleman
4f9a7d31d3 Fix bug in returned interface address 2023-06-24 23:31:20 +08:00
Hamish Coleman
a7fc1c2bbc Merge branch 'dev' into iwyu 2023-06-18 12:31:58 +01:00
Hamish Coleman
585b3cec59 iwyu: n2n.h
There is still cleanup work to be done in the headers, but this
concludes the major include-what-you-use refactoring.  No functional
change is intended or expected and all tests are passing.

It is now a lot easier to see what is used from each header and work on
possible refactoring in the future.

The include-what-you-use tool is awkward to use with the current state
of the build system - and will always be difficult to use in a
multi-platform safe way.  However, I hope to provide a non manual
process for running with the tool in the future.
2023-06-18 12:14:23 +01:00
Tony
76cbff370e
Fix purgeable is always false on supernode peer list (#1117)
* Fix purgeable is always false on sn peer list
- And change sn_purge to bool

* Change all keep_on_running to bool

* Fix wrong `keep_running` type
2023-06-18 08:58:49 +01:00
Hamish Coleman
14780a72d3 iwyu: aes.c 2023-06-14 21:22:25 +01:00
Hamish Coleman
8e1d63fa51 iwyu: tf.h 2023-06-14 20:59:09 +01:00
Hamish Coleman
4e0bec79b7 iwyu: speck.h 2023-06-14 20:30:43 +01:00
Hamish Coleman
3ad14dc6a7 iwyu: missed deletions 2023-06-14 20:26:21 +01:00
Hamish Coleman
f67cc8f2a6 iwyu: random_numbers.h 2023-06-14 20:14:11 +01:00
Hamish Coleman
15ad901b41 iwym: pearson.h 2023-06-14 20:02:54 +01:00
Hamish Coleman
04ce678969 iwym: json.h 2023-06-14 19:52:10 +01:00
Hamish Coleman
4838dd8d75 iwym: header_encryption.h 2023-06-13 22:38:47 +01:00
Hamish Coleman
20df771af7 iwym: cc20.h 2023-06-13 21:45:11 +01:00
Hamish Coleman
ae3d54eed6 iwym: auth.h 2023-06-13 21:24:30 +01:00
Hamish Coleman
267b297150 Switch build date to use the last commit time
This reduces binary changes if the same commit version is re-built
2023-05-08 16:46:01 +01:00
Hamish Coleman
40c99fcdee
Merge pull request #1094 from hamishcoleman/autoconf
Autoconf Refactoring
2023-05-04 11:03:00 +08:00
Dylan Yee
e01daf4a85
support linux l2 bridge (#1044)
* support linux l2 bridge

* unified timeout name

* typo

* minor code style adaptions

* feature define

* feature define

* feature define

* feature define

* added hint to bridging to help output

* added hint to bridging

* drafted bridging documentation

* added bridging hint

---------

Co-authored-by: Logan oos Even <46396513+Logan007@users.noreply.github.com>
2023-05-04 11:00:38 +08:00
Hamish Coleman
1accc76ad3 Fix the building the win32 subdir.
It looks like the github windows build environment is not correctly
inheriting environment variables.  Which is strange, as that has not
been changed with the recent updates.  Include the vars directly as a
workaround (and plan to refactor later)
2023-04-30 20:40:50 -05:00
Hamish Coleman
3cef9949c2 Remove the non-maintained CMake build system.
It is difficult to maintain one build system, let alone two - especially
if one build system is known to be better maintained and the other build
system continues to be used - with bug and feature requests raised
against it.

The maintainers are aware that there are people using the CMake system,
but believe that the extra maintainability of only having one build
system, combined with the knowledge that the current CI system
demonstrates that all supported architectures are working with the
Makefiles make the use of these Makefiles a more sustainable direction.
2023-04-19 17:06:45 +08:00
Logan oos Even
2ee7dfdb98
added Windows support to n2n-route tool (#1023)
* added Windows support to n2n-route tool

* fixed includes

* more include fixes

* one more include addition

* more compile fixes

* wish I had a working Windows VM

* fixed some more Windows compile errors

* considered Windows-specific lib linkage

* promised to never code OS specific tools again

* removed invisible invalid characters

* where to get if_idx from

* retrieving interface index for route

* bracket...

* one more bracket...

* added optional gateway parameter to user-defined routes

* clarification

* clarification

* Windows needs special network init

* adapted waiting-for-key
2023-02-03 17:01:57 +01:00
Logan oos Even
cf23457d3b
added sock type field to data structure (#1031) 2022-06-28 19:09:04 +02:00
Logan oos Even
053ab381b3
fixed endianess issue in federated sn socket forwarding (#1030) 2022-06-28 16:53:12 +02:00
Logan oos Even
95cfbca5a9
more sockaddr generalization (#1028) 2022-06-27 22:21:03 +02:00
Logan oos Even
439dfc6886
generalized sockaddr usage in edge (#1026) 2022-06-26 17:17:22 +02:00
Logan oos Even
ffb4e31b8a
encapsulated several fillings of n2n_sock_t in single function (#1025)
* encapsulated several fillings of n2n_sock_t in single function

* Windows specifics...

* stuck to the project's style code
2022-06-26 00:07:29 +02:00
Logan oos Even
7927bd7294
added optional choice of bind address (-p) to supernode (#1016) 2022-06-16 12:00:48 +02:00
Logan oos Even
51a3a71f95
introduced n2n-portfwd tool (#1008)
* moved dev to version 3.1.1

* introduced n2n-portfwd tool

* moved port-forwarding source to tool

* adjusted tiny things, seemingly works with ./configure's  --enable-miniupnp  and  --enable-natpmp

* adjusted for Windows

* wished for better typing skills

* applied some finishing touch

* typo
2022-06-05 18:05:40 +02:00
Logan oos Even
99b6b6b66d
added n2n-route tool (#982)
* moved dev to version 3.1.1

* laid ground for n2n-route tool

* adapted code style

* overhauled n2n-route's tool program logic and removed route code from edge

* added missing initialization of federation's purgeable field

* lifted un/purgeable confusion

* added warning about removed -n cli option

* realized that Windows does not offer inet_aton()

* removed -n option documentation from edge's man page

* slightly simplified n2n-route program logic

* applied more logic changes to n2n-route tool

* added 'info' read command to edge's management port

* corrected indention

* added Linux route control to n2n-route tool

* temporarily restricted n2n-route tool to Linux only

* We must be over the routing!

* pulled default gateway change detection into main loop to cover mobile use, and added devstr_t type

* corrected use of new UNPURGEABLE - so far gone unnoticed

* addresses possiible address issue

* i broke it

* reverted bad ideas

* added command line options, help text, and prevented vpn gateway being used for supernode/peer traffic routes

* added option to manually provide default gateway, also verbosity options

* getting there

* added option to limit networks to be routed (-n), adapted documentation

* fine-tuned minor things
2022-05-24 20:38:51 +02:00
Luca Deri
aecb97042e Added missing dependency #989 2022-05-06 22:29:49 +02:00
Hamish Coleman
3fa0fa1bbe
Merge pull request #983 from hamishcoleman/json_pubsub
Refactoring management code to increase sharing
2022-04-30 18:21:36 +01:00
Hamish Coleman
009311d016
Provide better details when sendto_fd fails (#981)
* Refactor traceEvent to allow variable log levels

* Refactor sendto failed for less repetition

* Refactor sendto_fd to make control flow clearer, also reduce repetition

* Tie size to the actual object not its class

* Show destination that had issues when sendto_fd fails

* Fix MSVC compile - it doesnt support the same variadic macros as gcc
2022-04-25 19:13:14 +02:00
Hamish Coleman
16f7f4dc59 Fiddle with windows headers 2022-04-17 00:37:02 +01:00
Hamish Coleman
9728a36a56 Increase includes reusability and consistency 2022-04-17 00:25:04 +01:00
Logan oos Even
e686b9592c
(C) update (#965) 2022-03-12 10:22:42 +01:00
Logan oos Even
f59c6900a1
moved compression code into transforms (#961) 2022-02-21 10:09:06 +01:00
Hamish Coleman
860b27d97c Add event publishing for adding and removing P2P peers 2022-02-05 20:06:31 +00:00
Hamish Coleman
a40ed15d93 Add pubsub system to edge, with one example TEST channel 2022-02-05 20:06:31 +00:00
Hamish Coleman
3fd1dc5fa8 keep private enum definition local to the management code 2022-02-05 20:06:31 +00:00
Hamish Coleman
ace3dbc44f Move all supernode management handling into one source file 2022-02-05 20:06:31 +00:00