Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use software TCP/IP stack for virtual TUN implementation #974

Closed
JJTech0130 opened this issue May 3, 2024 · 4 comments
Closed

Use software TCP/IP stack for virtual TUN implementation #974

JJTech0130 opened this issue May 3, 2024 · 4 comments

Comments

@JJTech0130
Copy link

JJTech0130 commented May 3, 2024

Is your feature request related to a problem? Please describe.
With the re-introduction of a lockdownd based API, using a USB-NCM driver is no longer necessary. As such, I would like to be able to use pymobiledevice3 without root/Administrator privileges.

Describe the solution you'd like
PyTCP can be forked to skip the Ethernet layer so that it can use TUN interfaces instead of TAP, and that can be hooked up to the lockdownd CoreDevice tunnel.

Describe alternatives you've considered
Scapy can also do TCP to some extent, though it doesn't handle the high level details of the protocol automatically.
Not sure if QUIC can be used over the lockdownd tunnel, that might simpler since there is already a good QUIC implementation that could be overlayed on a simple UDP implementation.

Another alternative to consider is using a TCP stack written in C or Rust, would probably improve speed quite significantly.

Additional context
All speed benefits would be lost with a pure Python implementation.
I discussed this in the Discord, but it turned out to be harder that I thought and I got sidetracked.
Posting here so that it doesn't get buried.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@nanoscopic
Copy link

nanoscopic commented May 13, 2024

Root isn't necessary on Linux, only granting of of the "cap_net_admin+ep" capability is needed to manage utuns, not root.

On MacOS, only creation of the utun and management of it needs root, so you can pair a UDS with the UTUN to avoid needing root for pmd3 itself. That is far easier than what you are suggesting.

Be aware that pmd3 is currently also using "root" to be able to suspend and resume remoted. That would need to be changed also to run pmd3 itself without root.

I'm not sure what you mean by "instead of TAP". Pmd3 is making and managing utuns. TAP isn't used at all.

I'm also not sure what you mean by "USB-NCM" is no longer needed. It's still needed if you are using an iOS device between iOS 17.0 and 17.3. Many people will want to test and do things with such devices, so everything cannot be moved to the TCP tunnels.

@JJTech0130
Copy link
Author

I'm not sure what you mean by "instead of TAP". Pmd3 is making and managing utuns. TAP isn't used at all.

I'm talking about modifying PyTCP to support (virtual) TUN rather than its existing TAP interface.

I'm also not sure what you mean by "USB-NCM" is no longer needed. It's still needed if you are using an iOS device between iOS 17.0 and 17.3. Many people will want to test and do things with such devices, so everything cannot be moved to the TCP tunnels.

I figure that in the future, most people will forget about this very minor range of versions, and thus if a method exists to make it not require OS integration (especially on Windows) for most versions of iOS, that would be ideal.

@nanoscopic
Copy link

People are not going to "forget about" a subversion of the current major version anytime soon.

Why do you insist on calling it a "TAP interface"? A TAP interface is a layer 2 network interface that deals in ethernet frames.

What is used here is a UTUN / TUN, which is a layer 3 device that handles IP packets.

I think your suggestion is incorrect / misled considering it depends on a full misunderstanding of what is in use currently. Implementing a software TCP/IP stack in order to avoid a user level redirection of IP packets ( utun ) is ridiculous.

@JJTech0130
Copy link
Author

Closing this in favor of the solutions proposed in #566... including a userspace TCP/IP stack 😛

@JJTech0130 JJTech0130 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 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

No branches or pull requests

2 participants