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
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.
* 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>
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.
* 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
* 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
* 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
* 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
* 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>
* 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
* 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
* Revert "Fix compilation on MacOS"
in order to another solution
* src: use IPPROTO_TCP in place of SOL_TCP
* use the more specific IPPROTO_TCP type for setsockopt
* fixes build on MacOS
src/edge_utils.c:891:31: error: use of undeclared identifier 'SOL_TCP'; did you mean 'FPP_TCP'?
setsockopt(eee->sock, SOL_TCP, TCP_NODELAY, &value, sizeof(value));
src/edge_utils.c:894:31: error: use of undeclared identifier 'SOL_TCP'
setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value));
^
src/edge_utils.c:894:40: error: use of undeclared identifier 'TCP_CORK'
setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value));
* include/n2n.h: drop redefiniton of SOL_TCP for WIN32, as we don't use it anywhere now
* src: only use TCP_CORK on LINUX
* it's LINUX only and fails on Win32 and MacOS (man 7 tcp)