64 Commits
Author SHA1 Message Date
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
TonyandGitHub 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
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
Logan oos EvenandGitHub 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
Hamish Coleman 9728a36a56 Increase includes reusability and consistency 2022-04-17 00:25:04 +01:00
Logan oos EvenandGitHub e686b9592c (C) update (#965) 2022-03-12 10:22:42 +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
Logan oos EvenandGitHub 3b187b4ac8 updated JSON API password handling '--management-password <pw>' (#869) 2021-10-24 15:22:36 +05:45
Logan oos EvenandGitHub c61b62ab1b choose supernode selection strategy at run-time '--select-rtt' (#864) 2021-10-24 12:53:25 +05:45
Hamish ColemanandGitHub 80b33cd1a9 Basic C Code lint checker and shell checker (#859)
* Factor build packages out into a more maintainable list

* Create a location for scripts to live

* Provide a make target to return the source dir as close as reasonable to the original distributed state

* Add a code lint step, checking the coding style

* Change test harness as recommended by shellcheck

* Ensure we actually have the linter tool installed

* Use the correct directory for cmake to run the tests

* Adjust for the older uncrustify in the current github ubuntu-latest

* Make one file pass the linter

* Integrate the lint with the existing test workflow

* Add files with minimal changes needed to the linter

* Add more files with minimal changes needed to the linter

* Dont build binaries if we fail the lint test

* Update the phony targets with the lint steps

* Ensure the flake8 package is installed in the new lint workflow job

* Use the makefile to drive the packages needed to install for linting

* No need to add dependancies on lint, just rely on the workflow status to show failure

* Update the scripts dir README to reflect current assumptions

* Rename and briefly document the indent.sh script

* Fix the ignore to ignore the right Makefile

* Rename the test_harness script to make it clear it is a shell script

* Provide a master lint make target and add a shell script lint tool

* Elminate stray tabs

* Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
2021-10-24 01:21:18 +05:45
Hamish ColemanandGitHub e6fcf1c55b Cleanup and Documentation for JSON management API (#856)
* Reimplement JSON mgmt with clear separation of read/write actions

* Reduce boilerplate by using a table driven command definition for json mgmt commands

* Port tools to use new json api

* Add a basic authentication for json mgmt commands

* If a auth key is given, it must match

* Add auth key to management scripts

* Add a flag bitfield to clearly turn the tag param into a options list

* Allow simple pass-through of any command from n2nctl

* Convert the n2nctl to use an object oriented interface

* Handle sigpipe in the n2nhttpd - this happens if the remote client disconnects unexpectely

* Remove some repetition from the server

* Use the correct options to allow reuseaddr

* Dont generate a scary message on ctrl-c

* Convert n2nhttpd to use object based RPC

* Use the same longopt for both tools

* Pass any extra args through to the RPC

* Add some documentation for the scripts in the repository

* Spelling fix

* Add documentation for the JSON reply mangement API
2021-10-18 02:01:42 +05:45
Logan oos EvenandGitHub db5adc2038 fine-tuned REGISTER cookie handling (#837) 2021-10-03 18:19:29 +05:45
Logan oos EvenandGitHub bc65a7f59e added forwarded REGISTER cookie type (#836) 2021-10-03 05:24:33 +05:45
Logan oos EvenandGitHub 5a93fdf166 created space for more REGISTER type cookies
... to allow better differentiation between several (future) REGISTER / ACK transmission paths
2021-09-27 02:29:29 +05:45
Logan oos EvenandGitHub 7fa0cc1e0a added preferred socket handling (-e) (#765) 2021-09-09 14:07:29 +05:45
skyformat99andGitHub 6f63f401fe updated for compilation with VS2015 (#739) 2021-07-26 12:53:05 +05:45
Logan oos EvenandGitHub c35129b8e2 added 'reload_communities' command to supernode management port (#740) 2021-07-24 03:46:50 +05:45
Logan oos EvenandGitHub 84d0991977 fortified user/pw auth scheme (#731) 2021-07-21 02:52:38 +05:45
Logan oos EvenandGitHub 3c6ab56d3f allowed (temporarily) initially non-resolving supernode names (#701) 2021-06-05 17:54:32 +05:45
Logan oos EvenandGitHub c55e3e3246 multithreaded supernode name resolution (#645) 2021-06-04 03:52:12 +05:45
Logan oos EvenandGitHub a28327a0af added user-password edge authentication (#673) 2021-06-04 03:11:22 +05:45
Logan oos EvenandGitHub 20133f599c improved socket handling (#650) 2021-03-01 14:13:14 +05:45
Logan oos EvenandGitHub a482fe112d added TCP support (#627)
(disabled on Windows)
2021-02-22 22:37:47 +05:45
Logan oos EvenandGitHub fb827a843b reworked edge management port output (#623) 2021-02-06 18:24:08 +05:45
Logan oos EvenandGitHub 09e8d5e730 limited number of concurrently pinged supernodes (#619) 2021-02-01 18:31:36 +05:45
Logan oos EvenandGitHub ba9a32fb30 fixed minor timing issues (#616) 2021-01-31 21:12:08 +05:45
Logan oos EvenandGitHub c0c472b4aa revised bootstrap (#599) 2021-01-25 16:54:38 +05:45
Logan oos EvenandGitHub e4e6efacf0 enhanced header encryption to full 128 bit iv (#589) 2021-01-17 18:37:17 +05:45
Logan oos EvenandGitHub 9ee62d7415 rebased time stamp format: header encryption (#579)
* rebased time stamp format (header encryption)

* rearranged time stamp fields
2021-01-12 14:28:21 +05:45
Francesco CarliandGitHub 54f6da4cf4 Change space indention (#557)
* change space indention

* change space indention
2020-12-24 14:56:29 +01:00
Francesco CarliandGitHub 646da54915 readability code clean-up (#545) 2020-12-19 12:28:45 +01:00
Francesco CarliandGitHub 3bd4635f04 Protection mechanism against duplicated MACs (#509)
* Prevent duplicated MACs

* Prevent duplicated MACs

* Fix compile errors

* Fix compile errors

* Implement auth scheme

* Fix compile errors

* Add auth_edge

* Add auth_edge

* Implement REGISTER_SUPER forwarding

* Add argument to update_edge

* Add auth field to supernode struct

* Add REGISTER_SUPER_NAK handling

* Fix issues

* Code clean-up

* Move auth token initialization
2020-11-19 09:31:24 +01:00
1574f1e1c6 added payload struct to carry supernode data (#501)
* added payload struct to carry supernode data

* added payload struct to carry supernode data

* added payload struct to carry supernode data

Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
2020-11-13 10:55:00 +01:00
lucaderi 72d5243650 Include rework to avoid circular dependencies, single place for typedefs and compilation on all platforms that don't like type redefinition 2020-11-13 09:28:52 +01:00
Francesco CarliandGitHub 8915609f1a Implement a load-based supernode selection strategy on edges (#493)
* Implement load-based selection strategy

* Update n2n_wire.h

* Update edge_utils.c

* Update n2n.c

* Update sn_utils.c

* Update edge_utils.c
2020-11-11 09:27:39 +01:00
Francesco CarliandGitHub e65fd984d7 Packet forwarding between supernodes (#486)
* Packet forwarding between supernodes

* Update wire.c
2020-11-10 16:34:49 +01:00
Francesco CarliandGitHub dcbc39c0fb Update REGISTER_SUPER_ACK handling on edge (#478) 2020-10-27 17:02:35 +01:00
Francesco CarliandGitHub ed25ff8d01 Fixes minor issues introduced by #460 (#461) 2020-10-11 21:54:06 +02:00
Luca Deri f6e4047ce0 Partial fixes for addressing compilation issues introduced by https://github.com/ntop/n2n/pull/460 2020-10-11 11:57:48 +02:00
Francesco CarliandGitHub 8dfffd9fbe Implement purge-and-re-registration process for supernodes (#445) 2020-10-01 16:23:10 +02:00
francesco_carliandGitHub d9e2a0091a Handle REGISTER_SUPER from other supernodes (#443)
* Handle REGISTER_SUPER from other supernodes

* Update wire.c
2020-09-29 10:50:09 +02:00
francesco_carliandGitHub 746962510f Add new enum data type and indicators 2020-09-24 20:00:32 +02:00
Logan007 df869bfd3b merged edge's subnet parameter into address parameter 2020-09-21 13:37:06 +05:45
Logan007 2c77729acf removed jitter allowance for systemic packets 2020-09-19 15:47:16 +05:45
Logan007 7a06bf39db made compression scheme name accessible even if not compiled 2020-09-10 14:08:08 +05:45
Logan007 58d0e906be cosmetics on random numbers code 2020-08-30 14:14:35 +05:45
Logan007 a35675da4d internally renamed dhcp --> auto ip 2020-08-19 14:46:58 +05:45
Logan007 78409df1c8 let auto ip feature handle several sub-networks 2020-08-18 22:35:27 +05:45