DRAFT: Add support for Darwin/macOS utun devices
Checklist:
- [x] If you are new to Scapy: I have checked CONTRIBUTING.md (esp. section submitting-pull-requests)
- [ ] I squashed commits belonging together
- [x] I added unit tests or explained why they are not relevant
- [ ] I executed the regression tests for Python2 and Python3 (using
toxor,cd test && ./run_tests_py2, cd test && ./run_tests_py3) - [ ] If the PR is still not finished, please create a Draft Pull Request
This adds support for utun devices in TunTapInterface on Darwin (macOS). This is allegedly available since macOS 10.6.4, but I don't have a machine with an install that old to properly verify.
The main reasons for adding it are:
-
utunis part of the OS, and doesn't require installing a third-party kernel extension. This should let it work in CI environments (which typically have SIP enabled). -
tuntaposxis no longer maintained as of 2015. Tunnelblick's author is also looking at dropping support for it too. - Running even a notarised build of
tuntaposxon macOS 10.15.4 and later complains about the use of deprecated APIs, so will break in the future. -
tuntaposxbroke in macOS 11.0.1 when System Integrity Protection was enabled (default), but was fixed in macOS 11.1.0. -
tuntaposxwon't work at all on Apple Silicon (M1) machines.
This PR requires #3257 to fix send() on utun devices, and adds tests which use this. I've been testing this with macOS 11.4.
Caveats:
- This requires Python 3.3 or later, because earlier versions do not support
PF_SYSTEMSYSPROTO_CONTROL. Adding support earlier versions would make this much more complicated (and those versions are EOL). - I haven't tested this on Apple Silicon – I don't own such a machine.
Codecov Report
Merging #3258 (ac975f2) into master (a6bf8dd) will not change coverage. The diff coverage is
n/a.
:exclamation: Current head ac975f2 differs from pull request most recent head 2c42644. Consider uploading reports for the commit 2c42644 to get more accurate results
@@ Coverage Diff @@
## master #3258 +/- ##
=======================================
Coverage 52.38% 52.38%
=======================================
Files 9 9
Lines 1365 1365
=======================================
Hits 715 715
Misses 650 650
Looks pretty cool, looking forward to this !