netfilter: use_nf_conn_expires helper in more places
authorFlorian Westphal <fw@strlen.de>
Wed, 3 Aug 2016 00:45:07 +0000 (02:45 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 11 Aug 2016 22:43:13 +0000 (00:43 +0200)
... so we don't need to touch all of these places when we get rid of the
timer in nf_conn.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_standalone.c
net/netfilter/xt_conntrack.c

index 63923710f325cba3e094ed8e384616b5fcf1e50c..67bfc69e00bc12cbd82275b25fc0771251ba943b 100644 (file)
@@ -163,8 +163,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
        ret = -ENOSPC;
        seq_printf(s, "%-8s %u %ld ",
                   l4proto->name, nf_ct_protonum(ct),
-                  timer_pending(&ct->timeout)
-                  ? (long)(ct->timeout.expires - jiffies)/HZ : 0);
+                  nf_ct_expires(ct) / HZ);
 
        if (l4proto->print_conntrack)
                l4proto->print_conntrack(s, ct);
index 050bb3420a6baf2e75f1b6eac080fe0b92b7e6f6..68800c10a320ac3e9105870c21341298c64e265a 100644 (file)
@@ -149,10 +149,7 @@ nla_put_failure:
 
 static int ctnetlink_dump_timeout(struct sk_buff *skb, const struct nf_conn *ct)
 {
-       long timeout = ((long)ct->timeout.expires - (long)jiffies) / HZ;
-
-       if (timeout < 0)
-               timeout = 0;
+       long timeout = nf_ct_expires(ct) / HZ;
 
        if (nla_put_be32(skb, CTA_TIMEOUT, htonl(timeout)))
                goto nla_put_failure;
index 958a1455ca7f2c1718e38730479876ffa6477779..4e7becde4357bc934bc5d8aa6aa8159f5e1bb6c6 100644 (file)
@@ -224,8 +224,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
        seq_printf(s, "%-8s %u %-8s %u %ld ",
                   l3proto->name, nf_ct_l3num(ct),
                   l4proto->name, nf_ct_protonum(ct),
-                  timer_pending(&ct->timeout)
-                  ? (long)(ct->timeout.expires - jiffies)/HZ : 0);
+                  nf_ct_expires(ct)  / HZ);
 
        if (l4proto->print_conntrack)
                l4proto->print_conntrack(s, ct);
index 188404b9b002f1a8ef875ceb3a7aebddb13c6c8e..a3b8f697cfc5a21fd92b048dc18396aa8de1a471 100644 (file)
@@ -233,10 +233,8 @@ conntrack_mt(const struct sk_buff *skb, struct xt_action_param *par,
                return false;
 
        if (info->match_flags & XT_CONNTRACK_EXPIRES) {
-               unsigned long expires = 0;
+               unsigned long expires = nf_ct_expires(ct) / HZ;
 
-               if (timer_pending(&ct->timeout))
-                       expires = (ct->timeout.expires - jiffies) / HZ;
                if ((expires >= info->expires_min &&
                    expires <= info->expires_max) ^
                    !(info->invert_flags & XT_CONNTRACK_EXPIRES))