When we go to settings->wireless & network options in android phone and check the usb tether option,then immediately one network device rndis0 is created which we can see from adb shell netcfg
I basically want to know how this network device is created,which api is called by setting application to create rndis0 interface
Thanks
rndis0
is the name of your USB port when used as a NIC for tethering. It is probably named after the RNDIS protocol, which it uses when tethered with a computer. I have never been able to find non-root methods of modifying this programmatically (and therefore never found any API methods), neither have I found any non-root apps that can modify this.
In order to properly answer your question, I'd need to know exactly what you're trying to do as there exists both rooted and non-rooted methods for working with Android network interfaces in less direct ways; some links containing examples are listed below.
Programmatically turn USB tethering on / off:
Enable/Disable USB or Wifi tethering programmatically on android
Start / stop built-in Wi-Fi / USB tethering from code?
Programmatically turn WIFI on / off:
How to programmatically turn off WiFi on Android device?
If you have root and don't mind getting your hands dirty with the Linux terminal, you could try setting it manually. However, your two primary problems are that 1) some Android kernels simply have primary Linux functions cut out and 2) even if you manually import some default functionality (perhaps with the help of tools like Busybox) Android doesn't always follow all Linux rules the way normal computers do. For example, I once tried to set the DHCP range of my S2 (something I've done on various distros on Linux-based computers with ease), but no matter how hard I tried, the phone simply refused to follow my rules. On the other hand, tools like iptables have never failed me.
Some useful Linux links:
ArchWiki - 90% of everything Linux I learned (Ubuntu, CentOS, Arch Linux, some Android, vanilla Linux..) came from here. They often cover other distros in more details than those distros cover themselves.
iptables, iptables, more iptables..
General network configuration, ip routing, more routing..
Please keep in mind that much of the information in some of the above links won't apply to Android, as Android only implements some of that functionality. It's definitely worth the read, though.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With