summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/www')
-rwxr-xr-xusr/local/www/interfaces_assign.php23
-rwxr-xr-xusr/local/www/interfaces_opt.php32
-rw-r--r--usr/local/www/interfaces_ppp.php148
-rw-r--r--usr/local/www/interfaces_ppp_edit.php166
-rwxr-xr-xusr/local/www/interfaces_vlan.php1
5 files changed, 368 insertions, 2 deletions
diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php
index 908f984..d58fc36 100755
--- a/usr/local/www/interfaces_assign.php
+++ b/usr/local/www/interfaces_assign.php
@@ -50,6 +50,17 @@ if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
}
}
+/* add PPP interfaces */
+if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
+ $i = 0;
+ foreach ($config['ppps']['ppp'] as $ppp) {
+ $portname = 'ppp_' . basename($ppp['port']);
+ $portlist[$portname] = $ppp;
+ $portlist[$portname]['isppp'] = true;
+ $i++;
+ }
+}
+
if ($_POST) {
unset($input_errors);
@@ -92,7 +103,11 @@ if ($_POST) {
if (!is_array($ifport)) {
$config['interfaces'][$ifname]['if'] = $ifport;
-
+ if (preg_match('/^ppp_(.+)$/', $ifport, $matches)) {
+ $config['interfaces'][$ifname]['pointtopoint'] = true;
+ $config['interfaces'][$ifname]['serialport'] = $matches[1];
+ }
+
/* check for wireless interfaces, set or clear ['wireless'] */
if (preg_match($g['wireless_regex'], $ifport)) {
if (!is_array($config['interfaces'][$ifname]['wireless']))
@@ -235,6 +250,7 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed"))
$tab_array = array();
$tab_array[0] = array("Interface assignments", true, "interfaces_assign.php");
$tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
+ $tab_array[2] = array("PPP", false, "interfaces_ppp.php");
display_top_tabs($tab_array);
?>
</td></tr>
@@ -264,6 +280,11 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed"))
if ($portinfo['descr'])
$descr .= " (" . $portinfo['descr'] . ")";
echo htmlspecialchars($descr);
+ } elseif ($portinfo['isppp']) {
+ $descr = "PPP {$portinfo['port']}";
+ if ($portinfo['descr'])
+ $descr .= " (" . $portinfo['descr'] . ")";
+ echo htmlspecialchars($descr);
} else
echo htmlspecialchars($portname . " (" . $portinfo['mac'] . ")");
?>
diff --git a/usr/local/www/interfaces_opt.php b/usr/local/www/interfaces_opt.php
index 9a6de95..f40d7c5 100755
--- a/usr/local/www/interfaces_opt.php
+++ b/usr/local/www/interfaces_opt.php
@@ -84,6 +84,8 @@ if ($optcfg['ipaddr'] == "dhcp") {
$pconfig['subnet'] = $optcfg['subnet'];
$pconfig['gateway'] = $optcfg['gateway'];
$pconfig['pointtopoint'] = $optcfg['pointtopoint'];
+ $pconfig['ap'] = $optcfg['ap'];
+ $pconfig['phone'] = $optcfg['phone'];
}
if ($_POST) {
@@ -231,8 +233,11 @@ if ($_POST) {
$optcfg['ipaddr'] = $_POST['ipaddr'];
$optcfg['subnet'] = $_POST['subnet'];
$optcfg['gateway'] = $_POST['gateway'];
- if (isset($optcfg['ispointtopoint']))
+ if (isset($optcfg['ispointtopoint'])) {
$optcfg['pointtopoint'] = $_POST['pointtopoint'];
+ $optcfg['ap'] = $_POST['ap'];
+ $optcfg['phone'] = $_POST['phone'];
+ }
} else if ($_POST['type'] == "DHCP") {
$optcfg['ipaddr'] = "dhcp";
$optcfg['dhcphostname'] = $_POST['dhcphostname'];
@@ -324,6 +329,30 @@ function show_mon_config() {
<tr>
<td colspan="2" valign="top" class="listtopic">General configuration</td>
</tr>
+ <?php if (isset($optcfg['pointtopoint'])): ?>
+ <tr>
+ <td width="22%" valign="top" class="vncell">AP Hostname</td>
+ <td width="78%" class="vtable">
+ <input name="ap" type="text" class="formfld" id="ap" size="40" value="<?=htmlspecialchars($pconfig['ap']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Phone Number</td>
+ <td width="78%" class="vtable">
+ <input name="phone" type="text" class="formfld" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Remote IP</td>
+ <td width="78%" class="vtable">
+ <input name="gateway" type="text" class="formfld" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
+ </td>
+ </tr>
+
+ <input name="type" type="hidden" value="Static">
+ <input name="ipaddr" type="hidden" value="0.0.0.0">
+ <input name="subnet" type="hidden" value="32">
+ <?php else: ?>
<tr>
<td valign="middle" class="vncell"><strong>Type</strong></td>
<td class="vtable"> <select name="type" class="formselect" id="type" onchange="type_change()">
@@ -422,6 +451,7 @@ function show_mon_config() {
</select>Select a existing Gateway from the list or add one on the <a href="/system_gateways.php">Gateways</a> page<br>
</td>
</tr>
+ <?php endif;?>
<tr>
<td colspan="2" valign="top" height="16"></td>
</tr>
diff --git a/usr/local/www/interfaces_ppp.php b/usr/local/www/interfaces_ppp.php
new file mode 100644
index 0000000..2e05616
--- /dev/null
+++ b/usr/local/www/interfaces_ppp.php
@@ -0,0 +1,148 @@
+<?php
+/*
+ interfaces_lan.php
+ part of pfSense(http://pfsense.org)
+
+ Originally written by Adam Lebsack <adam at holonyx dot com>
+ Changes by Chris Buechler <cmb at pfsense dot org>
+
+ Copyright (C) 2004-2008 BSD Perimeter LLC.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("guiconfig.inc");
+
+if (!is_array($config['ppps']['ppp']))
+ $config['ppps']['ppp'] = array();
+
+$a_ppps = &$config['ppps']['ppp'] ;
+
+function ppp_inuse($num) {
+ global $config, $g;
+
+ if ($config['interfaces']['lan']['if'] == "ppp{$num}")
+ return true;
+ if ($config['interfaces']['wan']['if'] == "ppp{$num}")
+ return true;
+
+ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
+ if ($config['interfaces']['opt' . $i]['if'] == "ppp{$num}")
+ return true;
+ }
+
+ return false;
+}
+
+function renumber_ppp($if, $delppp) {
+ if (!preg_match("/^ppp/", $if))
+ return $if;
+
+ $ppp = substr($if, 4);
+ if ($ppp > $delppp)
+ return "ppp" . ($ppp - 1);
+ else
+ return $if;
+}
+
+if ($_GET['act'] == "del") {
+ /* check if still in use */
+ if (ppp_inuse($_GET['id'])) {
+ $input_errors[] = "This PPP interface cannot be deleted because it is still being used as an interface.";
+ } else {
+ unset($a_ppps[$_GET['id']]);
+
+ /* renumber all interfaces that use PPP */
+ $config['interfaces']['lan']['if'] = renumber_ppp($config['interfaces']['lan']['if'], $_GET['id']);
+ $config['interfaces']['wan']['if'] = renumber_ppp($config['interfaces']['wan']['if'], $_GET['id']);
+ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
+ $config['interfaces']['opt' . $i]['if'] = renumber_ppp($config['interfaces']['opt' . $i]['if'], $_GET['id']);
+
+ write_config();
+
+ interfaces_optional_configure();
+
+ header("Location: interfaces_ppp.php");
+ exit;
+ }
+}
+
+
+$pgtitle = "Interfaces: PPP";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
+ $tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
+ $tab_array[2] = array("PPP", true, "interfaces_ppp.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="20%" class="listhdrr">Interface</td>
+ <td width="20%" class="listhdrr">Serial Port</td>
+ <td width="50%" class="listhdr">Description</td>
+ <td width="10%" class="list"></td>
+ </tr>
+ <?php $i = 0; foreach ($a_ppps as $id => $ppp): ?>
+ <tr>
+ <td class="listlr">
+ ppp<?=htmlspecialchars($id);?>
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($ppp['port']);?>
+ </td>
+ <td class="listbg">
+ <font color="white">
+ <?=htmlspecialchars($ppp['descr']);?>&nbsp;
+ </font>
+ </td>
+ <td valign="middle" nowrap class="list"> <a href="interfaces_ppp_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
+ &nbsp;<a href="interfaces_ppp.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this PPP interface?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="3">&nbsp;</td>
+ <td class="list"> <a href="interfaces_ppp_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/interfaces_ppp_edit.php b/usr/local/www/interfaces_ppp_edit.php
new file mode 100644
index 0000000..d6f7753
--- /dev/null
+++ b/usr/local/www/interfaces_ppp_edit.php
@@ -0,0 +1,166 @@
+<?php
+/*
+ interfaces_lan.php
+ part of pfSense(http://pfsense.org)
+
+ Originally written by Adam Lebsack <adam at holonyx dot com>
+ Changes by Chris Buechler <cmb at pfsense dot org>
+
+ Copyright (C) 2004-2008 BSD Perimeter LLC.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("guiconfig.inc");
+
+if (!is_array($config['ppps']['ppp']))
+ $config['ppps']['ppp'] = array();
+
+$a_ppps = &$config['ppps']['ppp'];
+
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (isset($id) && $a_ppps[$id]) {
+ $pconfig['if'] = $a_ppps[$id]['if'];
+ $pconfig['initstr'] = $a_ppps[$id]['initstr'];
+ $pconfig['phone'] = $a_ppps[$id]['phone'];
+ $pconfig['linespeed'] = $a_ppps[$id]['linespeed'];
+ $pconfig['descr'] = $a_ppps[$id]['descr'];
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = explode(" ", "port");
+ $reqdfieldsn = explode(",", "Serial Port");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ foreach ($a_ppps as $ppp) {
+ if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp))
+ continue;
+
+ if ($ppp['port'] == $_POST['port']) {
+ $input_errors[] = "Port is in use";
+ break;
+ }
+ }
+
+ if (!$input_errors) {
+ $ppp = array();
+ $ppp['port'] = $_POST['port'];
+ $ppp['initstr'] = $_POST['initstr'];
+ $ppp['phone'] = $_POST['phone'];
+ $ppp['linespeed'] = $_POST['linespeed'];
+ $ppp['descr'] = $_POST['descr'];
+
+ if (isset($id) && $a_ppps[$id])
+ $a_ppps[$id] = $ppp;
+ else
+ $a_ppps[] = $ppp;
+
+ write_config();
+
+ interfaces_optional_configure();
+
+ header("Location: interfaces_ppp.php");
+ exit;
+ }
+}
+
+$pgtitle = "Firewall: PPP: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+ <form action="interfaces_ppp_edit.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Parent interface</td>
+ <td width="78%" class="vtable">
+ <select name="port" class="formfld">
+ <?php
+ $portlist = glob("/dev/cua*");
+ foreach ($portlist as $port) {
+ if(preg_match("/\.(lock|init)$/", $port))
+ continue;
+ echo "<option value=\"{$port}\"";
+ if (false)
+ echo "selected";
+ echo ">";
+ echo $port;
+ echo "</option>";
+ }
+ ?>
+ </select>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Init String</td>
+ <td width="78%" class="vtable">
+ <textarea name="initstr"><?=htmlspecialchars($pconfig['initstr']);?></textarea>
+ <br> <span class="vexpl">Enter the modem initialization string here</span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Phone Number</td>
+ <td width="78%" class="vtable">
+ <input name="phone" type="text" class="formfld" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Line Speed</td>
+ <td width="78%" class="vtable">
+ <input name="linespeed" type="text" class="formfld" id="linespeed" size="40" value="<?=htmlspecialchars($pconfig['linespeed']);?>">
+ </td>
+ </tr>
+
+ <tr>
+ <td width="22%" valign="top" class="vncell">Description</td>
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
+ <br> <span class="vexpl">You may enter a description here
+ for your reference (not parsed).</span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save"> <input type="button" value="Cancel" onclick="history.back()">
+ <?php if (isset($id) && $a_ppps[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php
index c1d859a..0ed7ee6 100755
--- a/usr/local/www/interfaces_vlan.php
+++ b/usr/local/www/interfaces_vlan.php
@@ -100,6 +100,7 @@ include("head.inc");
$tab_array = array();
$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
$tab_array[1] = array("VLANs", true, "interfaces_vlan.php");
+ $tab_array[2] = array("PPP", false, "interfaces_ppp.php");
display_top_tabs($tab_array);
?>
</td></tr>
OpenPOWER on IntegriCloud