Patches for PPP for 3G functions- please review and add to GIT

  • Here are some patch files for and status_interfaces.php.

    First, I update the get_real_interface function so that it returns just the serial port for the ppp device (instead of ppp_<serial_port>) when the ppp link is not up. This makes the function more useful because now you can call the "interface_ppp_configure" function and pass in the the result of "get_real_interface($wan)" for example.

    I also changed the method that the "get_real_interface" function uses to get the tunnel interface name when the ppp link is up. I found that when my 3G modem was in a low signal area, the ppp link would come up partially, and not receive an IP address. If this occurred the web GUI would report that my WAN interface was "pflog0" because the method of chopping up the "ps aux" and "ifconfig" system calls didn't account for the tunnel being partially up (ppp running, but no connectivity.) The userland ppp program puts two files into /var/run when it is running. One is /var/run/<serial_device>.if which contains the interface name that the serial device is attached to, and the other is /var/run/ which is the process id for the ppp instance using "tunX."
    These two files are more simple and reliable methods of controlling and figuring out what's going on with the ppp link.

    Second, I added a function to called "interface_ppp_bring_down" which figures out the pid using the /var/run/ file and sends a kill -QUIT signal to the ppp process.

    Third, I modified interfaces_ppp_configure and interface_ppp_configure functions so that
    1. The ppp interface is not brought up automatically when you save the configuration because this presents problems for defining ppp.conf entries for diagnostic purposes.
    2. You can call interface_ppp_configure from other functions (like interface_configure($interface)) and not have to write the ppp.conf file to the disk when you just want to bring the link up.

    Fourth, I added "interface_ppp_configure($realif)" to the function definition of "interface_configure" and "interface_ppp_bring_down" to the function definition of "interface_bring_down". These allow good integration into the existing code for bringing interfaces down and up from the status_interfaces.php page.

    Finally, I modified the status_interfaces.php file so that you get a button to "connect" and "disconnect" the ppp wan link.

    I didn't include patch files for interface_ppp_edit.php and interface_ppp.php but BOTH of those need the "interfaces_ppp_configure();" function call to look like this: interfaces_ppp_configure(true);

    Please, please add these things to the source tree. They are very, very helpful for 3G ppp applications.

    I'm still working on some more modifications to allow multiple PPP configs for the same serial device. I think this will be useful for diagnostic purposes in the future for the 3G links.


    I assign and relinquish any copyright claim I might have on these updates to BSD Perimeter.

  • Thanks!  Any chance you can update your repo and do a diff -u ?

    Please email patches to

  • Thanks, committed!

Log in to reply