netfilter: use NF_DROP instead of -NF_DROP
Subsystems (2)
PATCH v2 1/1 netfilter: use NF_DROP instead of -NF_DROP
From: Jason Xing <[email protected]>
At the beginning in 2009 one patch [1] introduced collecting drop counter in nf_conntrack_in() by returning -NF_DROP. Later, another patch [2] changed the return value of tcp_packet() which now is renamed to nf_conntrack_tcp_packet() from -NF_DROP to NF_DROP. As we can see, that -NF_DROP should be corrected.
Similarly, there are other two points where the -NF_DROP is used.
Well, as NF_DROP is equal to 0, inverting NF_DROP makes no sense as patch [2] said many years ago.
[1]
commit 7d1e04598e5e ("netfilter: nf_conntrack: account packets drop by tcp_packet()")
[2]
commit ec8d540969da ("netfilter: conntrack: fix dropping packet after l4proto->packet()")
---
v2
1. squash three patches into one
--- net/ipv4/netfilter/iptable_filter.c | 2 +- net/ipv6/netfilter/ip6table_filter.c | 2 +- net/netfilter/nf_conntrack_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
net/ipv4/netfilter/iptable_filter.c +1 -1
@@ -44,7 +44,7 @@ static int iptable_filter_table_init(struct net *net)return -ENOMEM ;/* Entry 1 is the FORWARD hook */ ((struct ipt_standard *)repl->entries)[1 ].target.verdict = - forward ? -NF_ACCEPT -1 : -NF_DROP -1 ; + forward ? -NF_ACCEPT -1 :NF_DROP -1 ; err =ipt_register_table (net, &packet_filter, repl, filter_ops);kfree (repl);
net/ipv6/netfilter/ip6table_filter.c +1 -1
@@ -43,7 +43,7 @@ static int ip6table_filter_table_init(struct net *net)return -ENOMEM ;/* Entry 1 is the FORWARD hook */ ((struct ip6t_standard *)repl->entries)[1 ].target.verdict = - forward ? -NF_ACCEPT -1 : -NF_DROP -1 ; + forward ? -NF_ACCEPT -1 :NF_DROP -1 ; err =ip6t_register_table (net, &packet_filter, repl, filter_ops);kfree (repl);
net/netfilter/nf_conntrack_core.c +1 -1
@@ -2024,7 +2024,7 @@ nf_conntrack_in(struct sk_buff *skb, const struct nf_hook_state *state) goto repeat;NF_CT_STAT_INC_ATOMIC (state->net, invalid); -if (ret == -NF_DROP ) +if (ret ==NF_DROP )NF_CT_STAT_INC_ATOMIC (state->net, drop); ret = -ret;
Signature · 1 line
2.37.3
Quoted 14 lines · Jason Xing
From: Jason Xing <[email protected]>
At the beginning in 2009 one patch [1] introduced collecting drop counter in
nf_conntrack_in()by returning -NF_DROP. Later, another patch [2] changed the return value oftcp_packet()which now is renamed tonf_conntrack_tcp_packet()from -NF_DROP toNF_DROP. As we can see, that -NF_DROP should be corrected.Similarly, there are other two points where the -NF_DROP is used.
Well, as
NF_DROPis equal to 0, invertingNF_DROPmakes no sense as patch [2] said many years ago.
Quoted 6 lines
[1]
commit7d1e04598e5e("netfilter:nf_conntrack: account packets drop bytcp_packet()")
[2]
commitec8d540969da("netfilter: conntrack: fix dropping packet afterl4proto->packet()")Signed-off-by Jason Xing <[email protected]>
Hello Pablo,
I don't know how it works in the nf area, so I would like to know the status of this patch and another one (netfilter: conntrack: dccp: try not to drop skb in conntrack
)? Is there anything I need to change?
Thanks,
Jason
Quoted 52 lines
---
v21. squash three patches into one
--- net/ipv4/netfilter/iptable_filter.c | 2 +- net/ipv6/netfilter/ip6table_filter.c | 2 +- net/netfilter/nf_conntrack_core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)net/ipv4/netfilter/iptable_filter.c +1
-1@@ -44,7 +44,7 @@ static int iptable_filter_table_init(struct net *net)return -ENOMEM ;/* Entry 1 is the FORWARD hook */ ((struct ipt_standard *)repl->entries)[1 ].target.verdict = - forward ? -NF_ACCEPT -1 : -NF_DROP -1 ; + forward ? -NF_ACCEPT -1 :NF_DROP -1 ; err =ipt_register_table (net, &packet_filter, repl, filter_ops);kfree (repl);net/ipv6/netfilter/ip6table_filter.c +1
-1@@ -43,7 +43,7 @@ static int ip6table_filter_table_init(struct net *net)return -ENOMEM ;/* Entry 1 is the FORWARD hook */ ((struct ip6t_standard *)repl->entries)[1 ].target.verdict = - forward ? -NF_ACCEPT -1 : -NF_DROP -1 ; + forward ? -NF_ACCEPT -1 :NF_DROP -1 ; err =ip6t_register_table (net, &packet_filter, repl, filter_ops);kfree (repl);net/netfilter/nf_conntrack_core.c +1
-2@@ -2024,7 +2024,7 @@ nf_conntrack_in(struct sk_buff *skb, const struct nf_hook_state *state) goto repeat;NF_CT_STAT_INC_ATOMIC (state->net, invalid); -if (ret == -NF_DROP ) +if (ret ==NF_DROP )NF_CT_STAT_INC_ATOMIC (state->net, drop); ret = -ret; --2.37.3
Pablo Neira Ayuso
maintainerHi Jason,
Quoted 20 lines · Jason Xing
Quoted 19 lines · Jason Xing
From: Jason Xing <[email protected]>
At the beginning in 2009 one patch [1] introduced collecting drop counter in
nf_conntrack_in()by returning -NF_DROP. Later, another patch [2] changed the return value oftcp_packet()which now is renamed tonf_conntrack_tcp_packet()from -NF_DROP toNF_DROP. As we can see, that -NF_DROP should be corrected.Similarly, there are other two points where the -NF_DROP is used.
Well, as
NF_DROPis equal to 0, invertingNF_DROPmakes no sense as patch [2] said many years ago.[1]
commit7d1e04598e5e("netfilter:nf_conntrack: account packets drop bytcp_packet()")
[2]
commitec8d540969da("netfilter: conntrack: fix dropping packet afterl4proto->packet()")
Quoted 8 lines
Quoted 1 line
Signed-off-by Jason Xing <[email protected]>Hello Pablo,
I don't know how it works in the nf area, so I would like to know the status of this patch and another one (netfilter: conntrack: dccp: try not to drop skb in conntrack
)? Is there anything I need to change?
No action on your side, I will start collecting pending material for nf-next next week.
Thanks for your patience.