diff options
author | Florian Westphal | 2019-02-21 15:38:29 +0100 |
---|---|---|
committer | Pablo Neira Ayuso | 2019-02-27 10:58:21 +0100 |
commit | cc16921351d8ba1eabc1923fd61d4f369fadde56 (patch) | |
tree | 52300f577d4c1f1d32929015915604e5af734e08 /net | |
parent | netfilter: nat: remove nf_nat_l3proto.h and nf_nat_core.h (diff) | |
download | kernel-qcow2-linux-cc16921351d8ba1eabc1923fd61d4f369fadde56.tar.gz kernel-qcow2-linux-cc16921351d8ba1eabc1923fd61d4f369fadde56.tar.xz kernel-qcow2-linux-cc16921351d8ba1eabc1923fd61d4f369fadde56.zip |
netfilter: conntrack: avoid same-timeout update
No need to dirty a cache line if timeout is unchanged.
Also, WARN() is useless here: we crash on 'skb->len' access
if skb is NULL.
Last, ct->timeout is u32, not 'unsigned long' so adapt the
function prototype accordingly.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 4a9107e4a69c..ff9313c579b4 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -1751,11 +1751,9 @@ EXPORT_SYMBOL_GPL(nf_conntrack_alter_reply); void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo, const struct sk_buff *skb, - unsigned long extra_jiffies, - int do_acct) + u32 extra_jiffies, + bool do_acct) { - WARN_ON(!skb); - /* Only update if this is not a fixed timeout */ if (test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) goto acct; @@ -1764,7 +1762,8 @@ void __nf_ct_refresh_acct(struct nf_conn *ct, if (nf_ct_is_confirmed(ct)) extra_jiffies += nfct_time_stamp; - ct->timeout = extra_jiffies; + if (ct->timeout != extra_jiffies) + ct->timeout = extra_jiffies; acct: if (do_acct) nf_ct_acct_update(ct, ctinfo, skb->len); |