- local active
- config_get active "$state" ifname
-
- [ -z "$active" ] && {
- local ipaddr
- config_get ipaddr "$extif" ipaddr
-
- logger -t "upnp" "adding $INTERFACE ($DEVICE - $ipaddr) to firewall"
-
- iptables -t nat -N MINIUPNPD 2>/dev/null
- iptables -t nat -A prerouting_rule -i $DEVICE -d $ipaddr -j MINIUPNPD
- iptables -t filter -N MINIUPNPD 2>/dev/null
- iptables -t filter -A forwarding_rule -i $DEVICE ! -o $DEVICE -j MINIUPNPD
-
- uci_set_state upnpd "$state" "" "firewall"
- uci_set_state upnpd "$state" ifname "$DEVICE"
- uci_set_state upnpd "$state" ipaddr "$ipaddr"
- }
-
- elif [ "$ACTION" = "remove" ] && [ "$INTERFACE" = "$extif" ]; then
-
- local ifname ipaddr
- config_get ifname "$state" ifname
- config_get ipaddr "$state" ipaddr
-
- [ -n "$ifname" ] && [ -n "$ipaddr" ] && {
- logger -t "upnp" "removing $INTERFACE ($ifname - $ipaddr) from firewall"
- iptables -t nat -D prerouting_rule -i $ifname -d $ipaddr -j MINIUPNPD
- iptables -t filter -D forwarding_rule -i $DEVICE ! -o $DEVICE -j MINIUPNPD
- uci_revert_state upnpd "$state"
- }
- fi
+ uci_set_state upnpd state "" state
+ uci_set_state upnpd state zone "$zone"
+ uci_set_state upnpd state ifname "$iface"
+ uci_set_state upnpd state network "$network"