igmpproxy: fix creation of firewall rules
[openwrt/openwrt.git] / package / network / services / igmpproxy / files / igmpproxy.init
index 403854546fab0c6b562cf94518b20d1a64f251f2..009bb5d429c676881519e2c851340239fee55329 100644 (file)
@@ -62,15 +62,15 @@ igmp_add_network() {
 }
 
 igmp_add_firewall_routing() {
-       config_get network $1 network
        config_get direction $1 direction
+       config_get zone $1 zone
 
-       [[ "$direction" = "downstream" ]] || return 0
+       [[ "$direction" = "downstream" && ! -z "$zone" ]] || return 0
 
        json_add_object ""
        json_add_string type rule
        json_add_string src "$upstream"
-       json_add_string dest "$network"
+       json_add_string dest "$zone"
        json_add_string family ipv4
        json_add_string proto udp
        json_add_string dest_ip "224.0.0.0/4"
@@ -79,18 +79,21 @@ igmp_add_firewall_routing() {
 }
 
 igmp_add_firewall_network() {
-       config_get network $1 network
        config_get direction $1 direction
+       config_get zone $1 zone
+
+       [ ! -z "$zone" ] || return
 
        json_add_object ""
        json_add_string type rule
-       json_add_string src "$network"
+       json_add_string src "$zone"
+       json_add_string family ipv4
        json_add_string proto igmp
        json_add_string target ACCEPT
        json_close_object
 
        [[ "$direction" = "upstream" ]] && {
-               upstream="$network"
+               upstream="$zone"
                config_foreach igmp_add_firewall_routing phyint
        }
 }