summaryrefslogtreecommitdiff
path: root/package/igd2-for-linux/S99upnpd
diff options
context:
space:
mode:
authorFabrice Fontaine <fontaine.fabrice@gmail.com>2016-07-21 14:05:57 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-07-24 15:13:51 +0200
commit58230882982926afd6b1000b056caf4c231fe828 (patch)
treef89695f4e7723acb13eeb54b2e36299252e15afa /package/igd2-for-linux/S99upnpd
parentbcc6b36169fe0ed1c9c6c8d797f529f5cc13a311 (diff)
igd2-for-linux: new package
This is The Linux UPnP Internet Gateway Device 2. It is modified from the original Linux UPnP Internet Gateway Device [http://linux-igd.sourceforge.net/] according to UPnP InternetGatewayDevice:2 specifications. It implements the UPnP Internet Gateway Device version 2 specification (IGDv2) and allows UPnP aware clients, such as MSN Messenger, Azureus or Miranda to work properly from behind a NAT firewall. Please edit /etc/upnpd.conf before using upnpd! https://github.com/ffontaine/igd2-for-linux Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/igd2-for-linux/S99upnpd')
-rw-r--r--package/igd2-for-linux/S99upnpd67
1 files changed, 67 insertions, 0 deletions
diff --git a/package/igd2-for-linux/S99upnpd b/package/igd2-for-linux/S99upnpd
new file mode 100644
index 000000000..c023fa474
--- /dev/null
+++ b/package/igd2-for-linux/S99upnpd
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+NAME=upnpd
+PIDFILE=/var/run/$NAME.pid
+DAEMON=/usr/sbin/$NAME
+CFGFILE=/etc/default/$NAME
+
+LAN=eth0
+WAN=eth0
+
+# For the UPnP library to function correctly, networking must be configured
+# properly for multicasting as described in
+# https://sourceforge.net/p/pupnp/code/ci/master/tree/README.
+# Without this addition, device advertisements and control point searches will
+# not function.
+# However, the route has to be configured once for all UPnP applications
+# (igd2-for-linux, ushare, ...) so do not manage UPnP route by default
+MANAGE_UPNP_MULTICAST_ROUTE_ON_LAN=0
+
+# Read configuration variable file if it is present
+if [ -f $CFGFILE ]; then
+ . $CFGFILE
+fi
+
+DAEMON_ARGS="-f $WAN $LAN"
+
+start() {
+ if [ $MANAGE_UPNP_MULTICAST_ROUTE_ON_LAN != 0 ]; then
+ printf "Add UPnP multicast route on $LAN\n"
+ route add -net 239.0.0.0 netmask 255.0.0.0 $LAN
+ fi
+ printf "Starting $NAME: "
+ start-stop-daemon -S -q -m -b -p $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+stop() {
+ printf "Stopping $NAME: "
+ start-stop-daemon -K -q -p $PIDFILE
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+ if [ $MANAGE_UPNP_MULTICAST_ROUTE_ON_LAN != 0 ]; then
+ printf "Remove UPnP multicast route on $LAN\n"
+ route del -net 239.0.0.0 netmask 255.0.0.0 $LAN
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload)
+ restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
+esac
+
+exit $?