Signed-off-by: Viktar Palstsiuk <[email protected]>
---
net/igmpproxy/Makefile | 8 +++---
net/igmpproxy/files/igmpproxy.conf | 43 ----------------------------------
net/igmpproxy/files/igmpproxy.config | 11 ++++++++
net/igmpproxy/files/igmpproxy.init | 34 ++++++++++++++++++++++++++-
4 files changed, 48 insertions(+), 48 deletions(-)
delete mode 100644 net/igmpproxy/files/igmpproxy.conf
create mode 100644 net/igmpproxy/files/igmpproxy.config
mode change 100644 => 100755 net/igmpproxy/files/igmpproxy.init
diff --git a/net/igmpproxy/Makefile b/net/igmpproxy/Makefile
index 43e13bb..ae0ac67 100644
--- a/net/igmpproxy/Makefile
+++ b/net/igmpproxy/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=igmpproxy
PKG_VERSION:=0.1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/igmpproxy
@@ -31,7 +31,7 @@ define Package/igmpproxy/description
endef
define Package/igmpproxy/conffiles
-/etc/igmpproxy.conf
+/etc/config/igmpproxy
endef
TARGET_CFLAGS += -Dlog=igmpproxy_log
@@ -43,8 +43,8 @@ define Build/Compile
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
diff --git a/net/igmpproxy/files/igmpproxy.conf
b/net/igmpproxy/files/igmpproxy.conf
deleted file mode 100644
index e01b918..0000000
--- a/net/igmpproxy/files/igmpproxy.conf
+++ /dev/null
@@ -1,43 +0,0 @@
-########################################################
-#
-# 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
diff --git a/net/igmpproxy/files/igmpproxy.config
b/net/igmpproxy/files/igmpproxy.config
new file mode 100644
index 0000000..ca625ac
--- /dev/null
+++ b/net/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/net/igmpproxy/files/igmpproxy.init
b/net/igmpproxy/files/igmpproxy.init
old mode 100644
new mode 100755
index 80e1bad..5b8d3c4
--- a/net/igmpproxy/files/igmpproxy.init
+++ b/net/igmpproxy/files/igmpproxy.init
@@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
-# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010-2012 OpenWrt.org
START=99
STOP=10
@@ -22,7 +22,39 @@ SERVICE_WRITE_PID=1
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
}
--
1.7.9.1
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel