mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-13 20:42:58 +02:00
miniupnpd: Add configuration and scripts.
This commit is contained in:
@@ -250,7 +250,8 @@ case "$1" in
|
||||
# upnp chain for our upnp daemon
|
||||
/sbin/iptables -t nat -N UPNPFW
|
||||
/sbin/iptables -t nat -A PREROUTING -j UPNPFW
|
||||
|
||||
# This chain only contains dummy rules.
|
||||
/sbin/iptables -N UPNPFW
|
||||
|
||||
# Custom mangle chain (for port fowarding)
|
||||
/sbin/iptables -t mangle -N PORTFWMANGLE
|
||||
|
||||
69
src/initscripts/init.d/miniupnpd
Normal file
69
src/initscripts/init.d/miniupnpd
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/miniupnpd
|
||||
#
|
||||
# Description : Miniupnp daemon
|
||||
#
|
||||
# Authors : Michael Tremer <michael.tremer@ipfire.org>
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
if [ ! -e /etc/miniupnpd/id ]; then
|
||||
uuidgen > /etc/miniupnpd/id
|
||||
fi
|
||||
|
||||
UUID=$(cat /etc/miniupnpd/id)
|
||||
|
||||
EXT_DEV=$(cat /var/ipfire/red/iface)
|
||||
EXT_IP4=$(cat /var/ipfire/red/local-ipaddress)
|
||||
|
||||
. /var/ipfire/ethernet/settings
|
||||
|
||||
for i in GREEN_ADDRESS BLUE_ADDRESS; do
|
||||
[ -n "${!i}" ] && LISTEN_IP="${LISTEN_IP} -a ${!i}"
|
||||
done
|
||||
|
||||
function flush_iptables() {
|
||||
# Flush iptables to remove all entries that were left
|
||||
iptables -F UPNPFW
|
||||
iptables -t nat -F UPNPFW
|
||||
}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
boot_mesg "Starting miniupnpd..."
|
||||
|
||||
flush_iptables
|
||||
|
||||
loadproc miniupnpd -f /etc/miniupnpd/miniupnpd.conf \
|
||||
-i ${EXT_DEV} -o ${EXT_IP4} ${LISTEN_IP} \
|
||||
-u ${UUID}
|
||||
;;
|
||||
|
||||
stop)
|
||||
boot_mesg "Stopping miniupnpd..."
|
||||
killproc miniupnpd
|
||||
|
||||
flush_iptables
|
||||
;;
|
||||
|
||||
restart)
|
||||
${0} stop
|
||||
sleep 1
|
||||
${0} start
|
||||
;;
|
||||
|
||||
status)
|
||||
statusproc miniupnpd
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/miniupnpd
|
||||
6
src/initscripts/init.d/networking/red.down/10-miniupnpd
Normal file
6
src/initscripts/init.d/networking/red.down/10-miniupnpd
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
[ -x /etc/init.d/miniupnpd ] && \
|
||||
/etc/init.d/miniupnpd stop &>/dev/null
|
||||
|
||||
exit 0
|
||||
6
src/initscripts/init.d/networking/red.up/10-miniupnpd
Normal file
6
src/initscripts/init.d/networking/red.up/10-miniupnpd
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
[ -x /etc/init.d/miniupnpd ] && \
|
||||
/etc/init.d/miniupnpd start &>/dev/null
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user