luci-app-firewall: disable port fields when protocol is not TCP or UDP
authorTom Hodder <tom@limepepper.co.uk>
Mon, 4 Jun 2018 16:11:12 +0000 (17:11 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 10 Jun 2018 14:24:07 +0000 (16:24 +0200)
commit658d11e7514401b74e062a75b78fe405c3e1d496
tree1e117528c400b1e12f5af5227aceb0a025283ebf
parent8a4c3a01bf5a9a9dfda17aea1eaab72a1c71e8a9
luci-app-firewall: disable port fields when protocol is not TCP or UDP

It's currently possible to generate nonsensical firewall rules by inputting
combinations which include:

i) protocols other than UDP/TCP
ii) source and destination ports.

There is some discussion of the issue on the forum here and the issue is
here; #1850.

This patch makes fields like src_port and dest_port depend on protocol being
tcp, udp or "tcp udp" in the input, forwarding and source NAT forms.

Signed-off-by: Tom Hodder <tom@limepepper.co.uk>
[reword commit message, squash commits]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-firewall/luasrc/model/cbi/firewall/forward-details.lua
applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua