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

Yousong Zhou yszhou4tech at gmail.com
Tue May 12 09:08:14 EDT 2020


On Sat, 2 May 2020 at 03:21, Philip Prindeville
<philipp at redfish-solutions.com> wrote:
>
> 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.

It seems that start_time >= stop_time has its defined meaning in
xt_time module.  Better add another uci option for this --contiguous
flag.

Regards,
                yousong

>
> 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

_______________________________________________
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