Debugging PPPOE, pppoe => libppoe pppd => libpppd. adb shell can execute the program through the normal dial-up correctly.
root @ android :/ system / xbin # / system / xbin / libpppd pty '/ system / xbin / libpppoe-p / system / xbin / pppoe.pid-I eth0-T 80-U-m 1412' noipdefault noauth default-asyncmap defaultroute hide-password nodetach usepeerdns mtu 1492 mru 1492 noaccomp nodeflate nopcomp novj novjccomp user cd028 password g55523 lcp-echo-interval 20 lcp-echo-failure 3
pppoe: send (sendPacket): Network is down
pppoe: recv (receivePacket): Network is down
pppoe: send (sendPacket): Network is down
pppoe: send (sendPacket): Network is down
pppoe: send (sendPacket): Network is down
pppoe: recv (receivePacket): Network is down
pppoe: Timeout waiting for PADO packets
10 | root @ android :/ system / xbin # pppoe: send (sendPacket): Network is down
pppoe: send (sendPacket): Network is down
pppoe: Timeout waiting for PADO packets
in JAVA layer first call exec su, then call the above command is OK .
However, due to JAVA layer calls linux command is not too easy to operate, use NDK to achieve.
Because the return status pppoe to use, so use popen to call this command.
char commond [1000] = {0};
sprintf (commond, "/ system / xbin / libpppd pty '/ system / xbin / libpppoe-p / system / xbin / pppoe.pid-I eth0-T 80-U-m 1412' noipdefault noauth default-asyncmap defaultroute hide-password nodetach usepeerdns mtu 1492 mru 1492 noaccomp nodeflate nopcomp novj novjccomp user cd028 password g55523 lcp-echo-interval 20 lcp-echo-failure 3 2> & 1 ");
pf = popen (commond, "r");
size = fread (buf, 1, 512, pf);
Read the return status read buf inside, then
__android_log_print (ANDROID_LOG_INFO, "JNIMsg", "buf =% s", buf);
Print it out, see:
07-09 11:23:42.314: I / JNIMsg (25219): buf = / system / xbin / libpppd:. This system lacks kernel support for PPP This could be because < / span>
07-09 11:23:42.314: I / JNIMsg (25219): the PPP kernel module could not be loaded, or because PPP was not
07-09 11:23:42.314: I / JNIMsg (25219): included in the kernel configuration If PPP was included as a
.07-09 11:23:42.314: I / JNIMsg (25219): module, try `/ sbin / modprobe-v ppp 'If that fails, check that
07-09 11:23:42.314: I / JNIMsg (25219):. Ppp.o exists in / lib / modules / `uname-r` / net
07-09 11:23:42.314: I / JNIMsg (25219):. See README.linux file in the ppp distribution for more details
07-09 11:23:42.324: D / ViewRootImpl (25219): pckname = com.example.calljavamethodfromnativecinndk
It said the core module of the problem should be excluded, because the command line is possible.
Feeling is the question of powers. I do not know how to gain root privileges on the NDK. I tried to execute the su command in java layer, then jni, still wrong.
I found the same error message in the forum: http://www.eoeandroid.com/thread-32158-1-1.html
I pppd dial debugging process by way of the operation of the command line, no problem.
But if I'm in the Framework which calls exec (String cmd) start pppd words,
Do not succeed, Log follows:
E / pppd (2082):. This system lacks kernel support for PPP This could be because
E / pppd (2082): the PPP kernel module could not be loaded, or because PPP was not
E / pppd (2082):. Included in the kernel configuration If PPP was included as a
E / pppd (2082): module, try `/ sbin / modprobe-v ppp 'If that fails, check that
.E / pppd (2082): ppp.o exists in / lib / modules / `uname-r` / net
.E / pppd (2082): See README.linux file in the ppp distribution for more details
.Which Big Brother know is how ah? Help!
Workaround:
Modify execute permissions pppd_gprs in system / core / init / property_service.c, the problem is solved.
* /
struct {
const char * service;
unsigned int uid;
unsigned int gid;
} Control_perms [] = {
{"Dumpstate", AID_SHELL, AID_LOG},
{"Pppd_gprs", AID_RADIO, AID_LOG}, / / add
{NULL, 0, 0}
};
This experiment has not been done, because I think java layer C layer can actually not difficult to understand Yeah. Or am I popen problem it?
I still do not want to try to call using pure C command to see what can be achieved.
Another experiment was AndroidManifest.xml's permission, I added
But does not solve the problem.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Here also saw the problem pppd authority said: http://www.eoeandroid.com/thread-108641-1-1.html
But I should not: Permission is 777.

Reply:
The final solution is to try to invoke a Java layer Root shell, this shell to call ppp.
Results posted thereon.
No comments:
Post a Comment