From d98e49d6090a7f2952bbea40844504f13b5e57b0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 8 May 2014 13:14:34 +0000 Subject: igmpproxy: move to trunk, add myself as maintainer git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40730 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../services/igmpproxy/files/igmpproxy.config | 11 ++++ .../services/igmpproxy/files/igmpproxy.init | 63 ++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 package/network/services/igmpproxy/files/igmpproxy.config create mode 100644 package/network/services/igmpproxy/files/igmpproxy.init (limited to 'package/network/services/igmpproxy/files') diff --git a/package/network/services/igmpproxy/files/igmpproxy.config b/package/network/services/igmpproxy/files/igmpproxy.config new file mode 100644 index 0000000000..ca625ac94e --- /dev/null +++ b/package/network/services/igmpproxy/files/igmpproxy.config @@ -0,0 +1,11 @@ +config igmpproxy + option quickleave 1 + +config phyint + option network wan + option direction upstream + list altnet 192.168.1.0/24 + +config phyint + option network lan + option direction downstream diff --git a/package/network/services/igmpproxy/files/igmpproxy.init b/package/network/services/igmpproxy/files/igmpproxy.init new file mode 100644 index 0000000000..a45978f5b6 --- /dev/null +++ b/package/network/services/igmpproxy/files/igmpproxy.init @@ -0,0 +1,63 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010-2012 OpenWrt.org + +START=99 +STOP=10 + +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 + +# igmpproxy supports both a debug mode and verbosity, which are very useful +# when something isn't working. +# +# Debug mode will print everything to stdout instead of syslog. Generally +# verbosity should NOT be set as it will quickly fill your syslog. +# +# Put any debug or verbosity options into IGMP_OPTS +# +# Examples: +# OPTIONS="-d -v -v" - debug mode and very verbose, this will land in +# stdout and not in syslog +# OPTIONS="-v" - be verbose, this will write aditional information to syslog + +OPTIONS="" + +igmp_header() { + local quickleave + config_get_bool quickleave "$1" quickleave 0 + + mkdir -p /var/etc + rm -f /var/etc/igmpproxy.conf + [ $quickleave -gt 0 ] && echo "quickleave" >> /var/etc/igmpproxy.conf + + [ -L /etc/igmpproxy.conf ] || ln -nsf /var/etc/igmpproxy.conf /etc/igmpproxy.conf +} + +igmp_add_phyint() { + local network direction altnets + + config_get network $1 network + config_get direction $1 direction + config_get altnets $1 altnet + + device=$(uci_get_state network "$network" ifname "$network") + echo -e "\nphyint $device $direction ratelimit 0 threshold 1" >> /var/etc/igmpproxy.conf + + if [ -n "$altnets" ]; then + local altnet + for altnet in $altnets; do + echo -e "\taltnet $altnet" >> /var/etc/igmpproxy.conf + done + fi +} + +start() { + config_load igmpproxy + config_foreach igmp_header igmpproxy + config_foreach igmp_add_phyint phyint + service_start /usr/sbin/igmpproxy $OPTIONS /etc/igmpproxy.conf +} + +stop() { + service_stop /usr/sbin/igmpproxy +} -- cgit v1.2.3