|
From: <abe...@us...> - 2012-07-06 19:11:37
|
Revision: 5594
http://astlinux.svn.sourceforge.net/astlinux/?rev=5594&view=rev
Author: abelbeck
Date: 2012-07-06 19:11:31 +0000 (Fri, 06 Jul 2012)
Log Message:
-----------
miniupnpd, tightly couple in the AIF miniupnpd.plugin, starting and stopping the miniupnpd service will now also handle the iptables MINIUPNPD chains using the AIF miniupnpd.plugin code
Modified Paths:
--------------
branches/1.0/package/arnofw/miniupnpd/50miniupnpd.plugin.sh
branches/1.0/package/miniupnpd/miniupnpd.init
Modified: branches/1.0/package/arnofw/miniupnpd/50miniupnpd.plugin.sh
===================================================================
--- branches/1.0/package/arnofw/miniupnpd/50miniupnpd.plugin.sh 2012-07-06 13:39:37 UTC (rev 5593)
+++ branches/1.0/package/arnofw/miniupnpd/50miniupnpd.plugin.sh 2012-07-06 19:11:31 UTC (rev 5594)
@@ -33,6 +33,12 @@
# Plugin start function
plugin_start()
{
+ # Check to see if started outside of AIF
+ if ip4tables -n -L MINIUPNPD >/dev/null 2>&1; then
+ echo "${INDENT}Note: MINIUPNPD chains already created"
+ return 0
+ fi
+
ip4tables -t nat -N MINIUPNPD 2>/dev/null
ip4tables -t nat -F MINIUPNPD
@@ -51,6 +57,12 @@
{
local eif IFS
+ # Check to see if stopped outside of AIF
+ if ! ip4tables -n -L MINIUPNPD >/dev/null 2>&1; then
+ echo "${INDENT}Note: MINIUPNPD chains do not exist"
+ return 0
+ fi
+
# Skip plugin_stop on a restart
# Reconnect both MINIUPNPD chains, flushed on a restart
@@ -70,6 +82,12 @@
{
local eif IFS
+ # Check to see if stopped outside of AIF
+ if ! ip4tables -n -L MINIUPNPD >/dev/null 2>&1; then
+ echo "${INDENT}Note: MINIUPNPD chains already removed"
+ return 0
+ fi
+
IFS=' ,'
for eif in $EXT_IF; do
ip4tables -t nat -D POST_NAT_PREROUTING_CHAIN -i $eif -j MINIUPNPD
Modified: branches/1.0/package/miniupnpd/miniupnpd.init
===================================================================
--- branches/1.0/package/miniupnpd/miniupnpd.init 2012-07-06 13:39:37 UTC (rev 5593)
+++ branches/1.0/package/miniupnpd/miniupnpd.init 2012-07-06 19:11:31 UTC (rev 5594)
@@ -18,6 +18,49 @@
MINIUPNPD_CONF=/tmp/etc/miniupnpd.conf
MINIUPNPD_LEASEFILE=/var/db/upnp.leases
+aif_miniupnpd_plugin()
+{
+ local action="$1"
+
+ if [ "$FWVERS" != "arno" ]; then
+ return
+ fi
+
+ (
+ plugin_file="/usr/share/arno-iptables-firewall/plugins/50miniupnpd.plugin"
+ if [ -f "$plugin_file" ]; then
+ tmp_source="$(mktemp "/var/tmp/aif_miniupnpd.XXXXXX")"
+ sed -n '1,/^# Mainline #/ p' "$plugin_file" > "$tmp_source"
+ echo '
+ip4tables()
+{
+ /usr/sbin/iptables "$@"
+}
+' >> "$tmp_source"
+
+ # Source only plugin functions from AIF Plugin
+ . "$tmp_source"
+
+ # Setup needed AIF variables
+ EXT_IF=""
+ for intf in $EXTIF $EXT2IF; do
+ EXT_IF="$EXT_IF${EXT_IF:+ }$intf"
+ done
+
+ case $action in
+ start)
+ plugin_start
+ ;;
+ stop)
+ plugin_stop
+ ;;
+ esac
+
+ rm "$tmp_source"
+ fi
+ )
+}
+
is_upnp_enabled()
{
# args: IF_Name
@@ -110,6 +153,7 @@
start () {
if [ -f $MINIUPNPD_CONF ]; then
echo "Starting miniupnpd..."
+ aif_miniupnpd_plugin start >/dev/null 2>&1
touch $MINIUPNPD_LEASEFILE
$MINIUPNPD -f $MINIUPNPD_CONF
fi
@@ -120,6 +164,7 @@
echo "Stopping miniupnpd..."
kill $(cat /var/run/miniupnpd.pid) >/dev/null 2>&1
# /var/run/miniupnpd.pid automatically removed by killed process
+ aif_miniupnpd_plugin stop >/dev/null 2>&1
fi
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|