Skip to content

Conversation

@0x-0ddc0de
Copy link
Contributor

@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.
@codecov
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).
⚠️ Report is 1 commits behind head on master.

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
Contributor 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

@0x-0ddc0de
Copy link
Contributor Author

This PR has been open for a month and I haven't been seeing any new feedback. Is there some kind of additional test that should be added to facilitate things? This is my first time opening PR to this project so I'm not familiar with the maintainers expectations beyond what the docs already mentioned.

@gpotter2
Copy link
Member

Hi. Sorry for the delay. I'm basically alone to review dozens of PRs, and I often don't have that much time to allocate to it ^^

It looks fine. Thanks for your work.

@gpotter2 gpotter2 merged commit e35797e into secdev:master Sep 13, 2025
42 of 44 checks passed
@gpotter2 gpotter2 added this to the 2.7.0 milestone Nov 2, 2025
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