Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0b35b93 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso
Browse files

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: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 9f7c824a
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -163,8 +163,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
	ret = -ENOSPC;
	ret = -ENOSPC;
	seq_printf(s, "%-8s %u %ld ",
	seq_printf(s, "%-8s %u %ld ",
		   l4proto->name, nf_ct_protonum(ct),
		   l4proto->name, nf_ct_protonum(ct),
		   timer_pending(&ct->timeout)
		   nf_ct_expires(ct) / HZ);
		   ? (long)(ct->timeout.expires - jiffies)/HZ : 0);


	if (l4proto->print_conntrack)
	if (l4proto->print_conntrack)
		l4proto->print_conntrack(s, ct);
		l4proto->print_conntrack(s, ct);
+1 −4
Original line number Original line Diff line number Diff line
@@ -149,10 +149,7 @@ static int ctnetlink_dump_status(struct sk_buff *skb, const struct nf_conn *ct)


static int ctnetlink_dump_timeout(struct sk_buff *skb, const struct nf_conn *ct)
static int ctnetlink_dump_timeout(struct sk_buff *skb, const struct nf_conn *ct)
{
{
	long timeout = ((long)ct->timeout.expires - (long)jiffies) / HZ;
	long timeout = nf_ct_expires(ct) / HZ;

	if (timeout < 0)
		timeout = 0;


	if (nla_put_be32(skb, CTA_TIMEOUT, htonl(timeout)))
	if (nla_put_be32(skb, CTA_TIMEOUT, htonl(timeout)))
		goto nla_put_failure;
		goto nla_put_failure;
+1 −2
Original line number Original line Diff line number Diff line
@@ -224,8 +224,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
	seq_printf(s, "%-8s %u %-8s %u %ld ",
	seq_printf(s, "%-8s %u %-8s %u %ld ",
		   l3proto->name, nf_ct_l3num(ct),
		   l3proto->name, nf_ct_l3num(ct),
		   l4proto->name, nf_ct_protonum(ct),
		   l4proto->name, nf_ct_protonum(ct),
		   timer_pending(&ct->timeout)
		   nf_ct_expires(ct)  / HZ);
		   ? (long)(ct->timeout.expires - jiffies)/HZ : 0);


	if (l4proto->print_conntrack)
	if (l4proto->print_conntrack)
		l4proto->print_conntrack(s, ct);
		l4proto->print_conntrack(s, ct);
+1 −3
Original line number Original line Diff line number Diff line
@@ -233,10 +233,8 @@ conntrack_mt(const struct sk_buff *skb, struct xt_action_param *par,
		return false;
		return false;


	if (info->match_flags & XT_CONNTRACK_EXPIRES) {
	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 &&
		if ((expires >= info->expires_min &&
		    expires <= info->expires_max) ^
		    expires <= info->expires_max) ^
		    !(info->invert_flags & XT_CONNTRACK_EXPIRES))
		    !(info->invert_flags & XT_CONNTRACK_EXPIRES))