|
Prev: Autoexpect telnet session
Next: Sharing a Serial Port
From: news.mot.com on 17 Feb 2005 17:03 Is there a way to emulate a modem with Expect? Basically I have written an Expect script that allows a user to bring up ppp through a telnet pipe (basically allows GUI connections via telnet if X is not allowed). The script works fine on Linux machines since it makes a call to pppd on both sides of the telnet and then makes them talk to each other. I am trying to get the same behavior to happen on Solaris8.0 but running into issues. Basically pppd on Linux creates a ppp0 interace automatically, where pppd on Solaris does not. Solaris expects the user to plumb an ipdptp interface that will make a call to an /etc/ppp/options file which, in turn, uses a 'call' option to initialize an actual modem with chat. Once chat finishes the phyiscal connection of dialing, it then appears to bind the ipdptpx to the local pppd process. Once that bind occurs, the remote pppd process is free to negotiate LCP with the ipdptpx adaptor. So basically I am trying to figure out is there a way to bind the ipdptp adapter to the pppd process on the local side so that I can get an IP address. I have tried 'spawn -open [ open /dev/ipdptp0 w+ ]' and capturing the spawn_id, then spawning the pppd session and forcing an interaction, but that does not seem to buy me anything. I was pointed to the 'spawn -pty' as perhaps a way around, but working through the man page as well as Exploring Expect's example - I don't see where to take this. Any help/hints would be greatly appreciated. Jason
From: Don Libes on 18 Feb 2005 10:22 "news.mot.com" <jason.brummal(a)motorola.com> writes: > Is there a way to emulate a modem with Expect? Basically I have written an > Expect script that allows a user to bring up ppp through a telnet pipe > (basically allows GUI connections via telnet if X is not allowed). The > script works fine on Linux machines since it makes a call to pppd on both > sides of the telnet and then makes them talk to each other. I am trying to > get the same behavior to happen on Solaris8.0 but running into issues. > > Basically pppd on Linux creates a ppp0 interace automatically, where pppd on > Solaris does not. Solaris expects the user to plumb an ipdptp interface that > will make a call to an /etc/ppp/options file which, in turn, uses a 'call' > option to initialize an actual modem with chat. > > Once chat finishes the phyiscal connection of dialing, it then appears to > bind the ipdptpx to the local pppd process. Once that bind occurs, the > remote pppd process is free to negotiate LCP with the ipdptpx adaptor. > > So basically I am trying to figure out is there a way to bind the ipdptp > adapter to the pppd process on the local side so that I can get an IP > address. I have tried 'spawn -open [ open /dev/ipdptp0 w+ ]' and capturing > the spawn_id, then spawning the pppd session and forcing an interaction, but > that does not seem to buy me anything. > > I was pointed to the 'spawn -pty' as perhaps a way around, but working > through the man page as well as Exploring Expect's example - I don't see > where to take this. Any help/hints would be greatly appreciated. > > Jason I've read this 5 times and still don't understand what you're doing (sorry). But if you're just trying to make a black box that has an IP addr on one side and a serial addr on the other, yes, you can do that. IP2serial is trivial so hopefully it's serial2IP that you're trying to achieve - what I do is create a fifo and then let the Expect script sleep on a fifo read. When the read completes, the script does a socket open or spawn telnet or whatever you want for the other side of the connection. An 'interact' ties them together. To most programs, serial devices all look the same so a program shouldn't care whether it's a modem or a fifo. Since you have the book, you can also find code samples and pictures in there (2nd Interact chapter). If this still doesn't address your question, a picture would be helpful. Don
From: MOTJason on 18 Feb 2005 17:49 Just a note, I solved the issue I had. I was actually mistaken about how Solaris PPPd worked. It does attempt to start a sppp0 for me. The issue was the stty was in the way. Even though I set the stty_init flag to -istrip it would not take. Once I spawn'd my telnet with the -nottyinit flag it works just like Linux. Jason "news.mot.com" <jason.brummal(a)motorola.com> wrote in message news:cv34cr$mea$1(a)newshost.mot.com... > Is there a way to emulate a modem with Expect? Basically I have written an > Expect script that allows a user to bring up ppp through a telnet pipe > (basically allows GUI connections via telnet if X is not allowed). The > script works fine on Linux machines since it makes a call to pppd on both > sides of the telnet and then makes them talk to each other. I am trying to > get the same behavior to happen on Solaris8.0 but running into issues. > > Basically pppd on Linux creates a ppp0 interace automatically, where pppd on > Solaris does not. Solaris expects the user to plumb an ipdptp interface that > will make a call to an /etc/ppp/options file which, in turn, uses a 'call' > option to initialize an actual modem with chat. > > Once chat finishes the phyiscal connection of dialing, it then appears to > bind the ipdptpx to the local pppd process. Once that bind occurs, the > remote pppd process is free to negotiate LCP with the ipdptpx adaptor. > > So basically I am trying to figure out is there a way to bind the ipdptp > adapter to the pppd process on the local side so that I can get an IP > address. I have tried 'spawn -open [ open /dev/ipdptp0 w+ ]' and capturing > the spawn_id, then spawning the pppd session and forcing an interaction, but > that does not seem to buy me anything. > > I was pointed to the 'spawn -pty' as perhaps a way around, but working > through the man page as well as Exploring Expect's example - I don't see > where to take this. Any help/hints would be greatly appreciated. > > Jason > >
|
Pages: 1 Prev: Autoexpect telnet session Next: Sharing a Serial Port |