PPPui: A Friendly GUI for PPP

Having problems setting up PPP? Mr. Meyers gives us a graphical interface to make it easy.

PPP, the Point-to-Point Protocol, is today's protocol of choice for network connectivity over a serial line. For Linux users, the tools of choice are the PPP utilities. The utilities—pppd, chat and a collection of scripts and utilities—nicely manage the connection from startup to shutdown: dialing and logging in, starting up the protocol, adding routing information and closing the connection.

What the PPP utilities do not have is a good user interface. If you use the utilities, you know the routine: execute a script called something like /etc/ppp/scripts/ppp-on, listen to your modem make noise and wait while your network connection attempts to start working. If nothing happens, check the process list. If pppd isn't running, the login attempt failed and you need to try again. If the connection goes down, you eventually figure it out by checking the process list and starting a new connection. Things improve after you've used the PPP utilities awhile—you begin to recognize the state of the connection by the sounds of disk activity.

PPPui was written out of my frustration with the utilities' low-tech interface. It's an X-based (specifically, Tcl/Tk-based) GUI that provides very simple control over a PPP connection. The goal was to provide easy startup and shutdown and useful visual feedback about the connection.

The scenario for a PPPui session looks something like this:

  • Start PPPui. I've defined a window manager action, described below, that makes this a one-click operation.

  • A window comes up and reports the progress of the login process. If login fails, the window disappears and you must try again.

  • Once login succeeds and the PPP route is added, PPPui displays a running clock of your connect time. The clock is visible even when you iconify PPPui.

  • To terminate the connection, press PPPui's “Quit” button.

PPPui is implemented as a wish (WIndowing SHell—part of the Tcl/Tk package) script and requires wish4.2. It does not replace the PPP utilities, but does require some very minor changes to them—discussed later in detail.

A Look at the Program

The PPPui script was developed on a Slackware system using the PPP utilities source distribution. In the following description and in the script itself, there are assumptions about locations (scripts and executables) and permissions that do not necessarily apply to other distributions. The script takes two required arguments and two optional arguments. The basic invocation takes a PPP startup command, a PPP shutdown command and optionally the name of the PPP device being opened (defaults to ppp0). For example:

PPPui /etc/ppp/scripts/ppp-on\
        /etc/ppp/scripts/ppp-off ppp0

The startup and shutdown commands are interpreted by /bin/sh when they are invoked and can contain multiple arguments and anything else the shell will recognize. For example:

PPPui /etc/ppp/scripts/ppp-on\
        '/etc/ppp/scripts/ppp-off ppp0' ppp0
The other optional argument, -small, is described in the section “Interacting with the Window Manager”.

After parsing the command line, PPPui sets the shell command to use when interpreting startup and shutdown commands. It then sets up a simple GUI containing a label, a “quit” button and a scrolled text console for displaying status information. PPPui also sets up a named pipe to the console, whose purpose is explained in the section “Changes Required in PPP Utilities”, and it initiates the startup command and captures the output. After setup, PPPui's most important job is to wait around for something to happen. Here are the things it is waiting for:

  • The startup command generates output or output is received through the named pipe. The output is captured by HandleStartOutput{} or HandleFIFOInput{} (respectively) and sent to the console by calling ToConsole{}.

  • The PPP connection is established. PPPui calls CheckPPPDevice{} every 1/2 second to examine the contents of /proc/net/route until a route appears for the device (the third argument to the script names the device). Once the route appears, PPPui starts a running display of the connect time, calling PostTime{} once a second to update the clock. The clock is displayed in the label at the upper-left corner of the GUI and also in the window's title. This allows the clock to be visible even when the window is iconified.

  • The user asks to close the connection by pressing the “Quit” button or closing the window. PPPQuit{} is called to invoke the shutdown command. After the invocation, PPPui resumes waiting. Any output from the shutdown command is captured by HandleStopOutput{} and sent to the console.

  • The startup command terminates. This is usually in response to execution of the shutdown command, but can also occur if the connection dies or the login fails. The death of the startup command results in an EOF condition detected by HandleStartOutput{}, at which point PPPui terminates and its window disappears.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState