aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-08-19 23:47:05 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-08-19 23:47:05 +0000
commit59c55a355129fa1bd426d4443c042f9cae942cbf (patch)
treeb692201dabf9e20478ea8b70567d793728b28758 /packages
parenta0865e6e3e13d009de513aa5994b44e370807d4d (diff)
downloadpfsense-packages-59c55a355129fa1bd426d4443c042f9cae942cbf.tar.gz
pfsense-packages-59c55a355129fa1bd426d4443c042f9cae942cbf.tar.bz2
pfsense-packages-59c55a355129fa1bd426d4443c042f9cae942cbf.zip
Add experimental upnp package
Diffstat (limited to 'packages')
-rw-r--r--packages/miniupnpd/miniupnpd.inc36
-rw-r--r--packages/miniupnpd/miniupnpd.xml70
-rw-r--r--packages/miniupnpd/status_upnp.php88
3 files changed, 194 insertions, 0 deletions
diff --git a/packages/miniupnpd/miniupnpd.inc b/packages/miniupnpd/miniupnpd.inc
new file mode 100644
index 00000000..11d556ff
--- /dev/null
+++ b/packages/miniupnpd/miniupnpd.inc
@@ -0,0 +1,36 @@
+<?php
+ /* Miniupnp */
+ function sync_package_miniupnpd() {
+ global $config;
+ global $input_errors;
+ conf_mount_rw();
+ config_lock();
+ $miniupnpd_config =&$_POST;
+ $if_final = "";
+ $ifaces_final = "";
+ $first = 0;
+ foreach($_POST['interface_array'] as $iface) {
+ $if = convert_friendly_interface_to_real_interface_name($iface);
+ if($if) {
+ //if($first == 1)
+ //$ifaces_final .= ",";
+ $addr = find_interface_ip($if);
+ $ifaces_final .= " -i {$if} -a {$addr}";
+ $first = 1;
+ } else {
+ log_error("Could not resolve real interfaec {$iface}");
+ }
+ }
+ $start = "/usr/local/sbin/miniupnpd -p 2869 {$ifaces_final}";
+ write_rcfile(array(
+ "file" => "miniupnpd.sh",
+ "start" => $start,
+ "stop" => "/usr/bin/killall miniupnpd"
+ )
+ );
+ start_service("miniupnpd");
+ restart_service("miniupnpd");
+ config_unlock();
+ conf_mount_ro();
+ }
+?> \ No newline at end of file
diff --git a/packages/miniupnpd/miniupnpd.xml b/packages/miniupnpd/miniupnpd.xml
new file mode 100644
index 00000000..d4c500fc
--- /dev/null
+++ b/packages/miniupnpd/miniupnpd.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<packagegui>
+ <title>Services: Miniupnpd</title>
+ <name>miniupnpd</name>
+ <version>0.9</version>
+ <savetext>Change</savetext>
+ <aftersaveredirect>pkg_edit.php?xml=miniupnpd.xml&amp;id=0</aftersaveredirect>
+ <menu>
+ <name>Miniupnpd</name>
+ <tooltiptext>Set miniupnpd settings such as interfaces to listen on.</tooltiptext>
+ <section>Diagnostics</section>
+ <url>/pkg_edit.php?xml=miniupnpd.xml&amp;id=0</url>
+ </menu>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/All/miniupnpd.inc</item>
+ <prefix>/usr/local/sbin/</prefix>
+ <chmod>0777</chmod>
+ </additional_files_needed>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/miniupnpd/miniupnpd.inc</item>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0777</chmod>
+ </additional_files_needed>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/miniupnpd/status_upnp.php</item>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0777</chmod>
+ </additional_files_needed>
+ <service>
+ <name>miniupnpd</name>
+ <rcfile>miniupnpd.sh</rcfile>
+ <executable>miniupnpd</executable>
+ </service>
+ <tabs>
+ <tab>
+ <text>UPNP Status</text>
+ <url>status_upnp.php</url>
+ </tab>
+ <tab>
+ <text>miniupnpd Settings</text>
+ <url>/pkg_edit.php?xml=miniupnpd.xml&amp;id=0</url>
+ <active/>
+ </tab>
+ </tabs>
+ <fields>
+ <field>
+ <fielddescr>Interface</fielddescr>
+ <fieldname>interface_array</fieldname>
+ <value>lan</value>
+ <multiple>true</multiple>
+ <size>3</size>
+ <type>interfaces_selection</type>
+ </field>
+ </fields>
+ <custom_php_global_functions>
+ sync_package_miniupnpd();
+ </custom_php_global_functions>
+ <custom_add_php_command>
+ sync_package_miniupnpd();
+ </custom_add_php_command>
+ <custom_php_resync_command>
+ sync_package_miniupnpd();
+ </custom_php_resync_command>
+ <custom_php_install_command>
+ sync_package_miniupnpd();
+ </custom_php_install_command>
+ <custom_php_deinstall_command>
+ exec("rm /usr/local/etc/rc.d/miniupnpd*");
+ </custom_php_deinstall_command>
+</packagegui> \ No newline at end of file
diff --git a/packages/miniupnpd/status_upnp.php b/packages/miniupnpd/status_upnp.php
new file mode 100644
index 00000000..dae86878
--- /dev/null
+++ b/packages/miniupnpd/status_upnp.php
@@ -0,0 +1,88 @@
+<?php
+/* $Id$ */
+/*
+ status_upnp.php
+ part of pfSense (http://www.pfsense.com/)
+
+ Copyright (C) 2006 Seth Mos <seth.mos@xs4all.nl>.
+ 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");
+
+$rdr_entries = array();
+exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
+
+$now = time();
+$year = date("Y");
+
+$pgtitle = array(gettext("Status"),gettext("UPnP Status"));
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+$pfSenseHead->addMeta("<meta http-equiv=\"refresh\" content=\"120;url={$_SERVER['SCRIPT_NAME']}\" />");
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="10%" class="listhdrr"><?=gettext("Port")?></td>
+ <td width="10%" class="listhdrr"><?=gettext("Protocol")?></td>
+ <td width="20%" class="listhdrr"><?=gettext("Internal IP")?></td>
+ <td width="60%" class="listhdr"><?=gettext("Description")?></td>
+ </tr>
+ <?php $i = 0; foreach ($rdr_entries as $rdr_entry) {
+ $rdr_label = split("\"", $rdr_entry);
+ $rdr_ip = split(" ", $rdr_label[2]);
+ $rdr_port = split(" ", $rdr_label[2]);
+ $rdr_proto = split(" ", $rdr_label[0]);
+ ?>
+ <tr>
+ <td class="listlr">
+ <?php print $rdr_port[4];?>
+ </td>
+ <td class="listlr">
+ <?php print $rdr_proto[5];?>
+ </td>
+ <td class="listlr">
+ <?php print $rdr_ip[2];?>
+ </td>
+ <td class="listlr">
+ <?php print $rdr_label[1];?>
+ </td>
+ </tr>
+ <?php $i++; }?>
+ </table>
+ </div>
+ </table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>