How to update a firewall redirect rule in OpenWrt programmatically using UCI knowing only the name
My program has previously made a redirect rule..
uci add firewall redirect
uci set firewall.@redirect[-1].dest="lan"
uci set firewall.@redirect[-1].target="DNAT"
uci set firewall.@redirect[-1].name="transmission"
uci set firewall.@redirect[-1].src="https://serverfault.com/questions/1167277/wan"
uci set firewall.@redirect[-1].src_dport=""$port""
uci set firewall.@redirect[-1].dest_ip='192.168.1.5'
uci set firewall.@redirect[-1].dest_port=""$port""
uci commit firewall
service firewall restart
I need to programmatically update this rule periodically but I don’t understand where the handle is. I can’t be sure this will be the last [-1] rule added. Surely, there is a way for me to create a handle when creating the rule? The only info that will be consistent is the name I’ve given the rule but it doesn’t seem like a handle.
Read more here: Source link
