summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-07-14 21:01:53 +0000
committerErmal Luçi <eri@pfsense.org>2008-07-14 21:01:53 +0000
commitf1f60c926a4167268e68e4ad000d412c50a63635 (patch)
tree971abccab7e81f3bbff3a8164a6d1ada67f09b60 /usr
parent67ee1ec5ec2fe7722d0039aa98da72c4f58107f9 (diff)
downloadpfsense-f1f60c926a4167268e68e4ad000d412c50a63635.zip
pfsense-f1f60c926a4167268e68e4ad000d412c50a63635.tar.gz
* Merge multiple PPPoE/PPTP interfaces from RELENG_1_MULTI_ANYTHING
* Much improved rule generation speed * Many bug fixing in general of the interface handling NOTE: this is the other half of changes
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/fbegin.inc4
-rwxr-xr-xusr/local/www/firewall_nat_out.php5
-rwxr-xr-xusr/local/www/firewall_rules.php5
-rwxr-xr-xusr/local/www/firewall_rules_edit.php3
-rwxr-xr-xusr/local/www/interfaces.php165
-rwxr-xr-xusr/local/www/interfaces_assign.php3
-rw-r--r--usr/local/www/interfaces_ppp.php2
-rw-r--r--usr/local/www/interfaces_ppp_edit.php2
-rwxr-xr-xusr/local/www/interfaces_wan.php165
-rwxr-xr-xusr/local/www/services_dyndns.php326
-rw-r--r--usr/local/www/services_dyndns_edit.php221
-rw-r--r--usr/local/www/services_rfc2136.php114
-rw-r--r--usr/local/www/services_rfc2136_edit.php114
-rwxr-xr-xusr/local/www/status_interfaces.php12
14 files changed, 758 insertions, 383 deletions
diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc
index 9db1963..23efdb1 100755
--- a/usr/local/www/fbegin.inc
+++ b/usr/local/www/fbegin.inc
@@ -139,7 +139,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
<?php if (!isset($config['system']['webgui']['noassigninterfaces'])): ?>
<?=output_menu_item("/interfaces_assign.php", "(assign)");?>
<?php endif; ?>
- <?=output_menu_item("/interfaces_wan.php", "WAN");?>
+ <?=output_menu_item("/interfaces_wan.php?if=wan", "WAN");?>
<?php
if($config['interfaces']['lan']) {
output_menu_item("/interfaces_lan.php", "LAN");
@@ -148,7 +148,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
<?php $opts = get_configured_interface_with_descr(true, true);
foreach ($opts as $oif => $odescr):
if (!isset($config['interfaces'][$oif]['ovpn'])): ?>
- <?=output_menu_item("/interfaces_opt.php?optif={$oif}", htmlspecialchars($odescr))?>
+ <?=output_menu_item("/interfaces_wan.php?if={$oif}", htmlspecialchars($odescr))?>
<?php endif; endforeach; ?>
<?php echo return_ext_menu("Interfaces"); ?>
</ul>
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php
index 99fc3f7..5ee1c11 100755
--- a/usr/local/www/firewall_nat_out.php
+++ b/usr/local/www/firewall_nat_out.php
@@ -73,7 +73,8 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
case "advancedoutboundnat":
$was_enabled = isset($config['nat']['advancedoutbound']['enable']);
$config['nat']['advancedoutbound']['enable'] = true;
- unset($config['nat']['ipsecpassthru']['enable']);
+ if (isset($config['nat']['ipsecpassthru']['enable']))
+ unset($config['nat']['ipsecpassthru']['enable']);
if($was_enabled == false) {
/*
* user has enabled advanced outbound nat -- lets automatically create entries
@@ -252,6 +253,8 @@ include("head.inc");
echo "WAN";
else if (!$natent['interface'] || ($natent['interface'] == "lan"))
echo "LAN";
+ else if ($natent['interface'] == "openvpn")
+ echo "OpenVPN";
else
echo htmlspecialchars($config['interfaces'][$natent['interface']]['descr']);
?>
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index df4300f..a12449a 100755
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -261,7 +261,7 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript
</table>
</td>
</tr>
-<?php if (($if == "wan") && isset($config['interfaces']['wan']['blockpriv'])): ?>
+<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
<tr valign="top" id="frrfc1918">
<td width="3%" class="list">&nbsp;</td>
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td>
@@ -288,7 +288,7 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript
</td>
</tr>
<?php endif; ?>
-<?php if (($if == "wan") && isset($config['interfaces']['wan']['blockbogons'])): ?>
+<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
<tr valign="top" id="frrfc1918">
<td width="3%" class="list">&nbsp;</td>
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td>
@@ -299,6 +299,7 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript
<td class="listr" style="background-color: #e0e0e0">*</td>
<td class="listr" style="background-color: #e0e0e0">*</td>
<td class="listr" style="background-color: #e0e0e0">*</td>
+ <td class="listr" style="background-color: #e0e0e0">*</td>
<td class="listbg" style="background-color: #990000"><font color="white">Block private networks</td>
<td valign="middle" nowrap class="list">
<table border="0" cellspacing="0" cellpadding="1">
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index 391956d..beec337 100755
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -993,7 +993,8 @@ on another rule.")?>
}
$iflist = get_configured_interface_with_descr();
foreach ($iflist as $ifent => $ifdesc) {
- if($config['interfaces'][$ifent]['ipaddr'] == "dhcp") {
+ if (in_array($config['interfaces'][$ifent]['ipaddr'],
+ array("dhcp", "pppoe", "pptp"))) {
if ($pconfig['gateway'] == $ifent) {
$selected = " SELECTED";
} else {
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 516ab1e..436674f 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -36,7 +36,7 @@ define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
define("CRON_DAILY_PATTERN", "0 0 * * *");
define("CRON_HOURLY_PATTERN", "0 * * * *");
define("CRON_PPPOE_CMD_FILE", "/etc/pppoerestart");
-define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart(); services_dyndns_reset(); ?>' | /usr/local/bin/php -q");
+define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart($if); services_dyndns_reset($if); ?>' | /usr/local/bin/php -q");
function getMPDCRONSettings() {
global $config;
@@ -66,20 +66,32 @@ function getMPDResetTimeFromConfig() {
}
}
+function remove_bad_chars($string) {
+ return preg_replace('/[^a-z|_|0-9]/i','',$string);
+}
+
require("guiconfig.inc");
+unset($if);
+if ($_GET['if'])
+ $if = $_GET['if'];
+else if ($_POST['if'])
+ $if = $_POST['if'];
+
+if (!$if)
+ $if = "wan";
+
if (!is_array($config['gateways']['gateway_item']))
$config['gateways']['gateway_item'] = array();
$a_gateways = &$config['gateways']['gateway_item'];
-$wancfg = &$config['interfaces']['wan'];
-$optcfg = &$config['interfaces']['wan'];
+$wancfg = &$config['interfaces'][$if];
-$pconfig['username'] = $config['pppoe']['username'];
-$pconfig['password'] = $config['pppoe']['password'];
-$pconfig['provider'] = $config['pppoe']['provider'];
-$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
-$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
+$pconfig['username'] = $wancfg['username'];
+$pconfig['password'] = $wancfg['password'];
+$pconfig['provider'] = $wancfg['provider'];
+$pconfig['pppoe_dialondemand'] = isset($wancfg['ondemand']);
+$pconfig['pppoe_idletimeout'] = $wancfg['timeout'];
/* ================================================ */
/* = force a connection reset at a specific time? = */
@@ -121,25 +133,33 @@ if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
}
}
-$pconfig['pptp_username'] = $config['pptp']['username'];
-$pconfig['pptp_password'] = $config['pptp']['password'];
-$pconfig['pptp_local'] = $config['pptp']['local'];
-$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
-$pconfig['pptp_remote'] = $config['pptp']['remote'];
-$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
-$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
+$pconfig['pptp_username'] = $wancfg['username'];
+$pconfig['pptp_password'] = $wancfg['password'];
+$pconfig['pptp_local'] = $wancfg['local'];
+$pconfig['pptp_subnet'] = $wancfg['subnet'];
+$pconfig['pptp_remote'] = $wancfg['remote'];
+$pconfig['pptp_dialondemand'] = isset($wancfg['ondemand']);
+$pconfig['pptp_idletimeout'] = $wancfg['timeout'];
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
$pconfig['alias-address'] = $wancfg['alias-address'];
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
+$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
+$pconfig['enable'] = isset($wancfg['enable']);
+
+if (is_array($config['aliases']['alias']))
+foreach($config['aliases']['alias'] as $alias)
+ if($alias['name'] == $wancfg['descr'])
+ $input_errors[] = gettext("Sorry, an alias with the name {$wancfg['descr']} a
+lready exists.");
if ($wancfg['ipaddr'] == "dhcp") {
$pconfig['type'] = "DHCP";
} else if ($wancfg['ipaddr'] == "carpdev-dhcp") {
-// $pconfig['type'] = "CarpDEV-DHCP";
-// $pconfig['ipaddr'] = "";
+ $pconfig['type'] = "CarpDEV-DHCP";
+ $pconfig['ipaddr'] = "";
} else if ($wancfg['ipaddr'] == "pppoe") {
$pconfig['type'] = "PPPoE";
} else if ($wancfg['ipaddr'] == "pptp") {
@@ -148,7 +168,7 @@ if ($wancfg['ipaddr'] == "dhcp") {
$pconfig['type'] = "Static";
$pconfig['ipaddr'] = $wancfg['ipaddr'];
$pconfig['subnet'] = $wancfg['subnet'];
- $pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
+ $pconfig['gateway'] = $wancfg['gateway'];
$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
}
@@ -168,6 +188,20 @@ if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
+ /* filter out spaces from descriptions */
+ $_POST['descr'] = remove_bad_chars($_POST['descr']);
+
+ if ($_POST['enable'] || $if == "wan") {
+ /* optional interface if list */
+ $iflist = get_configured_interface_with_descr(true);
+
+ /* description unique? */
+ foreach ($iflist as $ifent => $ifdescr) {
+ if ($if != $ifent && $ifdescr == $_POST['descr'])
+ $input_errors[] = "An interface with the specified descriptio
+n already exists.";
+ }
+
/* okay first of all, cause we are just hidding the PPPoE HTML
* fields releated to PPPoE resets, we are going to unset $_POST
* vars, if the reset feature should not be used. Otherwise the
@@ -208,8 +242,13 @@ if ($_POST) {
/* input validation */
if ($_POST['type'] == "Static") {
- $reqdfields = explode(" ", "ipaddr subnet gateway");
- $reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
+ if ($if == "wan") {
+ $reqdfields = explode(" ", "ipaddr subnet gateway");
+ $reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
+ } else {
+ $reqdfields = explode(" ", "ipaddr subnet");
+ $reqdfieldsn = explode(",", "IP address,Subnet bit count");
+ }
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
} else if ($_POST['type'] == "PPPoE") {
if ($_POST['pppoe_dialondemand']) {
@@ -294,6 +333,7 @@ if ($_POST) {
if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
}
+ }
/* Wireless interface? */
if (isset($wancfg['wireless'])) {
@@ -312,26 +352,18 @@ if ($_POST) {
unset($wancfg['ipaddr']);
unset($wancfg['subnet']);
- unset($config['interfaces']['wan']['gateway']);
+ unset($wancfg['gateway']);
unset($wancfg['pointtopoint']);
unset($wancfg['dhcphostname']);
- if (is_array($wancfg['pppoe'])) {
- unset($config['pppoe']['username']);
- unset($config['pppoe']['password']);
- unset($config['pppoe']['provider']);
- unset($config['pppoe']['ondemand']);
- unset($config['pppoe']['timeout']);
- unset($wancfg['pppoe']['pppoe-reset-type']);
- }
- if (is_array($wancfg['pptp'])) {
- unset($config['pptp']['username']);
- unset($config['pptp']['password']);
- unset($config['pptp']['local']);
- unset($config['pptp']['subnet']);
- unset($config['pptp']['remote']);
- unset($config['pptp']['ondemand']);
- unset($config['pptp']['timeout']);
- }
+ unset($wancfg['username']);
+ unset($wancfg['password']);
+ unset($wancfg['provider']);
+ unset($wancfg['ondemand']);
+ unset($wancfg['timeout']);
+ unset($wancfg['pppoe']['pppoe-reset-type']);
+ unset($wancfg['local']);
+ unset($wancfg['subnet']);
+ unset($wancfg['remote']);
unset($wancfg['disableftpproxy']);
/* per interface pftpx helper */
@@ -342,10 +374,13 @@ if ($_POST) {
system_start_ftp_helpers();
}
+ $wancfg['descr'] = remove_bad_chars($_POST['descr']);
+ $wancfg['enable'] = $if == "wan" ? true : $_POST['enable'] ? true : false;
+
if ($_POST['type'] == "Static") {
$wancfg['ipaddr'] = $_POST['ipaddr'];
$wancfg['subnet'] = $_POST['subnet'];
- $config['interfaces']['wan']['gateway'] = $_POST['gateway'];
+ $wancfg['gateway'] = $_POST['gateway'];
if (isset($wancfg['ispointtopoint']))
$wancfg['pointtopoint'] = $_POST['pointtopoint'];
} else if ($_POST['type'] == "DHCP") {
@@ -360,11 +395,11 @@ if ($_POST) {
$wancfg['alias-subnet'] = $_POST['alias-subnet'];
} else if ($_POST['type'] == "PPPoE") {
$wancfg['ipaddr'] = "pppoe";
- $config['pppoe']['username'] = $_POST['username'];
- $config['pppoe']['password'] = $_POST['password'];
- $config['pppoe']['provider'] = $_POST['provider'];
- $config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
- $config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
+ $wancfg['username'] = $_POST['username'];
+ $wancfg['password'] = $_POST['password'];
+ $wancfg['provider'] = $_POST['provider'];
+ $wancfg['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
+ $wancfg['timeout'] = $_POST['pppoe_idletimeout'];
/* perform a periodic reset? */
if (isset($_POST['pppoe_preset'])) {
@@ -448,13 +483,13 @@ if ($_POST) {
} // end if
} else if ($_POST['type'] == "PPTP") {
$wancfg['ipaddr'] = "pptp";
- $config['pptp']['username'] = $_POST['pptp_username'];
- $config['pptp']['password'] = $_POST['pptp_password'];
- $config['pptp']['local'] = $_POST['pptp_local'];
- $config['pptp']['subnet'] = $_POST['pptp_subnet'];
- $config['pptp']['remote'] = $_POST['pptp_remote'];
- $config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
- $config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
+ $wancfg['username'] = $_POST['pptp_username'];
+ $wancfg['password'] = $_POST['pptp_password'];
+ $wancfg['local'] = $_POST['pptp_local'];
+ $wancfg['subnet'] = $_POST['pptp_subnet'];
+ $wancfg['remote'] = $_POST['pptp_remote'];
+ $wancfg['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
+ $wancfg['timeout'] = $_POST['pptp_idletimeout'];
}
/* reset cron items if necessary */
@@ -503,7 +538,7 @@ if ($_POST) {
}
}
-$pgtitle = array("Interfaces","WAN");
+$pgtitle = array("Interfaces", $wancfg['descr']);
$closehead = false;
include("head.inc");
@@ -694,10 +729,27 @@ function show_mon_config() {
<tr>
<td colspan="2" valign="top" class="listtopic">General configuration</td>
</tr>
+<?php if ($if != "wan"): ?>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
+ <strong>Enable Interface <?=$if;?> interface</strong></td>
+ </tr>
+<?php endif; ?>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Description</td>
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" class="formfld unknown" id="descr" size="
+30" value="<?=htmlspecialchars($pconfig['descr']);?>">
+ <br> <span class="vexpl">Enter a description (name) f
+or the interface here.</span>
+ </td>
+ </tr>
<tr>
<td valign="middle" class="vncell"><strong>Type</strong></td>
<td class="vtable"> <select name="type" class="formselect" id="type" onchange="type_change()">
- <?php $opts = split(" ", "Static DHCP PPPoE PPTP");
+ <?php $opts = split(" ", "Static DHCP PPPoE PPTP"); // CarpDEV-DHCP");
foreach ($opts as $opt): ?>
<option <?php if ($opt == $pconfig['type']) echo "selected";?>>
<?=htmlspecialchars($opt);?>
@@ -765,7 +817,7 @@ function show_mon_config() {
<?php
if(count($a_gateways) > 0) {
foreach ($a_gateways as $gateway) {
- if($gateway['interface'] == "wan") {
+ if($gateway['interface'] == $if) {
?>
<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
<?=htmlspecialchars($gateway['name']);?>
@@ -993,6 +1045,7 @@ seconds<br>If no qualifying outgoing packets are transmitted for the specified n
<tr>
<td width="100" valign="top">&nbsp;</td>
<td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
+ <input name="if" type="hidden" id="if" value="<?=$if;?>">
</td>
</tr>
</table>
@@ -1019,7 +1072,7 @@ if ($_POST) {
flush();
sleep(1);
- interfaces_wan_configure();
+ interfaces_wan_configure($if);
reset_carp();
@@ -1032,4 +1085,4 @@ if ($_POST) {
}
}
-?> \ No newline at end of file
+?>
diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php
index 1ee275e..580eb1f 100755
--- a/usr/local/www/interfaces_assign.php
+++ b/usr/local/www/interfaces_assign.php
@@ -152,7 +152,7 @@ if ($_GET['act'] == "del") {
$id = $_GET['id'];
unset($config['interfaces'][$id]['enable']);
- interfaces_optional_configure_if($id); /* down the interface */
+ interface_bring_down($id); /* down the interface */
unset($config['interfaces'][$id]); /* delete the specified OPTn or LAN*/
@@ -271,6 +271,7 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed"))
$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");
+ $tab_array[3] = array("Bridges", false, "interfaces_bridges.php");
display_top_tabs($tab_array);
?>
</td></tr>
diff --git a/usr/local/www/interfaces_ppp.php b/usr/local/www/interfaces_ppp.php
index c72c771..22a871f 100644
--- a/usr/local/www/interfaces_ppp.php
+++ b/usr/local/www/interfaces_ppp.php
@@ -74,7 +74,7 @@ if ($_GET['act'] == "del") {
write_config();
- interfaces_optional_configure();
+ interfaces_configure();
header("Location: interfaces_ppp.php");
exit;
diff --git a/usr/local/www/interfaces_ppp_edit.php b/usr/local/www/interfaces_ppp_edit.php
index 244bf1d..f32205a 100644
--- a/usr/local/www/interfaces_ppp_edit.php
+++ b/usr/local/www/interfaces_ppp_edit.php
@@ -87,7 +87,7 @@ if ($_POST) {
write_config();
- interfaces_optional_configure();
+ interfaces_configure();
header("Location: interfaces_ppp.php");
exit;
diff --git a/usr/local/www/interfaces_wan.php b/usr/local/www/interfaces_wan.php
index 516ab1e..436674f 100755
--- a/usr/local/www/interfaces_wan.php
+++ b/usr/local/www/interfaces_wan.php
@@ -36,7 +36,7 @@ define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
define("CRON_DAILY_PATTERN", "0 0 * * *");
define("CRON_HOURLY_PATTERN", "0 * * * *");
define("CRON_PPPOE_CMD_FILE", "/etc/pppoerestart");
-define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart(); services_dyndns_reset(); ?>' | /usr/local/bin/php -q");
+define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart($if); services_dyndns_reset($if); ?>' | /usr/local/bin/php -q");
function getMPDCRONSettings() {
global $config;
@@ -66,20 +66,32 @@ function getMPDResetTimeFromConfig() {
}
}
+function remove_bad_chars($string) {
+ return preg_replace('/[^a-z|_|0-9]/i','',$string);
+}
+
require("guiconfig.inc");
+unset($if);
+if ($_GET['if'])
+ $if = $_GET['if'];
+else if ($_POST['if'])
+ $if = $_POST['if'];
+
+if (!$if)
+ $if = "wan";
+
if (!is_array($config['gateways']['gateway_item']))
$config['gateways']['gateway_item'] = array();
$a_gateways = &$config['gateways']['gateway_item'];
-$wancfg = &$config['interfaces']['wan'];
-$optcfg = &$config['interfaces']['wan'];
+$wancfg = &$config['interfaces'][$if];
-$pconfig['username'] = $config['pppoe']['username'];
-$pconfig['password'] = $config['pppoe']['password'];
-$pconfig['provider'] = $config['pppoe']['provider'];
-$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
-$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
+$pconfig['username'] = $wancfg['username'];
+$pconfig['password'] = $wancfg['password'];
+$pconfig['provider'] = $wancfg['provider'];
+$pconfig['pppoe_dialondemand'] = isset($wancfg['ondemand']);
+$pconfig['pppoe_idletimeout'] = $wancfg['timeout'];
/* ================================================ */
/* = force a connection reset at a specific time? = */
@@ -121,25 +133,33 @@ if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
}
}
-$pconfig['pptp_username'] = $config['pptp']['username'];
-$pconfig['pptp_password'] = $config['pptp']['password'];
-$pconfig['pptp_local'] = $config['pptp']['local'];
-$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
-$pconfig['pptp_remote'] = $config['pptp']['remote'];
-$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
-$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
+$pconfig['pptp_username'] = $wancfg['username'];
+$pconfig['pptp_password'] = $wancfg['password'];
+$pconfig['pptp_local'] = $wancfg['local'];
+$pconfig['pptp_subnet'] = $wancfg['subnet'];
+$pconfig['pptp_remote'] = $wancfg['remote'];
+$pconfig['pptp_dialondemand'] = isset($wancfg['ondemand']);
+$pconfig['pptp_idletimeout'] = $wancfg['timeout'];
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
$pconfig['alias-address'] = $wancfg['alias-address'];
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
+$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
+$pconfig['enable'] = isset($wancfg['enable']);
+
+if (is_array($config['aliases']['alias']))
+foreach($config['aliases']['alias'] as $alias)
+ if($alias['name'] == $wancfg['descr'])
+ $input_errors[] = gettext("Sorry, an alias with the name {$wancfg['descr']} a
+lready exists.");
if ($wancfg['ipaddr'] == "dhcp") {
$pconfig['type'] = "DHCP";
} else if ($wancfg['ipaddr'] == "carpdev-dhcp") {
-// $pconfig['type'] = "CarpDEV-DHCP";
-// $pconfig['ipaddr'] = "";
+ $pconfig['type'] = "CarpDEV-DHCP";
+ $pconfig['ipaddr'] = "";
} else if ($wancfg['ipaddr'] == "pppoe") {
$pconfig['type'] = "PPPoE";
} else if ($wancfg['ipaddr'] == "pptp") {
@@ -148,7 +168,7 @@ if ($wancfg['ipaddr'] == "dhcp") {
$pconfig['type'] = "Static";
$pconfig['ipaddr'] = $wancfg['ipaddr'];
$pconfig['subnet'] = $wancfg['subnet'];
- $pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
+ $pconfig['gateway'] = $wancfg['gateway'];
$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
}
@@ -168,6 +188,20 @@ if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
+ /* filter out spaces from descriptions */
+ $_POST['descr'] = remove_bad_chars($_POST['descr']);
+
+ if ($_POST['enable'] || $if == "wan") {
+ /* optional interface if list */
+ $iflist = get_configured_interface_with_descr(true);
+
+ /* description unique? */
+ foreach ($iflist as $ifent => $ifdescr) {
+ if ($if != $ifent && $ifdescr == $_POST['descr'])
+ $input_errors[] = "An interface with the specified descriptio
+n already exists.";
+ }
+
/* okay first of all, cause we are just hidding the PPPoE HTML
* fields releated to PPPoE resets, we are going to unset $_POST
* vars, if the reset feature should not be used. Otherwise the
@@ -208,8 +242,13 @@ if ($_POST) {
/* input validation */
if ($_POST['type'] == "Static") {
- $reqdfields = explode(" ", "ipaddr subnet gateway");
- $reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
+ if ($if == "wan") {
+ $reqdfields = explode(" ", "ipaddr subnet gateway");
+ $reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
+ } else {
+ $reqdfields = explode(" ", "ipaddr subnet");
+ $reqdfieldsn = explode(",", "IP address,Subnet bit count");
+ }
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
} else if ($_POST['type'] == "PPPoE") {
if ($_POST['pppoe_dialondemand']) {
@@ -294,6 +333,7 @@ if ($_POST) {
if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
}
+ }
/* Wireless interface? */
if (isset($wancfg['wireless'])) {
@@ -312,26 +352,18 @@ if ($_POST) {
unset($wancfg['ipaddr']);
unset($wancfg['subnet']);
- unset($config['interfaces']['wan']['gateway']);
+ unset($wancfg['gateway']);
unset($wancfg['pointtopoint']);
unset($wancfg['dhcphostname']);
- if (is_array($wancfg['pppoe'])) {
- unset($config['pppoe']['username']);
- unset($config['pppoe']['password']);
- unset($config['pppoe']['provider']);
- unset($config['pppoe']['ondemand']);
- unset($config['pppoe']['timeout']);
- unset($wancfg['pppoe']['pppoe-reset-type']);
- }
- if (is_array($wancfg['pptp'])) {
- unset($config['pptp']['username']);
- unset($config['pptp']['password']);
- unset($config['pptp']['local']);
- unset($config['pptp']['subnet']);
- unset($config['pptp']['remote']);
- unset($config['pptp']['ondemand']);
- unset($config['pptp']['timeout']);
- }
+ unset($wancfg['username']);
+ unset($wancfg['password']);
+ unset($wancfg['provider']);
+ unset($wancfg['ondemand']);
+ unset($wancfg['timeout']);
+ unset($wancfg['pppoe']['pppoe-reset-type']);
+ unset($wancfg['local']);
+ unset($wancfg['subnet']);
+ unset($wancfg['remote']);
unset($wancfg['disableftpproxy']);
/* per interface pftpx helper */
@@ -342,10 +374,13 @@ if ($_POST) {
system_start_ftp_helpers();
}
+ $wancfg['descr'] = remove_bad_chars($_POST['descr']);
+ $wancfg['enable'] = $if == "wan" ? true : $_POST['enable'] ? true : false;
+
if ($_POST['type'] == "Static") {
$wancfg['ipaddr'] = $_POST['ipaddr'];
$wancfg['subnet'] = $_POST['subnet'];
- $config['interfaces']['wan']['gateway'] = $_POST['gateway'];
+ $wancfg['gateway'] = $_POST['gateway'];
if (isset($wancfg['ispointtopoint']))
$wancfg['pointtopoint'] = $_POST['pointtopoint'];
} else if ($_POST['type'] == "DHCP") {
@@ -360,11 +395,11 @@ if ($_POST) {
$wancfg['alias-subnet'] = $_POST['alias-subnet'];
} else if ($_POST['type'] == "PPPoE") {
$wancfg['ipaddr'] = "pppoe";
- $config['pppoe']['username'] = $_POST['username'];
- $config['pppoe']['password'] = $_POST['password'];
- $config['pppoe']['provider'] = $_POST['provider'];
- $config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
- $config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
+ $wancfg['username'] = $_POST['username'];
+ $wancfg['password'] = $_POST['password'];
+ $wancfg['provider'] = $_POST['provider'];
+ $wancfg['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
+ $wancfg['timeout'] = $_POST['pppoe_idletimeout'];
/* perform a periodic reset? */
if (isset($_POST['pppoe_preset'])) {
@@ -448,13 +483,13 @@ if ($_POST) {
} // end if
} else if ($_POST['type'] == "PPTP") {
$wancfg['ipaddr'] = "pptp";
- $config['pptp']['username'] = $_POST['pptp_username'];
- $config['pptp']['password'] = $_POST['pptp_password'];
- $config['pptp']['local'] = $_POST['pptp_local'];
- $config['pptp']['subnet'] = $_POST['pptp_subnet'];
- $config['pptp']['remote'] = $_POST['pptp_remote'];
- $config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
- $config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
+ $wancfg['username'] = $_POST['pptp_username'];
+ $wancfg['password'] = $_POST['pptp_password'];
+ $wancfg['local'] = $_POST['pptp_local'];
+ $wancfg['subnet'] = $_POST['pptp_subnet'];
+ $wancfg['remote'] = $_POST['pptp_remote'];
+ $wancfg['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
+ $wancfg['timeout'] = $_POST['pptp_idletimeout'];
}
/* reset cron items if necessary */
@@ -503,7 +538,7 @@ if ($_POST) {
}
}
-$pgtitle = array("Interfaces","WAN");
+$pgtitle = array("Interfaces", $wancfg['descr']);
$closehead = false;
include("head.inc");
@@ -694,10 +729,27 @@ function show_mon_config() {
<tr>
<td colspan="2" valign="top" class="listtopic">General configuration</td>
</tr>
+<?php if ($if != "wan"): ?>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
+ <strong>Enable Interface <?=$if;?> interface</strong></td>
+ </tr>
+<?php endif; ?>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Description</td>
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" class="formfld unknown" id="descr" size="
+30" value="<?=htmlspecialchars($pconfig['descr']);?>">
+ <br> <span class="vexpl">Enter a description (name) f
+or the interface here.</span>
+ </td>
+ </tr>
<tr>
<td valign="middle" class="vncell"><strong>Type</strong></td>
<td class="vtable"> <select name="type" class="formselect" id="type" onchange="type_change()">
- <?php $opts = split(" ", "Static DHCP PPPoE PPTP");
+ <?php $opts = split(" ", "Static DHCP PPPoE PPTP"); // CarpDEV-DHCP");
foreach ($opts as $opt): ?>
<option <?php if ($opt == $pconfig['type']) echo "selected";?>>
<?=htmlspecialchars($opt);?>
@@ -765,7 +817,7 @@ function show_mon_config() {
<?php
if(count($a_gateways) > 0) {
foreach ($a_gateways as $gateway) {
- if($gateway['interface'] == "wan") {
+ if($gateway['interface'] == $if) {
?>
<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
<?=htmlspecialchars($gateway['name']);?>
@@ -993,6 +1045,7 @@ seconds<br>If no qualifying outgoing packets are transmitted for the specified n
<tr>
<td width="100" valign="top">&nbsp;</td>
<td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
+ <input name="if" type="hidden" id="if" value="<?=$if;?>">
</td>
</tr>
</table>
@@ -1019,7 +1072,7 @@ if ($_POST) {
flush();
sleep(1);
- interfaces_wan_configure();
+ interfaces_wan_configure($if);
reset_carp();
@@ -1032,4 +1085,4 @@ if ($_POST) {
}
}
-?> \ No newline at end of file
+?>
diff --git a/usr/local/www/services_dyndns.php b/usr/local/www/services_dyndns.php
index 470a8c8..efa0043 100755
--- a/usr/local/www/services_dyndns.php
+++ b/usr/local/www/services_dyndns.php
@@ -1,10 +1,7 @@
<?php
/* $Id$ */
/*
- services_dyndns.php
- part of m0n0wall (http://m0n0.ch/wall)
-
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2008 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,282 +28,99 @@
require("guiconfig.inc");
-if (!is_array($config['dnsupdate'])) {
- $config['dnsupdate'] = array();
-}
-
-$pconfig['username'] = $config['dyndns']['username'];
-$pconfig['password'] = $config['dyndns']['password'];
-$pconfig['host'] = $config['dyndns']['host'];
-$pconfig['mx'] = $config['dyndns']['mx'];
-$pconfig['type'] = $config['dyndns']['type'];
-$pconfig['enable'] = isset($config['dyndns']['enable']);
-$pconfig['wildcard'] = isset($config['dyndns']['wildcard']);
-
-$pconfig['dnsupdate_enable'] = isset($config['dnsupdate']['enable']);
-$pconfig['dnsupdate_host'] = $config['dnsupdate']['host'];
-$pconfig['dnsupdate_ttl'] = $config['dnsupdate']['ttl'];
-if (!$pconfig['dnsupdate_ttl'])
- $pconfig['dnsupdate_ttl'] = 60;
-$pconfig['dnsupdate_keydata'] = $config['dnsupdate']['keydata'];
-$pconfig['dnsupdate_keyname'] = $config['dnsupdate']['keyname'];
-$pconfig['dnsupdate_keytype'] = $config['dnsupdate']['keytype'];
-if (!$pconfig['dnsupdate_keytype'])
- $pconfig['dnsupdate_keytype'] = "zone";
-$pconfig['dnsupdate_server'] = $config['dnsupdate']['server'];
-$pconfig['dnsupdate_usetcp'] = isset($config['dnsupdate']['usetcp']);
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
+if (!is_array($config['dyndnses']['dyndns']))
+ $config['dyndnses']['dyndns'] = array();
- /* input validation */
- $reqdfields = array();
- $reqdfieldsn = array();
- if ($_POST['enable']) {
- $reqdfields = array_merge($reqdfields, explode(" ", "host username password type"));
- $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Hostname,Username,Password,Service type"));
- }
- if ($_POST['dnsupdate_enable']) {
- $reqdfields = array_merge($reqdfields, explode(" ", "dnsupdate_host dnsupdate_ttl dnsupdate_keyname dnsupdate_keydata"));
- $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Hostname,TTL,Key name,Key"));
- }
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+$a_dyndns = &$config['dyndnses']['dyndns'];
- if($pconfig['type'] <> "zoneedit") {
- if (($_POST['host'] && !is_domain($_POST['host']))) {
- $input_errors[] = "The host name contains invalid characters.";
- }
- }
- if (($_POST['mx'] && !is_domain($_POST['mx']))) {
- $input_errors[] = "The MX contains invalid characters.";
- }
- if (($_POST['username'] && !is_dyndns_username($_POST['username']))) {
- $input_errors[] = "The username contains invalid characters.";
- }
-
- if (($_POST['dnsupdate_host'] && !is_domain($_POST['dnsupdate_host']))) {
- $input_errors[] = "The DNS update host name contains invalid characters.";
- }
- if (($_POST['dnsupdate_ttl'] && !is_numericint($_POST['dnsupdate_ttl']))) {
- $input_errors[] = "The DNS update TTL must be an integer.";
- }
- if (($_POST['dnsupdate_keyname'] && !is_domain($_POST['dnsupdate_keyname']))) {
- $input_errors[] = "The DNS update key name contains invalid characters.";
- }
-
- if (!$input_errors) {
- $config['dyndns']['type'] = $_POST['type'];
- $config['dyndns']['username'] = $_POST['username'];
- $config['dyndns']['password'] = $_POST['password'];
- $config['dyndns']['host'] = $_POST['host'];
- $config['dyndns']['mx'] = $_POST['mx'];
- $config['dyndns']['wildcard'] = $_POST['wildcard'] ? true : false;
- $config['dyndns']['enable'] = $_POST['enable'] ? true : false;
-
- $config['dnsupdate']['enable'] = $_POST['dnsupdate_enable'] ? true : false;
- $config['dnsupdate']['host'] = $_POST['dnsupdate_host'];
- $config['dnsupdate']['ttl'] = $_POST['dnsupdate_ttl'];
- $config['dnsupdate']['keyname'] = $_POST['dnsupdate_keyname'];
- $config['dnsupdate']['keytype'] = $_POST['dnsupdate_keytype'];
- $config['dnsupdate']['keydata'] = $_POST['dnsupdate_keydata'];
- $config['dnsupdate']['server'] = $_POST['dnsupdate_server'];
- $config['dnsupdate']['usetcp'] = $_POST['dnsupdate_usetcp'] ? true : false;
+if ($_GET['act'] == "del") {
+ unset($a_dyndns[$_GET['id']]);
write_config();
- $retval = 0;
-
- /* nuke the cache file */
- config_lock();
- services_dyndns_reset();
- $retval = services_dyndns_configure();
- $retval |= services_dnsupdate_process();
- config_unlock();
- $savemsg = get_std_save_message($retval);
- }
+ header("Location: services_dyndns.php");
+ exit;
}
-$pgtitle = array("Services","Dynamic DNS client");
+$pgtitle = array("Services", "Dynamic DNS clients");
include("head.inc");
?>
-<script language="JavaScript">
-<!--
-function enable_change(enable_change) {
- var endis;
-
- endis = !(document.iform.enable.checked || enable_change);
- document.iform.host.disabled = endis;
- document.iform.mx.disabled = endis;
- document.iform.type.disabled = endis;
- document.iform.wildcard.disabled = endis;
- document.iform.username.disabled = endis;
- document.iform.password.disabled = endis;
-
- endis = !(document.iform.dnsupdate_enable.checked || enable_change);
- document.iform.dnsupdate_host.disabled = endis;
- document.iform.dnsupdate_ttl.disabled = endis;
- document.iform.dnsupdate_keyname.disabled = endis;
- document.iform.dnsupdate_keytype[0].disabled = endis;
- document.iform.dnsupdate_keytype[1].disabled = endis;
- document.iform.dnsupdate_keytype[2].disabled = endis;
- document.iform.dnsupdate_keydata.disabled = endis;
- document.iform.dnsupdate_server.disabled = endis;
- document.iform.dnsupdate_usetcp.disabled = endis;
-}
-//-->
-</script>
-
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
+<form action="services_dyndns.php" method="post" name="iform" id="iform">
<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if ($savemsg) print_info_box($savemsg); ?>
- <form action="services_dyndns.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td colspan="2" valign="top" class="optsect_t">
- <table border="0" cellspacing="0" cellpadding="0" width="100%">
- <tr><td class="optsect_s"><strong>Dynamic DNS client</strong></td>
- <td align="right" class="optsect_s"><input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)"> <strong>Enable</strong></td></tr>
- </table></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Service type</td>
- <td width="78%" class="vtable">
- <select name="type" class="formselect" id="type">
- <?php
- $types = explode(",", "DNS-O-Matic DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,ZoneEdit,Loopia,freeDNS");
- $vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns"); $j = 0; for ($j = 0; $j < count($vals); $j++): ?>
- <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['type']) echo "selected";?>>
- <?=htmlspecialchars($types[$j]);?>
- </option>
- <?php endfor; ?>
- </select></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Hostname/Interface</td>
- <td width="78%" class="vtable">
- <input name="host" type="text" class="formfld unknown" id="host" size="30" value="<?=htmlspecialchars($pconfig['host']);?>">
- <br>
- <span class="vexpl">
- <span class="red"><strong>Note:<br></strong>
- </span>
- Enter the complete host/domain name. example: myhost.dyndns.org
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">MX</td>
- <td width="78%" class="vtable">
- <input name="mx" type="text" class="formfld unknown" id="mx" size="30" value="<?=htmlspecialchars($pconfig['mx']);?>">
- <br>
- Note: With DynDNS service you can only use a hostname, not an IP address.
- <br>
- Set this option only if you need a special MX record. Not
- all services support this.</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Wildcards</td>
- <td width="78%" class="vtable">
- <input name="wildcard" type="checkbox" id="wildcard" value="yes" <?php if ($pconfig['wildcard']) echo "checked"; ?>>
- Enable Wildcard</td>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array("DynDns", true, "services_dyndns.php");
+ $tab_array[] = array("RFC 2136", false, "services_rfc2136.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="5%" class="listhdrr"></td>
+ <td width="15%" class="listhdrr">Service</td>
+ <td width="20%" class="listhdrr">Hostname</td>
+ <td width="50%" class="listhdr">Description</td>
+ <td width="10%" class="list"></td>
</tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Username</td>
- <td width="78%" class="vtable">
- <input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
+ <?php $i = 0; foreach ($a_dyndns as $dyndns): ?>
+ <tr>
+ <td class="listlr">
+ <?php $iflist = get_configured_interface_with_descr();
+ foreach ($iflist as $if => $ifdesc):
+ if ($dyndns['interface'] == $if): ?>
+ <?=$ifdesc; break;?>
+ <?php endif; endforeach; ?>
+ </td>
+ <td class="listlr">
+ <?php
+ $types = explode(",", "DNS-O-Matic DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,ZoneEdit,Loopia,freeDNS");
+ $vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns");
+ $j = 0; for ($j = 0; $j < count($vals); $j++)
+ if ($vals[$j] == $dyndns['type']) {
+ echo htmlspecialchars($types[$j]);
+ break;
+ }
+ ?>
</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Password</td>
- <td width="78%" class="vtable">
- <input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
+ <td class="listr">
+ <?=htmlspecialchars($dyndns['host']);?>
</td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
- </td>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="optsect_t">
- <table border="0" cellspacing="0" cellpadding="0" width="100%">
- <tr><td class="optsect_s"><strong>RFC 2136 Dynamic DNS updates</strong></td>
- <td align="right" class="optsect_s"><input name="dnsupdate_enable" type="checkbox" value="yes" <?php if ($pconfig['dnsupdate_enable']) echo "checked"; ?> onClick="enable_change(false)"> <strong>Enable</strong></td></tr>
- </table></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Hostname</td>
- <td width="78%" class="vtable">
- <input name="dnsupdate_host" type="text" class="formfld unknown" id="dnsupdate_host" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_host']);?>">
+ <td class="listbg">
+ <font color="white">
+ <?=htmlspecialchars($dyndns['descr']);?>&nbsp;
+ </font>
</td>
+ <td valign="middle" nowrap class="list"> <a href="services_dyndns_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
+ &nbsp;<a href="services_dyndns.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this VLAN?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
</tr>
+ <?php $i++; endforeach; ?>
<tr>
- <td valign="top" class="vncellreq">TTL</td>
- <td class="vtable">
- <input name="dnsupdate_ttl" type="text" class="formfld unknown" id="dnsupdate_ttl" size="6" value="<?=htmlspecialchars($pconfig['dnsupdate_ttl']);?>">
- seconds</td>
- </tr>
- <tr>
- <td valign="top" class="vncellreq">Key name</td>
- <td class="vtable">
- <input name="dnsupdate_keyname" type="text" class="formfld unknown" id="dnsupdate_keyname" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_keyname']);?>">
- <br>
- This must match the setting on the DNS server.</td>
- </tr>
- <tr>
- <td valign="top" class="vncellreq">Key type </td>
- <td class="vtable">
- <input name="dnsupdate_keytype" type="radio" value="zone" <?php if ($pconfig['dnsupdate_keytype'] == "zone") echo "checked"; ?>> Zone &nbsp;
- <input name="dnsupdate_keytype" type="radio" value="host" <?php if ($pconfig['dnsupdate_keytype'] == "host") echo "checked"; ?>> Host &nbsp;
- <input name="dnsupdate_keytype" type="radio" value="user" <?php if ($pconfig['dnsupdate_keytype'] == "user") echo "checked"; ?>> User
+ <td class="list" colspan="4"></td>
+ <td class="list"> <a href="services_dyndns_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
</tr>
- <tr>
- <td valign="top" class="vncellreq">Key</td>
- <td class="vtable">
- <input name="dnsupdate_keydata" type="text" class="formfld unknown" id="dnsupdate_keydata" size="70" value="<?=htmlspecialchars($pconfig['dnsupdate_keydata']);?>">
- <br>
- Paste an HMAC-MD5 key here.</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Server</td>
- <td width="78%" class="vtable">
- <input name="dnsupdate_server" type="text" class+"formfld" id="dnsupdate_server" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_server'])?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Protocol</td>
- <td width="78%" class="vtable">
- <input name="dnsupdate_usetcp" type="checkbox" id="dnsupdate_usetcp" value="yes" <?php if ($pconfig['dnsupdate_usetcp']) echo "checked"; ?>>
- <strong>Use TCP instead of UDP</strong></td>
+ <tr>
+ <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
+ Note:<br>
+ </strong></span>
+ Add something meaningful here.
+ </td>
+ <td class="list">&nbsp;</td>
</tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
- </strong></span>You must configure a DNS server in <a href="system.php">System:
- General setup</a> or allow the DNS server list to be overridden
- by DHCP/PPP on WAN for dynamic DNS updates to work.</span></td>
- </tr>
</table>
+ </div>
+ </td>
+ </tr>
+</table>
</form>
-<script language="JavaScript">
-<!--
-enable_change(false);
-//-->
-</script>
<?php include("fend.inc"); ?>
</body>
</html>
diff --git a/usr/local/www/services_dyndns_edit.php b/usr/local/www/services_dyndns_edit.php
new file mode 100644
index 0000000..9cc73cd
--- /dev/null
+++ b/usr/local/www/services_dyndns_edit.php
@@ -0,0 +1,221 @@
+<?php
+/* $Id$ */
+/*
+ Copyright (C) 2008 Ermal Luçi
+ 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['dyndnses']['dyndns'])) {
+ $config['dyndnses']['dyndns'] = array();
+}
+
+$a_dyndns = &$config['dyndnses']['dyndns'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (isset($id) && isset($a_dyndns[$id])) {
+ $pconfig['username'] = $a_dyndns[$id]['username'];
+ $pconfig['password'] = $a_dyndns[$id]['password'];
+ $pconfig['host'] = $a_dyndns[$id]['host'];
+ $pconfig['mx'] = $a_dyndns[$id]['mx'];
+ $pconfig['type'] = $a_dyndns[$id]['type'];
+ $pconfig['enable'] = isset($a_dyndns[$id]['enable']);
+ $pconfig['interface'] = $a_dyndns[$id]['interface'];
+ $pconfig['wildcard'] = isset($a_dyndns[$id]['wildcard']);
+ $pconfig['descr'] = $a_dyndns[$id]['descr'];
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = array();
+ $reqdfieldsn = array();
+ $reqdfields = array_merge($reqdfields, explode(" ", "host username password type"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Hostname,Username,Password,Service type"));
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['mx'] && !is_domain($_POST['mx'])))
+ $input_errors[] = "The MX contains invalid characters.";
+ if (($_POST['username'] && !is_dyndns_username($_POST['username'])) || $_POST['username'] == "")
+ $input_errors[] = "The username contains invalid characters.";
+
+ if (!$input_errors) {
+ $dyndns = array();
+ $dyndns['type'] = $_POST['type'];
+ $dyndns['username'] = $_POST['username'];
+ $dyndns['password'] = $_POST['password'];
+ $dyndns['host'] = $_POST['host'];
+ $dyndns['mx'] = $_POST['mx'];
+ $dyndns['wildcard'] = $_POST['wildcard'] ? true : false;
+ $dyndns['enable'] = $_POST['enable'] ? false : true;
+ $dyndns['interface'] = $_POST['interface'];
+ $dyndns['descr'] = $_POST['descr'];
+
+ if (isset($id) && $a_dyndns[$id])
+ $a_dyndns[$id] = $dyndns;
+ else
+ $a_dyndns[] = $dyndns;
+
+ write_config();
+
+ header("Location: services_dyndns.php");
+ exit;
+
+ /* XXX: Make this with a touch file */
+ $retval = 0;
+
+ /* nuke the cache file */
+ config_lock();
+ services_dyndns_reset();
+ $retval = services_dyndns_configure();
+ config_unlock();
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+$pgtitle = array("Services","Dynamic DNS client");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<form action="services_dyndns_edit.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td colspan="2" valign="top" class="optsect_t">
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr><td class="optsect_s"><strong>Dynamic DNS client</strong></td></tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Disable</td>
+ <td width="78%" class="vtable">
+ <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?>>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Service type</td>
+ <td width="78%" class="vtable">
+ <select name="type" class="formselect" id="type">
+ <?php
+ $types = explode(",", "DNS-O-Matic DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,ZoneEdit,Loopia,freeDNS");
+ $vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns");
+ $j = 0; for ($j = 0; $j < count($vals); $j++): ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['type']) echo "selected";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Interface to monitor</td>
+ <td width="78%" class="vtable">
+ <select name="interface" class="formselect" id="interface">
+ <?php $iflist = get_configured_interface_with_descr();
+ foreach ($iflist as $if => $ifdesc):?>
+ <option value="<?=$if;?>" <?php if ($pconfig['interface'] == $if) echo "selected";?>><?=$ifdesc;?></option>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Hostname/Interface</td>
+ <td width="78%" class="vtable">
+ <input name="host" type="text" class="formfld unknown" id="host" size="30" value="<?=htmlspecialchars($pconfig['host']);?>">
+ <br>
+ <span class="vexpl">
+ <span class="red"><strong>Note:<br></strong>
+ </span>
+ Enter the complete host/domain name. example: myhost.dyndns.org
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">MX</td>
+ <td width="78%" class="vtable">
+ <input name="mx" type="text" class="formfld unknown" id="mx" size="30" value="<?=htmlspecialchars($pconfig['mx']);?>">
+ <br>
+ Note: With DynDNS service you can only use a hostname, not an IP address.
+ <br>
+ Set this option only if you need a special MX record. Not
+ all services support this.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Wildcards</td>
+ <td width="78%" class="vtable">
+ <input name="wildcard" type="checkbox" id="wildcard" value="yes" <?php if ($pconfig['wildcard']) echo "checked"; ?>>
+ Enable Wildcard</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Username</td>
+ <td width="78%" class="vtable">
+ <input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Password</td>
+ <td width="78%" class="vtable">
+ <input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Description</td>
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" class="formfld unknown" id="descr" size="60" value="<?=htmlspecialchars($pconfig['descr']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
+ <a href="services_dyndns.php"><input name="cancel" type="button" class="formbtn" value="Cancel"></a>
+ <?php if (isset($id) && $a_dyndns[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
+ </strong></span>You must configure a DNS server in <a href="system.php">System:
+ General setup</a> or allow the DNS server list to be overridden
+ by DHCP/PPP on WAN for dynamic DNS updates to work.</span></td>
+ </tr>
+ </table>
+</form>
+</body>
+</html>
diff --git a/usr/local/www/services_rfc2136.php b/usr/local/www/services_rfc2136.php
new file mode 100644
index 0000000..d5d37a7
--- /dev/null
+++ b/usr/local/www/services_rfc2136.php
@@ -0,0 +1,114 @@
+<?php
+/* $Id$ */
+/*
+ Copyright (C) 2008 Ermal Luçi
+ 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['dnsupdates']['dnsupdate']))
+ $config['dnsupdates']['dnsupdate'] = array();
+
+$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
+
+if ($_GET['act'] == "del") {
+ unset($a_rfc2136[$_GET['id']]);
+
+ write_config();
+
+ header("Location: services_dyndns.php");
+ exit;
+}
+
+$pgtitle = array("Services", "RFC 2136 clients");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="services_rfc2136.php" method="post" name="iform" id="iform">
+<?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[] = array("DynDns", false, "services_dyndns.php");
+ $tab_array[] = array("RFC 2136", true, "services_rfc2136.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="5%" class="listhdrr"></td>
+ <td width="25%" class="listhdrr">Hostname</td>
+ <td width="60%" class="listhdr">Description</td>
+ <td width="10%" class="list"></td>
+ </tr>
+ <?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?>
+ <tr>
+ <td class="listlr">
+ <?php $iflist = get_configured_interface_with_descr();
+ foreach ($iflist as $if => $ifdesc):
+ if ($rfc2136['interface'] == $if): ?>
+ <?=$ifdesc; break;?>
+ <?php endif; endforeach; ?>
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($rfc2136['host']);?>
+ </td>
+ <td class="listbg">
+ <font color="white">
+ <?=htmlspecialchars($rfc2136['descr']);?>&nbsp;
+ </font>
+ </td>
+ <td valign="middle" nowrap class="list"> <a href="services_rfc2136_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
+ &nbsp;<a href="services_rfc2136.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this client?')"><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="services_rfc2136_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
+ Note:<br>
+ </strong></span>
+ Add something meaningful here.
+ </td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/services_rfc2136_edit.php b/usr/local/www/services_rfc2136_edit.php
new file mode 100644
index 0000000..d5d37a7
--- /dev/null
+++ b/usr/local/www/services_rfc2136_edit.php
@@ -0,0 +1,114 @@
+<?php
+/* $Id$ */
+/*
+ Copyright (C) 2008 Ermal Luçi
+ 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['dnsupdates']['dnsupdate']))
+ $config['dnsupdates']['dnsupdate'] = array();
+
+$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
+
+if ($_GET['act'] == "del") {
+ unset($a_rfc2136[$_GET['id']]);
+
+ write_config();
+
+ header("Location: services_dyndns.php");
+ exit;
+}
+
+$pgtitle = array("Services", "RFC 2136 clients");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="services_rfc2136.php" method="post" name="iform" id="iform">
+<?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[] = array("DynDns", false, "services_dyndns.php");
+ $tab_array[] = array("RFC 2136", true, "services_rfc2136.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="5%" class="listhdrr"></td>
+ <td width="25%" class="listhdrr">Hostname</td>
+ <td width="60%" class="listhdr">Description</td>
+ <td width="10%" class="list"></td>
+ </tr>
+ <?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?>
+ <tr>
+ <td class="listlr">
+ <?php $iflist = get_configured_interface_with_descr();
+ foreach ($iflist as $if => $ifdesc):
+ if ($rfc2136['interface'] == $if): ?>
+ <?=$ifdesc; break;?>
+ <?php endif; endforeach; ?>
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($rfc2136['host']);?>
+ </td>
+ <td class="listbg">
+ <font color="white">
+ <?=htmlspecialchars($rfc2136['descr']);?>&nbsp;
+ </font>
+ </td>
+ <td valign="middle" nowrap class="list"> <a href="services_rfc2136_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
+ &nbsp;<a href="services_rfc2136.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this client?')"><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="services_rfc2136_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
+ Note:<br>
+ </strong></span>
+ Add something meaningful here.
+ </td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/status_interfaces.php b/usr/local/www/status_interfaces.php
index c813347..fde298e 100755
--- a/usr/local/www/status_interfaces.php
+++ b/usr/local/www/status_interfaces.php
@@ -43,16 +43,16 @@ if ($_POST) {
if ($ifcfg['ipaddr'] == "dhcp")
interfaces_dhcp_down($interface);
else if ($ifcfg['ipaddr'] == "pppoe")
- interfaces_wan_pppoe_down(); // FIXME: when we support multi-pppoe
+ interfaces_wan_pppoe_down($interface);
else if ($ifcfg['ipaddr'] == "pptp")
- interfaces_wan_pptp_down(); // FIXME: when we support multi-pptp
+ interfaces_wan_pptp_down($interface);
} else if ($_POST['submit'] == "Connect" || $_POST['submit'] == "Renew") {
if ($ifcfg['ipaddr'] == "dhcp")
interfaces_dhcp_up($interface);
else if ($ifcfg['ipaddr'] == "pppoe")
- interfaces_wan_pppoe_up(); // FIXME: when we support multi-pppoe
+ interfaces_wan_pppoe_up($interface);
else if ($ifcfg['ipaddr'] == "pptp")
- interfaces_wan_pptp_up(); // FIXME: when we support multi-pptp
+ interfaces_wan_pptp_up($interface);
} else {
header("Location: index.php");
exit;
@@ -82,7 +82,7 @@ include("head.inc");
<td colspan="2" class="listtopic">
<?=htmlspecialchars($ifname);?>
interface
- (<?=convert_friendly_interface_to_real_interface_name($ifname);?>)
+ (<?=($ifinfo['hwif']);?>)
</td>
</tr>
<tr>
@@ -217,7 +217,7 @@ include("head.inc");
$real_interface = "";
$interrupt_total = "";
$interrupt_sec = "";
- $real_interface = convert_friendly_interface_to_real_interface_name($ifname);
+ $real_interface = $ifinfo['hwif'];
$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $3 }'`;
$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
if(strstr($interrupt_total, "hci")) {
OpenPOWER on IntegriCloud