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

Create a device from a RawFd #17

Open
cbranch opened this issue Oct 10, 2022 · 0 comments
Open

Create a device from a RawFd #17

cbranch opened this issue Oct 10, 2022 · 0 comments

Comments

@cbranch
Copy link

cbranch commented Oct 10, 2022

Tun implements AsRawFd but it would be useful to support FromRawFd or moral equivalent.
The use case is if you inherit a fd for a tun device or receive it from another process, but want to use it in an async context with tokio-tun instead of treating it as a standard file.

Obviously in this case you do not have a handle to the tun interface description and can't get MTU/address etc. which prevents a trivial implementation of FromRawFd.

@cbranch cbranch changed the title c FromRawFd Create a device from a RawFd Oct 10, 2022
cbranch added a commit to cbranch/tokio-tun that referenced this issue Nov 23, 2022
This change supports applications that want to receive or pass a tun
device's file descriptor to another (possibly less privileged)
application and have it usable by tokio-tun on the other side.

The alternative is to open a multiqueue tun device and temporarily open
additional queues, which has a disruptive impact on existing flows
received on the tun device.

This change resolves yaa110#17.
cbranch added a commit to cbranch/tokio-tun that referenced this issue Nov 23, 2022
This change supports applications that want to receive or pass a tun
device's file descriptor to another (possibly less privileged)
application and have it usable by tokio-tun on the other side.

The alternative is to open a multiqueue tun device and temporarily open
additional queues, which has a disruptive impact on existing flows
received on the tun device.

This change resolves yaa110#17.
gabivlj pushed a commit to gabivlj/tokio-tun that referenced this issue Jul 31, 2024
This change supports applications that want to receive or pass a tun
device's file descriptor to another (possibly less privileged)
application and have it usable by tokio-tun on the other side.

The alternative is to open a multiqueue tun device and temporarily open
additional queues, which has a disruptive impact on existing flows
received on the tun device.

This change resolves yaa110#17.
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 a pull request may close this issue.

1 participant