* [PATCH nf-next 1/1] netfilter: cttimeout: Refine cttimeout_del_timeout
@ 2017-04-07 11:25 gfree.wind
2017-04-13 22:58 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: gfree.wind @ 2017-04-07 11:25 UTC (permalink / raw)
To: pablo, netfilter-devel; +Cc: Gao Feng
From: Gao Feng <fgao@ikuai8.com>
1. Return one error when try to delete all timeouts and meet one erorr;
2. Delete the condition block when fail to delete specified timeout.
It is more clear that it would stop the loop when find one matched timeout.
Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
net/netfilter/nfnetlink_cttimeout.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c
index baa75f3..220847a 100644
--- a/net/netfilter/nfnetlink_cttimeout.c
+++ b/net/netfilter/nfnetlink_cttimeout.c
@@ -361,11 +361,17 @@ static int cttimeout_del_timeout(struct net *net, struct sock *ctnl,
char *name;
if (!cda[CTA_TIMEOUT_NAME]) {
+ int cur_ret;
+
+ ret = 0;
list_for_each_entry_safe(cur, tmp, &net->nfct_timeout_list,
- head)
- ctnl_timeout_try_del(net, cur);
+ head) {
+ cur_ret = ctnl_timeout_try_del(net, cur);
+ if (cur_ret && !ret)
+ ret = cur_ret;
+ }
- return 0;
+ return ret;
}
name = nla_data(cda[CTA_TIMEOUT_NAME]);
@@ -374,9 +380,6 @@ static int cttimeout_del_timeout(struct net *net, struct sock *ctnl,
continue;
ret = ctnl_timeout_try_del(net, cur);
- if (ret < 0)
- return ret;
-
break;
}
return ret;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH nf-next 1/1] netfilter: cttimeout: Refine cttimeout_del_timeout
2017-04-07 11:25 [PATCH nf-next 1/1] netfilter: cttimeout: Refine cttimeout_del_timeout gfree.wind
@ 2017-04-13 22:58 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-04-13 22:58 UTC (permalink / raw)
To: gfree.wind; +Cc: netfilter-devel, Gao Feng
On Fri, Apr 07, 2017 at 07:25:36PM +0800, gfree.wind@foxmail.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> 1. Return one error when try to delete all timeouts and meet one erorr;
> 2. Delete the condition block when fail to delete specified timeout.
> It is more clear that it would stop the loop when find one matched timeout.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
> net/netfilter/nfnetlink_cttimeout.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c
> index baa75f3..220847a 100644
> --- a/net/netfilter/nfnetlink_cttimeout.c
> +++ b/net/netfilter/nfnetlink_cttimeout.c
> @@ -361,11 +361,17 @@ static int cttimeout_del_timeout(struct net *net, struct sock *ctnl,
> char *name;
>
> if (!cda[CTA_TIMEOUT_NAME]) {
> + int cur_ret;
> +
> + ret = 0;
> list_for_each_entry_safe(cur, tmp, &net->nfct_timeout_list,
> - head)
> - ctnl_timeout_try_del(net, cur);
This code ignores ctnl_timeout_try_del() on purpose, to implement the
flush operation.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-13 22:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-07 11:25 [PATCH nf-next 1/1] netfilter: cttimeout: Refine cttimeout_del_timeout gfree.wind
2017-04-13 22:58 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).