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

Commit 51091764 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

netfilter: nf_conntrack: add nf_ct_kill()



Encapsulate the common

	if (del_timer(&ct->timeout))
		ct->timeout.function((unsigned long)ct)

sequence in a new function.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 31d8519c
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -223,6 +223,8 @@ static inline void nf_ct_refresh(struct nf_conn *ct,
	__nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
	__nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
}
}


extern void nf_ct_kill(struct nf_conn *ct);

/* These are for NAT.  Icky. */
/* These are for NAT.  Icky. */
/* Update TCP window tracking data when NAT mangles the packet */
/* Update TCP window tracking data when NAT mangles the packet */
extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
+2 −3
Original line number Original line Diff line number Diff line
@@ -87,9 +87,8 @@ static int icmp_packet(struct nf_conn *ct,
	   means this will only run once even if count hits zero twice
	   means this will only run once even if count hits zero twice
	   (theoretically possible with SMP) */
	   (theoretically possible with SMP) */
	if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
	if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
		if (atomic_dec_and_test(&ct->proto.icmp.count)
		if (atomic_dec_and_test(&ct->proto.icmp.count))
		    && del_timer(&ct->timeout))
			nf_ct_kill(ct);
			ct->timeout.function((unsigned long)ct);
	} else {
	} else {
		atomic_inc(&ct->proto.icmp.count);
		atomic_inc(&ct->proto.icmp.count);
		nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb);
		nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb);
+2 −3
Original line number Original line Diff line number Diff line
@@ -89,9 +89,8 @@ static int icmpv6_packet(struct nf_conn *ct,
	   means this will only run once even if count hits zero twice
	   means this will only run once even if count hits zero twice
	   (theoretically possible with SMP) */
	   (theoretically possible with SMP) */
	if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
	if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
		if (atomic_dec_and_test(&ct->proto.icmp.count)
		if (atomic_dec_and_test(&ct->proto.icmp.count))
		    && del_timer(&ct->timeout))
			nf_ct_kill(ct);
			ct->timeout.function((unsigned long)ct);
	} else {
	} else {
		atomic_inc(&ct->proto.icmp.count);
		atomic_inc(&ct->proto.icmp.count);
		nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb);
		nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb);
+7 −0
Original line number Original line Diff line number Diff line
@@ -848,6 +848,13 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
}
}
EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct);
EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct);


void nf_ct_kill(struct nf_conn *ct)
{
	if (del_timer(&ct->timeout))
		ct->timeout.function((unsigned long)ct);
}
EXPORT_SYMBOL_GPL(nf_ct_kill);

#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)


#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nfnetlink.h>
+1 −2
Original line number Original line Diff line number Diff line
@@ -812,9 +812,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
			return -ENOENT;
			return -ENOENT;
		}
		}
	}
	}
	if (del_timer(&ct->timeout))
		ct->timeout.function((unsigned long)ct);


	nf_ct_kill(ct);
	nf_ct_put(ct);
	nf_ct_put(ct);


	return 0;
	return 0;
Loading