mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	[NETFILTER]: nf_conntrack: kill unique ID
Remove the per-conntrack ID, its not necessary anymore for dumping. For compatiblity reasons we send the address of the conntrack to userspace as ID. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									2b5c841f2c
								
							
						
					
					
						commit
						7f85f91472
					
				
					 3 changed files with 2 additions and 7 deletions
				
			
		| 
						 | 
					@ -116,9 +116,6 @@ struct nf_conn
 | 
				
			||||||
	struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
 | 
						struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Unique ID that identifies this conntrack*/
 | 
					 | 
				
			||||||
	unsigned int id;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if defined(CONFIG_NF_CONNTRACK_MARK)
 | 
					#if defined(CONFIG_NF_CONNTRACK_MARK)
 | 
				
			||||||
	u_int32_t mark;
 | 
						u_int32_t mark;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,6 @@ unsigned int nf_ct_log_invalid __read_mostly;
 | 
				
			||||||
HLIST_HEAD(unconfirmed);
 | 
					HLIST_HEAD(unconfirmed);
 | 
				
			||||||
static int nf_conntrack_vmalloc __read_mostly;
 | 
					static int nf_conntrack_vmalloc __read_mostly;
 | 
				
			||||||
static struct kmem_cache *nf_conntrack_cachep __read_mostly;
 | 
					static struct kmem_cache *nf_conntrack_cachep __read_mostly;
 | 
				
			||||||
static unsigned int nf_conntrack_next_id;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEFINE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
 | 
					DEFINE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
 | 
				
			||||||
EXPORT_PER_CPU_SYMBOL(nf_conntrack_stat);
 | 
					EXPORT_PER_CPU_SYMBOL(nf_conntrack_stat);
 | 
				
			||||||
| 
						 | 
					@ -287,7 +286,6 @@ static void __nf_conntrack_hash_insert(struct nf_conn *ct,
 | 
				
			||||||
				       unsigned int hash,
 | 
									       unsigned int hash,
 | 
				
			||||||
				       unsigned int repl_hash)
 | 
									       unsigned int repl_hash)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ct->id = ++nf_conntrack_next_id;
 | 
					 | 
				
			||||||
	hlist_add_head(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode,
 | 
						hlist_add_head(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode,
 | 
				
			||||||
		       &nf_conntrack_hash[hash]);
 | 
							       &nf_conntrack_hash[hash]);
 | 
				
			||||||
	hlist_add_head(&ct->tuplehash[IP_CT_DIR_REPLY].hnode,
 | 
						hlist_add_head(&ct->tuplehash[IP_CT_DIR_REPLY].hnode,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -257,7 +257,7 @@ ctnetlink_dump_mark(struct sk_buff *skb, const struct nf_conn *ct)
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct)
 | 
					ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	__be32 id = htonl(ct->id);
 | 
						__be32 id = htonl((unsigned long)ct);
 | 
				
			||||||
	NLA_PUT(skb, CTA_ID, sizeof(u_int32_t), &id);
 | 
						NLA_PUT(skb, CTA_ID, sizeof(u_int32_t), &id);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -723,7 +723,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (cda[CTA_ID]) {
 | 
						if (cda[CTA_ID]) {
 | 
				
			||||||
		u_int32_t id = ntohl(*(__be32 *)nla_data(cda[CTA_ID]));
 | 
							u_int32_t id = ntohl(*(__be32 *)nla_data(cda[CTA_ID]));
 | 
				
			||||||
		if (ct->id != id) {
 | 
							if (id != (u32)(unsigned long)ct) {
 | 
				
			||||||
			nf_ct_put(ct);
 | 
								nf_ct_put(ct);
 | 
				
			||||||
			return -ENOENT;
 | 
								return -ENOENT;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue