Commit Graph

75 Commits

Author SHA1 Message Date
Hamish Coleman
3bf584c580 Add tweaks to support windows XP 2023-08-03 21:40:31 +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
183e0c969a Hack around the "helpful" exe file suffix
If there is a way to turn off the mingw insistence that it will rewrite
the filename it was given in the "-o" options, I have not been able to
find it.  I could easily handle all the moves or renames at the end of
the build process if I could turn off this feature.  Especially since it
means that make often thinks that the file has not been built (the
filename that make knows about is not the file that actually gets built
by the mingw gcc, so the if-newer tests that make applies will always
fail)
2023-07-03 02:51:20 +08:00
Hamish Coleman
0b662fc0f4 A bunch of hacks to allow builds to understand the stupid windows filenames 2023-07-03 02:51:20 +08:00
Hamish Coleman
1e8a085f1e Refactor to use the host triplet instead of CONFIG_TARGET 2023-07-03 02:51:20 +08:00
Hamish Coleman
8dcc879ca0 Simplify config and build process for libpcap tool 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
041233dc8b Address more windows compile warnings 2023-06-29 06:00:56 +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
Hamish Coleman
771fdec013 iwyu: tools/test*.c 2023-06-18 11:34:28 +01:00
Hamish Coleman
0a20265228 iwyu: n2n-route.c 2023-06-18 11:14:47 +01:00
Hamish Coleman
290ac83788 iwyu: n2n-portfwd.c 2023-06-18 10:58:00 +01:00
Hamish Coleman
7439d88a00 iwyu: n2n-keygen.c 2023-06-18 10:56:05 +01:00
Hamish Coleman
11fbea4223 iwyu: n2n-benchmark.c 2023-06-18 10:55:07 +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
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
ae3d54eed6 iwym: auth.h 2023-06-13 21:24:30 +01:00
Hamish Coleman
6ecc201017 Ensure LDLIBS is consistantly treated 2023-05-10 18:41:18 +01:00
Hamish Coleman
04a2146391 Now that the exports are correct, stop importing them twice 2023-05-10 18:41:18 +01:00
Hamish Coleman
743f6325cf Fix building with lots of options turned on 2023-05-06 08:48:04 +08:00
Hamish Coleman
c9447689fb Update dependancies for new configure file 2023-04-30 20:45:44 -05: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
9de98c2bb0 Ensure the library is linked to the tools 2023-04-30 19:36:06 -05:00
Hamish Coleman
37722ab8b6 Consolidate the config.mak settings 2023-04-30 19:00:04 -05:00
Hamish Coleman
bd4418fdec Convert the tools dir makefile similarly to the topdir 2023-04-30 18:10:39 -05: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
ba8855fa71
added to portfwd tool - Windows keyboard fix (#1035)
* added to portfwd tool - Windows keyboard fix

* is it just a hick-up
2022-06-30 16:04:16 +02:00
Logan oos Even
504a552c77
Windows needs special network init (#1034) 2022-06-30 11:58:54 +02:00
Logan oos Even
c0259ae967
compile fixes (#1022) 2022-06-23 07:47:41 +02:00
Logan oos Even
f63cb718b3
unified verbosity handling for edge and tools (#1009) 2022-06-05 18:57:14 +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
Logan oos Even
73d0d76f29
changed benchmark to MTU sized packets (#966) 2022-03-12 20:56:56 +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
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
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
Logan oos Even
5f3c27e3a6
compile fix (#846) 2021-10-07 14:05:29 +05:45
Hamish Coleman
2e57663cde
increased test coverage (#844)
* Start adding helper functions to the wire tests

* Add tests for two more wire functions

* Update test expects with new test data

* Use the normal mac address format, like a boss
2021-10-07 13:22:00 +05:45
Hamish Coleman
4438f1aa2a
added mingw test platform (#829)
* Provide a minimal reimplementation of our autoconf, to try windows builds

* Try building with windows

* Fix thinko in spelling

* Ensure shell script runs inside a shell

* Add a hack to aid include discovery

* Just keep adding tech debt...

* Assume that we will have slashes in some of the replacement strings and avoid that char with sed

* Restore one slash

* Hack around the tools makefile interdependancy bug

* A correct cflags include hack for each compile dir

* Ensure we link against winsock (note, even though this says 32bit, it should link the 64bit library ... I think)

* Bad link ordering if we dont use LDLIBS

* Remove unused make variable

* Remove makefile duplication using inheritance (this does mean you can no longer cd tools; make, but must do make tools)

* Add missing library for win32

* Show OS variable

* Make hack autoconf more robust for tests on non gitlab runners

* Remove no longer used substitutions from hack autoconf

* Add missing include path to tools under win32

* Build the win32 subdir when the compiler is Msys

* The different subdirs have different dependancies

* Ensure we can find the include files

* Fix library link ordering

* Ensure the tools dir can find the special win32 lib

* Deal with the differing basic type sizes on both linux/64bit and windows/64bit

* Document the steps to mimic the github windows/mingw build locally - to allow for simpler debugging

* Ensure branch name in instructions matches my test branch name

* Clarify the shell needed to build with mingw

* Since the makefile depends on knowing the OS, raise a fatal error if we cannot determine this

* Handling different compile environments is hard.

- Linux: sane and reasonable results for both uname -s (=Linux) and
  uname -o (=GNU/Linux)
- Windows/Mingw: insane results for uname -s
  (=MSYS_NT-$MAJOR.$MINOR-$BUILDNR) but sane results for uname -o (Msys)
- Macos: sane results for uname -s (=Darwin) but does not support
  uname -o at all

* Revamp the way that Mingw is detected

* Avoid attempting to generate gcovr report when running under windows

* Whoops, isolate the right step

* Fix spelling mistake

* win32/Makefile: Remove unused setting and add comment

* ensure that all win32 includes use the same expected path

* Allow simpler cross compilation by letting configure pass the CC and AR environment through

* Avoid multiple '_CRT_SECURE_NO_WARNINGS redefined' warnings

* Convert to a consolidated CONFIG_TARGET variable to select any different compile options

* Use the more generic printf defines to avoid warnings on mingw

* Update mingw build docs

* English better for reader happy make

* Address a number of mingw compiler warnings

* Fix Visual C compile

* Be sure to document some of the hacky nature of the mingw build
2021-10-06 00:52:15 +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
Hamish Coleman
370ea9bd37
addressed all but one of the remaining compile warnings (#793)
* Fix the mismatched char, uint8_t warnings

* Ensure we leave room for zero termination and then ensure the string is terminated

* GCC has a warning if it thinks your could overflow your snprintf buffer, but dont check for said overflow
2021-09-16 14:45:46 +05:45
Logan oos Even
a28327a0af
added user-password edge authentication (#673) 2021-06-04 03:11:22 +05:45
Luca Deri
85894715bd Added build target for Ubiquity EdgeRouter X 2021-02-16 11:31:23 +00:00
Logan oos Even
cef5561c5a
switched to 2021 (#632) 2021-02-08 16:11:06 +05:45
Logan oos Even
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