netfilter: conntrack: account packets drop by tcp_packet()
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/1 netfilter: conntrack: account packets drop by tcp_packet()
Since tcp_packet() may return -NF_DROP in two situations, the packet-drop stats must be increased.
---
net/netfilter/nf_conntrack_core.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/netfilter/nf_conntrack_core.c +2 -0
@@ -733,6 +733,8 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,nf_conntrack_put (skb->nfct); skb->nfct =NULL ;NF_CT_STAT_INC_ATOMIC (net, invalid); +if (-ret ==NF_DROP ) +NF_CT_STAT_INC_ATOMIC (net, drop);return -ret; }
net/netfilter/nf_conntrack_core.c nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum, · line 740
Quoted 13 lines · Pablo Neira Ayuso
net/netfilter/nf_conntrack_core.c +2
-0@@ -733,6 +733,8 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,nf_conntrack_put (skb->nfct); skb->nfct =NULL ;NF_CT_STAT_INC_ATOMIC (net, invalid); +if (-ret ==NF_DROP ) +NF_CT_STAT_INC_ATOMIC (net, drop);return -ret; }
*boggle* Why not just "ret == -NF_DROP"?
The assumption would be near that "-NF_DROP" is a constant just as "NF_DROP" would be, but "-ret" involves an extra instruction for negating ret.
Quoted 11 lines · Jan Engelhardt
Quoted 10 lines · Pablo Neira Ayuso
net/netfilter/nf_conntrack_core.c +2
-0@@ -733,6 +733,8 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,nf_conntrack_put (skb->nfct); skb->nfct =NULL ;NF_CT_STAT_INC_ATOMIC (net, invalid); +if (-ret ==NF_DROP ) +NF_CT_STAT_INC_ATOMIC (net, drop);
Quoted 8 lines
net/netfilter/nf_conntrack_core.c nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum, · line 740
Quoted 3 lines
net/netfilter/nf_conntrack_core.c +0
-0return -ret; }*boggle* Why not just "ret == -NF_DROP"?
The assumption would be near that "-NF_DROP" is a constant just as "NF_DROP" would be, but "-ret" involves an extra instruction for negating ret.
Indeed. No need to resend though, I'll fix it up.
Patrick McHardy
AppliedQuoted 2 lines · Pablo Neira Ayuso
Since
tcp_packet()may return -NF_DROP in two situations, the packet-drop stats must be increased.
Applied, thanks.