Skip to content

Conversation

0x-0ddc0de
Copy link

@0x-0ddc0de 0x-0ddc0de commented Aug 15, 2025

Fixes #4049

Darwin creates tunnel interfaces differently than BSD, breaking the existing handling which is based on generic BSD tun. This commit adds a new tunnel layer specific to the Darwin utun interface.

This PR picks up the work after the draft PR #4100 got abandoned 2 years ago.

Checklist:

  • [x ] If you are new to Scapy: I have checked CONTRIBUTING.md (esp. section submitting-pull-requests)
  • [x ] I squashed commits belonging together
  • [x ] I added unit tests or explained why they are not relevant
  • [x ] I executed the regression tests (using cd test && ./run_tests or tox)
  • If the PR is still not finished, please create a Draft Pull Request

TunTapInterface attempts to handle tunnels in Darwin by following the BSD code path. However, this fails for multiple reasons, including the initial rejection of the interface name beginning with "utun" rather than "tun". This PR adds special-case handling for Darwin.

fixes #4049

Fixes secdev#4049

Darwin creates tunnel interfaces differently than BSD, breaking the existing handling which is based on generic BSD `tun`. This commit adds a new tunnel layer specific to the Darwin utun interface.
Copy link

codecov bot commented Aug 15, 2025

Codecov Report

❌ Patch coverage is 51.51515% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.88%. Comparing base (d73bbc1) to head (b1f901b).

Files with missing lines Patch % Lines
scapy/layers/tuntap.py 51.51% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4816      +/-   ##
==========================================
- Coverage   80.88%   80.88%   -0.01%     
==========================================
  Files         368      368              
  Lines       90211    90231      +20     
==========================================
+ Hits        72969    72983      +14     
- Misses      17242    17248       +6     
Files with missing lines Coverage Δ
scapy/layers/tuntap.py 76.47% <51.51%> (-6.36%) ⬇️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@0x-0ddc0de
Copy link
Author

Hi @micolous,
You were a reviewer on the draft PR for this issue. That draft PR got abandoned and I completed the work in this new PR. Are you available to review this PR? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interface names must start with tun or tap on BSD and Darwin
2 participants