Skip to content

Commit d0b35b9

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: use_nf_conn_expires helper in more places
... 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 <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 9f7c824 commit d0b35b9

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
163163
ret = -ENOSPC;
164164
seq_printf(s, "%-8s %u %ld ",
165165
l4proto->name, nf_ct_protonum(ct),
166-
timer_pending(&ct->timeout)
167-
? (long)(ct->timeout.expires - jiffies)/HZ : 0);
166+
nf_ct_expires(ct) / HZ);
168167

169168
if (l4proto->print_conntrack)
170169
l4proto->print_conntrack(s, ct);

net/netfilter/nf_conntrack_netlink.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,7 @@ static int ctnetlink_dump_status(struct sk_buff *skb, const struct nf_conn *ct)
149149

150150
static int ctnetlink_dump_timeout(struct sk_buff *skb, const struct nf_conn *ct)
151151
{
152-
long timeout = ((long)ct->timeout.expires - (long)jiffies) / HZ;
153-
154-
if (timeout < 0)
155-
timeout = 0;
152+
long timeout = nf_ct_expires(ct) / HZ;
156153

157154
if (nla_put_be32(skb, CTA_TIMEOUT, htonl(timeout)))
158155
goto nla_put_failure;

net/netfilter/nf_conntrack_standalone.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
224224
seq_printf(s, "%-8s %u %-8s %u %ld ",
225225
l3proto->name, nf_ct_l3num(ct),
226226
l4proto->name, nf_ct_protonum(ct),
227-
timer_pending(&ct->timeout)
228-
? (long)(ct->timeout.expires - jiffies)/HZ : 0);
227+
nf_ct_expires(ct) / HZ);
229228

230229
if (l4proto->print_conntrack)
231230
l4proto->print_conntrack(s, ct);

net/netfilter/xt_conntrack.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,8 @@ conntrack_mt(const struct sk_buff *skb, struct xt_action_param *par,
233233
return false;
234234

235235
if (info->match_flags & XT_CONNTRACK_EXPIRES) {
236-
unsigned long expires = 0;
236+
unsigned long expires = nf_ct_expires(ct) / HZ;
237237

238-
if (timer_pending(&ct->timeout))
239-
expires = (ct->timeout.expires - jiffies) / HZ;
240238
if ((expires >= info->expires_min &&
241239
expires <= info->expires_max) ^
242240
!(info->invert_flags & XT_CONNTRACK_EXPIRES))

0 commit comments

Comments
 (0)