scapy icon indicating copy to clipboard operation
scapy copied to clipboard

DRAFT: Add support for Darwin/macOS utun devices

Open micolous opened this issue 4 years ago • 2 comments

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 tox or, 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:

  • utun is 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).
  • tuntaposx is no longer maintained as of 2015. Tunnelblick's author is also looking at dropping support for it too.
  • Running even a notarised build of tuntaposx on macOS 10.15.4 and later complains about the use of deprecated APIs, so will break in the future.
  • tuntaposx broke in macOS 11.0.1 when System Integrity Protection was enabled (default), but was fixed in macOS 11.1.0.
  • tuntaposx won'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_SYSTEM SYSPROTO_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.

micolous avatar Jun 12 '21 04:06 micolous

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           

codecov[bot] avatar Jun 12 '21 04:06 codecov[bot]

Looks pretty cool, looking forward to this !

gpotter2 avatar Jul 01 '21 23:07 gpotter2