[OpenWrt-Devel] [PATCH 1/1] firewall3: add --contiguous to time-based rules where needed

Philip Prindeville philipp at redfish-solutions.com
Fri May 1 15:21:35 EDT 2020


From: Philip Prindeville <philipp at redfish-solutions.com>

If the start_time > stop_time on a rule, then the --contiguous arg
should be included in the rule.

Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 iptables.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/iptables.c b/iptables.c
index 559fe7defef3be85c4eb2934884caf549f932bc5..5c02e6e26c93468f4ef6a7f917069bb49985aad8 100644
--- a/iptables.c
+++ b/iptables.c
@@ -1099,6 +1099,9 @@ fw3_ipt_rule_time(struct fw3_ipt_rule *r, struct fw3_time *time)
 		fw3_ipt_rule_addarg(r, false, "--timestop", buf);
 	}
 
+	if (time->timestart && time->timestop && time->timestart > time->timestop)
+		fw3_ipt_rule_addarg(r, false, "--contiguous", NULL);
+
 	if (time->monthdays & 0xFFFFFFFE)
 	{
 		for (i = 1, p = buf; i < 32; i++)
-- 
2.17.2


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list