fw3: permit default timeout of 0
[openwrt/staging/ldir.git] / package / network / config / firewall / patches / 0002-ipsets-permit-default-timeout-of-0.patch
1 From 9c221f305f107f3d50a661b8da2f32f3140d1224 Mon Sep 17 00:00:00 2001
2 From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
3 Date: Sat, 14 Aug 2021 06:54:13 +0100
4 Subject: [PATCH 2/2] ipsets: permit default timeout of 0
5
6 Allow ipsets to be created with timeout facility but with a default
7 timeout of 0. This permits timed entries to be added if required even
8 though the default is 0 (indefinite)
9
10 Previously a default timeout value of 0 would create a set without
11 timeout support.
12
13 Fixes: FS#3977
14
15 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
16 ---
17 ipsets.c | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20 diff --git a/ipsets.c b/ipsets.c
21 index ba31e64..e7cde16 100644
22 --- a/ipsets.c
23 +++ b/ipsets.c
24 @@ -266,6 +266,7 @@ fw3_alloc_ipset(struct fw3_state *state)
25 ipset->enabled = true;
26 ipset->family = FW3_FAMILY_V4;
27 ipset->reload_set = false;
28 + ipset->timeout = -1; /* no timeout by default */
29
30 list_add_tail(&ipset->list, &state->ipsets);
31
32 @@ -395,7 +396,7 @@ create_ipset(struct fw3_ipset *ipset, struct fw3_state *state)
33 ipset->portrange.port_min, ipset->portrange.port_max);
34 }
35
36 - if (ipset->timeout > 0)
37 + if (ipset->timeout >= 0)
38 fw3_pr(" timeout %u", ipset->timeout);
39
40 if (ipset->maxelem > 0)
41 --
42 2.30.1 (Apple Git-130)
43