PKG_NAME:=igmpproxy
PKG_VERSION:=0.1
-PKG_RELEASE:=7
+PKG_RELEASE:=8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/igmpproxy
endef
define Package/igmpproxy/conffiles
-/etc/igmpproxy.conf
+/etc/config/igmpproxy
endef
TARGET_CFLAGS += -Dlog=igmpproxy_log
endef
define Package/igmpproxy/install
- $(INSTALL_DIR) $(1)/etc
- $(INSTALL_CONF) ./files/igmpproxy.conf $(1)/etc/
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_CONF) ./files/igmpproxy.config $(1)/etc/config/igmpproxy
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/igmpproxy.init $(1)/etc/init.d/igmpproxy
$(INSTALL_DIR) $(1)/usr/sbin
+++ /dev/null
-########################################################
-#
-# Example configuration file for the IgmpProxy
-# --------------------------------------------
-#
-# The configuration file must define one upstream
-# interface, and one or more downstream interfaces.
-#
-# If multicast traffic originates outside the
-# upstream subnet, the "altnet" option can be
-# used in order to define legal multicast sources.
-# (Se example...)
-#
-# The "quickleave" should be used to avoid saturation
-# of the upstream link. The option should only
-# be used if it's absolutely nessecary to
-# accurately imitate just one Client.
-#
-########################################################
-
-##------------------------------------------------------
-## Enable Quickleave mode (Sends Leave instantly)
-##------------------------------------------------------
-quickleave
-
-
-##------------------------------------------------------
-## Configuration for eth0 (Upstream Interface)
-##------------------------------------------------------
-phyint br-wan upstream ratelimit 0 threshold 1
- altnet 192.168.1.0/24
-
-
-##------------------------------------------------------
-## Configuration for eth1 (Downstream Interface)
-##------------------------------------------------------
-phyint br-lan downstream ratelimit 0 threshold 1
-
-
-##------------------------------------------------------
-## Configuration for eth2 (Disabled Interface)
-##------------------------------------------------------
-phyint eth2 disabled
--- /dev/null
+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
#!/bin/sh /etc/rc.common
-# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010-2012 OpenWrt.org
START=99
STOP=10
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
}