arjun.laxman

Lurker
Feb 2, 2011
8
0
5
Hi,
I am writing an Android Application for the first time. I need to start a Tun driver from Android App. I have two shared libraries created. One is JNI shared library and the other is the cross-compiled library which actually does creating of a tunneling module,assigning IP Address, starting the tun driver and configuring by setting the IP address and setting up a route for it.
After getting server IP address and server port through App, I call JNI function to start tun module. The JNI library in turn calls the function in the cross-compiled library which actually does the job.
But the issue is the permission to start the device files. I faced issue while creating a socket, so I set the permission android.permission.INTERNET in AndroidManifest.xml. I was able to create socket and DHCP too worked. Now, I am facing an issue to start the Tun driver. I am able to open the device file "/dev/tun" but unable to set the properties to it by calling ioctl(fd, TUNSETIFF, &ifr) due to Permission problems.
If I make the cross-compiled library an executable and start it on ADB shell prompt of the mobile phone using SU permissions, it works perfectly fine. But through Android App, I am not able to do so due to some permission issue. I have tried giving all sorts of permissions in AndroidManifest.xml file, but no progress. I am stuck with this problem for days and any help will be greatly appreciated.

Thanks in advance.

Regards,
Arjun