Commit Graph
3 Commits
Author SHA1 Message Date
Marek Sedlak 5f302a95b0 Add native macOS utun support, replacing deprecated tuntaposx TAP driver (#1236)
The tuntaposx kernel extension is no longer supported on modern macOS
(Catalina+, Apple Silicon, Tahoe). This replaces it with native utun
interfaces, adding an L2/L3 translation shim so the n2n wire protocol
remains 100% Ethernet-compatible with Linux/Windows TAP peers.

New files:
- macos/utun.c: utun socket lifecycle (PF_SYSTEM, CTLIOCGINFO, connect)
- macos/arp.c: internal ARP cache/responder for L2 emulation
- macos/route.c: macOS route table management
- tools/tests-utun.c: 24 unit tests for translation shim and ARP cache
- scripts/test_utun.sh: integration test suite

Key changes:
- src/tuntap_osx.c: complete rewrite with Ethernet header synthesis
  (tuntap_read) and stripping (tuntap_write), ARP interception
- src/edge.c: enable signal handlers and N2N_CAN_NAME_IFACE for macOS
- src/n2n.c: add SO_REUSEPORT for multicast socket (fixes multi-edge)
- include/n2n_typedefs.h: add edge_context back-pointer for ARP replies
- doc/Building.md: updated macOS instructions (no kexts required)

Tested: macOS Tahoe (Darwin 25.x, ARM64) <-> Ubuntu Linux TAP edge
via shared supernode with bidirectional ping confirmed.
2026-03-02 22:40:19 +01:00
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 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