robinpaulson / SimpleRT

Simple Reverse Tethering utility for Android
GNU General Public License v3.0
905 stars 101 forks source link

Drop tun/tap requirement? #1

Open donaldsycamore opened 7 years ago

donaldsycamore commented 7 years ago

Have you considered using the "fake network" code from VDE ( http://wiki.v2.cs.unibo.it/wiki/index.php?title=VDE_Basic_Networking#Slirp:_a_virtual_NAT_router_as_a_process ) as an alternative to requiring TUN/TAP?

vvviperrr commented 7 years ago

Don't even knew about this feature) Seems interesting. I'll research. Thanks for respond.

donaldsycamore commented 7 years ago

The long history is that back in dial-up days when some people paid for "dial in to a unix shell", SLIRP was a program you could run that spoke SLIP (forerunner to PPP) via stdin/stdout, and translated everything into BSD socket calls. A bit like a userspace transparent proxy. You send it your network traffic, it terminates the TCP sessions, opens equivalent connections with a socket call and copies bytes between the two.

VDE (and QEMU) have both used this to provide a fake network connection to virtual machines -- in their versions, there's a DHCP server in the Slirp process too. This is what lets you run a VM with network access as non-root.

vvviperrr commented 7 years ago

i see, a bit like lwip project

randomstuff commented 7 years ago

What's wrong with TUN? We need to be root to create the TUN device but AFAIU it's neeeded to open the USB device anyway.