Hi
I need to initiate many PPP connections (200) from a C++ program to test my
PPP server.
The dial-up does not go through a modem by encaptulated into a UDP packet
over a LAN.
I want to use master/slave pty/tty device instead of /dev/ttyS0 that needs a
real modem.
I use a main program to fork child process and read from the master device
"ptyp0". The child process open the slave device and redirect stdin/out/err
to
the slave device than execv the pppd. The packet was generated starting with
0x70 0x70 0x70 ..... received by the PPP server. Do I specify the wrong
options
or flags for the pppd ?
Does anyone know how to do it ? Any hint will help. Thanks.
I use the following
char *argv[20] = {
"/home/jyu/viper/measure/softmodem/objs/wrappppd",
"connect",
"chat -v \"\" ATDT398 CONNECT \"\" name: jyu word:
jyu timeout 5",
"nobsdcomp",
"nodeflate",
"lock",
"mru",
"1504",
"mtu",
"1024",
"asyncmap",
"0x000A0000",
"debug",
"kdebug",
"1",
"passive",
"172.17.25.3:172.17.25.2",
"-modem",
"-detach",
NULL
};
In my main program that forks a child process and take care the redirection
of the stdin/out/err to
the slave device "/dev/ttyp0".
switch (childPID = fork()) {
default: // this is the parent..
// open the master device
if ((fd = open(
"/dev/ptyp0", O_RDWR)) == -1) {
exit(1);
}
// start reading from the
device "/dev/ptyp0" and send
// it across LAN over UDP/IP (encaptulation)
// ........
break;
case 0: // this is the child
setpgrp();
// open the slave device
if ((fd = open( "/dev/ttyp0", O_RDWR)) == -1) {
exit(1);
}
setupPty(fd);
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
for (int i = 3; i < 64; ++i)
close(i);
execv(pppCommandPath, argv);
fprintf(stderr, "%s: exec failed", pppCommandPath);
exit(1);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to [EMAIL PROTECTED]