Commit Graph

77 Commits

Author SHA1 Message Date
Hamish Coleman
4b8aaa7f6e
Merge pull request #947 from hamishcoleman/json_pubsub
Add JSON pubsub framework for edge
2022-02-12 10:59:52 +00:00
Hamish Coleman
99d56a8a7b
Improve build docs (#952) 2022-02-09 21:30:26 +00:00
Hamish Coleman
f0d883fde8 of course, tuntap drivers are needed to run edge, so we cannot test that on darwin without writing a dummy tuntap driver 2022-02-05 20:06:31 +00:00
Hamish Coleman
ecaba980ba Attempt to simplify adding new tests 2022-02-05 20:06:31 +00:00
Hamish Coleman
e22e453d2c Add an integration test and a bunch of framework to support tests on multiple build systems 2022-02-05 20:06:31 +00:00
Hamish Coleman
84f69623e1 Dont forget to update the other build system 2022-02-05 20:06:31 +00:00
Hamish Coleman
e9fccd9932
Fix Cmake libpcap detection logic (#943)
* Fix cmake informational log messages

* If the correct library name is used find_library works better

* Re-enable remaining find_library users

* Reorder cmake to make libpcap detection work
2022-01-28 10:03:20 +00:00
Hamish Coleman
670aadcf1b
Address CMake config ordering requirements (#942)
For a moment there, I was starting to think that I might have found
a good feature in cmake, but then it turned out that it had specific
ordering requirements and strange cryptic functions that error out
in mysterious ways.

If I am going to have an antique build engine with special quirks that
I must learn in order to use it, I may as well choose the one that is
not also trying to be clever and hiding its internal magic from me.
Which means that I still prefer Makefiles - they are more debuggable.
2022-01-27 09:46:47 +00:00
Hamish Coleman
3856d62e8f
Fix bug in CMake conditional (Fixes #939) (#940) 2022-01-26 22:03:40 +00:00
Hamish Coleman
028d6f9b07
Harmonise configuration defaults (#937)
* Ensure all options start off for cmake too

* Attempt to make the build time config logic in the cmake process match the makefile process

* Add a simple muscle memory helper for cmake

* Ask them what they are smoking, then tell them to put it out

* Avoid occasional stale package cache errors
2022-01-25 20:11:02 +00:00
Logan oos Even
bca9968c91
re-enabled libnatpmp with CMake on Windows (#918) 2021-12-30 09:49:39 +01:00
skyformat99
dcfa27e9e2
updated CMakeLists.txt (#917)
fix  build error with CMake #916
2021-12-29 14:20:39 +01:00
Logan oos Even
e6919050d3
conditionally disabled libnatpmp support with CMake on Windows (#914) 2021-12-25 14:09:21 +01:00
Logan oos Even
e6e8cb038a
added port forwarding (upnp and natpmp) (#905)
* UPnP port redirection is supported.

* compile fixes

* compile fix

* optimize reconnection code

* prepared upnp threadification to counter main loop stall at supernode change

* NAT-PMP port forwarding support, temporarily merge codes to resolve conflicts.

* make compile fix

* prepared threadification in more detail

* adopted threadification to new file setup

* cleaned up

* renamed functions and data structures

* fixes

* differentiated between miniupnp and natpmp and added corresponding lib support to makefile

* name

* commented unused header includes

* comments

* license

* fixes

* fixes

* fixes

* NAT-PMP is already available.

* added CLI parameter to disable port forwarding if required

* preliminary made use of multithreading

* adjusted log level

* added man page documentation

* def'ed conf

* made pmpnat adjustments

Co-authored-by: fengdaolong <fengdaolong@gmail.com>
2021-12-23 12:27:55 +01:00
Hamish Coleman
e4e2aba420
Increase code Coverage (#897)
* Make it clear which hash we are testing

* Coverage for all pearson hash variants

* Initial coverage for auth.c

* Add some more auth.c coverage

* Ensure new bins are added to both build systems

* Ensure new source files are fully linted
2021-11-10 06:02:05 +00:00
Hamish Coleman
109b6e2fa5 Remove one remaining use of N2N_OSNAME and cleanup 2021-11-02 09:35:03 +00:00
Hamish Coleman
108c9436d5 Add robustness to the version calculations 2021-11-02 09:28:48 +00:00
Hamish Coleman
aafca3813a Use script to calculate the build version 2021-11-01 19:15:23 +00:00
Hamish Coleman
00a2bdc307 Remove all use of N2N_VERSION_SHORT in favor of PACKAGE_VERSION 2021-11-01 19:15:23 +00:00
Hamish Coleman
a9216f1097 Remove GIT_RELEASE variable and use the semantically identical N2N_VERSION instead 2021-11-01 19:15:23 +00:00
Hamish Coleman
430b0cb77d Fix CMakeFile version number embedded NL 2021-11-01 19:15:23 +00:00
Hamish Coleman
ff88803f6d Use one common file for the version number in both build systems 2021-11-01 19:15:23 +00:00
Luca Deri
9f2eb321de
Moved to 3.1 2021-10-27 20:42:25 +02:00
Hamish Coleman
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 Coleman
ae502d9181
JSON Reply Management API - feature parity with old management interfaces (#861)
* Ensure that recent code additions pass the linter

* Include some of the more obviously correct lint fixes to edge_utils.c

* Refactor edge JSON api into its own source file

* Use shorter names for static management functions

* Implement a JSON RPC way of managing the verbosity

* Tidy up help display in n2nctl script

* Make note of issue with implementing the stop command

* Implement a JSON RPC call to fetch current community

* Make n2nhttpd time value be more self-contained

* Make n2nhttpd order more closely match the existing management stats output

* Wire up status page to the verbosity setting

* Add JSON versions of the remainder of the edge management stats

* Add new file to cmake

* Properly define management handler

* Only update the last updated timestamp after a successful data fetch

* Function and types definition cleanup

* Force correct type for python scripts mgmt port

* Implement initial JSON API for supernode

* Fix whitespace error

* Use helper function for rendering peers ip4 address

* Proxy the auth requirement back out to the http client, allowing normal http auth to be used

* Ensure that we do not leak the federation community

* Use the same rpc method name and output for both edge and supernode for peers/edges

* Allow n2nctl to show raw data returned without resorting to tricks

* Make n2nctl pretty printer understandable with an empty table

* Use the full name for supernodes RPC call

* Use same RPC method name (but some missing fields) for getting communities from both edge and supernode

* Add *_sup_broadcast stats to edge packet stats output

* Refacter the stats into a packetstats method for supernode RPC

* Even if I am not going to prettyprint the timestamps, at least make all the timestamps on the page the same unit

* Simplify the RPC handlers by flagging some as writable and checking that in the multiplexer

* Remove invalid edges data

* Avoid crash on bad data to verbose RPC

* Avoid showing bad or inconsistant protocol data in communities RPC

* Minor clarification on when --write is handled

* Make linter happy

* Fix changed method name in n2nhttpd

* Move mainloop stop flag into the n2n_edge_t structure, allowing access from management commands

* Implement edge RPC stop command

* Move mainloop stop flag into the n2n_sn_t structure, allowing access from management commands

* Implement supernode RPC stop command

* Allow multiple pages to be served from mini httpd

* Extract common script functions into a separate URL

* Handle an edge case in the python rpc class

With a proper tag-based demultiplexer, this case should be a nop,
but we are single-threaded and rely on the packet ordering in this
library.

* Add n2nhttpd support to query supernode using urls prefixed with /supernode/

* Handle missing values in javascript table print

* Add another less filtering javascript key/value renderer

* Add a supernode.html page to the n2nhttpd

* Address lint issue

* Mention the second html page on the Scripts doc

* Remove purgable column from supernode edges list - it looks like it is rarely going to be set

* Add a simple one-line example command at the top of the API documentation

* Acknowledge that this is not the most efficient protocol, but point out that it was not supposed to be

* Make it clear that the n2nctl script works for both edge and supernode

* Fight with inconsistant github runner results

* Turn off the /right/ coverage generator
2021-10-23 11:05:05 +05:45
Hamish Coleman
b735ad6b9e
added test framework and code coverage reporting (#797)
* Add a simple test framework

* Add a code coverage report example oneliner

* Move the coverage report into a separate directory

* Add a github action to run tests and publish a branch with the coverage report

* Fix: Missing job separator

* Fix: remember to actually run configure

* Fix: Gotta autogen before I configure

* Dont try to upload coverage report unless this is a push

* Clearly show the git ref tested in the coverage report

* Add a test for the various transforms

* Add tests for the elliptic curve and pearson hash

* Ensure we ignore new generated output

* Remove unneeded boilerplate from the compression tests

* Add an example of a test of the encoded wire packets

* Ensure that correctly testable data is output even when zstd is not compiled

* Factor test runner out into its own script and attempt to add it to the cmake file

* Tell cmake about a new object file

* Stop trying to make Cmake work...

* Stop trying to make cmake work, round 2

* In the middle of a thousand lines of cmake output was one important one - windows could not find assert() - try again

* Try again to plumb the tests into cmake

* Add missing library to our superset install line

* Fix build error when libcap-dev is installed

* Switch to using artifact uploads instead of pages to store/show the coverage report

* Fix artifact upload yaml

* Upload coverage report to codecov

* Fix codecov - clearly it doesnt do a recursive search for coverage files

* Fix codecov - my hopeful use of a list of directories didnt work

* Fix codecov - unfortunately, it doesnt just consume the coverage data and needs us to generate the gcov output

* Fix codecov - nope, it still doesnt recursively search

* Fix codecov - it really helps if I run the gcov data generator

* Add a simple matrix build

* Fix older ubuntu versions of gcovr that do not support the '--html-title' option

* Ensure we use gcover options that are identical on older ubuntu

* Improve coverage generation and required build packages
2021-09-27 15:26:06 +05:45
Hamish Coleman
35ec7336a6
simplified the makefiles (#795)
* Move the makefiles towards a clearer arrangement

* Break circular make dependancy and start using implicit rules for most compilation

* Fix old cmake to compile again after renames
2021-09-16 18:34:04 +05:45
Logan oos Even
bc62b8be0a
changed default to pthread support again 2021-08-30 15:27:42 +05:45
Logan oos Even
70912300ca
updated CMakeLists.txt
disabled / undeffed global HAVE_PTHREAD due to #758 / #759
2021-08-30 12:46:07 +05:45
Logan oos Even
a1594bc976
Revert "Update CMakeLists.txt (#759)" (#760)
This reverts commit 921eb27482.
2021-08-30 12:43:09 +05:45
skyformat99
921eb27482
Update CMakeLists.txt (#759) 2021-08-30 11:24:10 +05:45
fengdaolong
04f0bd88e6
do not link if libpthread is not found (#757) 2021-08-29 13:27:17 +05:45
Logan oos Even
b0de090de4
Revert "correct wrong pthread lib switch logic (#755)" (#756)
This reverts commit 8e3fa33863.
2021-08-29 12:38:09 +05:45
fengdaolong
8e3fa33863
correct wrong pthread lib switch logic (#755) 2021-08-29 12:32:28 +05:45
fengdaolong
ae041c2133
CMakeLists.txt add link pthread library (#754) 2021-08-29 01:53:44 +05:45
Logan oos Even
7e0cbb10dc
updated CMakeLists.txt (#700) 2021-06-04 03:33:28 +05:45
fengdaolong
3a480a4a21
solved the problem that Windows cannot multicast (#576)
* Solve the problem that Windows cannot multicast.

* Better git judgment logic.
2021-01-12 14:26:40 +05:45
skyformat99
348d2baaf2
Update CMakeLists.txt (#510)
1)  add openssl version check
2) add  build option for  pcap lib : N2N_OPTION_USE_PCAPLIB
3) add build option for  libzstd  : N2N_OPTION_USE_ZSTD
2020-11-19 09:31:49 +01:00
skyformat99
11661a1cbf
Update CMakeLists.txt (#507)
* Update CMakeLists.txt

fix  #490 :
CMakeLists.txt error : made openssl & zstd support optional #490

* Update CMakeLists.txt

update message
2020-11-17 10:39:41 +01:00
joshuafc
b3f564e58c
Traffic Restrictions, Pass Build on CircleCI and local Windows 10 VS2019 (#499)
* Add new file 'network_traffic_filter.c/.h"

* Add feature to drop or accept specific packet transmit over edge network interface by rules.

* fix CMakeLists.txt typo

* Update Rule String Format

* replace -F (filter) with -R (rule) for traffic restrictions.

* Update edge help (-h)  message. Update documents.

* Pass Build on CircleCI and local Windows 10 VS2019

* Fix cmake build failed because of sn_selection

* fix operate void* cause vs2016 build failed

* Fix typo to pass build on windows.

* add inttypes.h for n2n_typedefs.h to pass windows build

* modify headers to pass build on windows.
2020-11-16 21:27:42 +01:00
vtcpip
a45676e131
Fixed edge linking error under mingw (#492) 2020-11-10 16:35:48 +01:00
joshuafc
a840aebb83
Add feature to drop or accept specific packet transmit over edge network interface by rules. (#489)
* Add new file 'network_traffic_filter.c/.h"

* Add feature to drop or accept specific packet transmit over edge network interface by rules.

* fix CMakeLists.txt typo

* Update Rule String Format

* replace -F (filter) with -R (rule) for traffic restrictions.

* Update edge help (-h)  message. Update documents.
2020-11-10 16:35:05 +01:00
fei4xu
a2db28275c
fix yocto cross build error: 'string.h ' not found (#487)
Co-authored-by: uib51588 <fei.4.xu@continental.com>
2020-11-05 18:03:50 +01:00
BetaBeauty
57f742fe42
Extra Device Description in P2P Connection and Register to Super Node (#475)
* add cmake export commands

* add extra edge description (hint) field

* add peer2peer description registry

* fixed bug: peer2peer not pass the dev_desc filed

* update -I option in the helper text

Co-authored-by: Longtao Wang <longtao.wang@cortexlabs.ai>
2020-10-26 21:13:56 +01:00
南浦月
e4637cd48b
fix(cmake): install path of man pages 2020-09-07 14:32:35 +08:00
Logan oos Even
90a071a1d3
Merge branch 'dev' into revCc20 2020-09-01 20:16:32 +05:45
Logan007
e087124dd9 reworked cc20 2020-09-01 16:17:52 +05:45
fengdaolong
f560e8f753 Fix the version number displayed after building by Cmake. 2020-08-29 00:49:54 +08:00
Luca Deri
31a05e18d1
Merge pull request #389 from Logan007/revTf
reworked twofish implementation and replaced it by a faster version
2020-08-28 13:01:19 +02:00
Logan007
d5c1295bec replaced twofish implementation by a faster version 2020-08-26 18:07:05 +05:45