mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 08:44:41 +00:00 
			
		
		
		
	netfilter: nf_conntrack: pass template to l4proto ->error() handler
The error handlers might need the template to get the conntrack zone introduced in the next patches to perform a conntrack lookup. Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
		
							parent
							
								
									d5d1baa15f
								
							
						
					
					
						commit
						8fea97ec17
					
				
					 8 changed files with 15 additions and 11 deletions
				
			
		|  | @ -49,8 +49,8 @@ struct nf_conntrack_l4proto { | ||||||
| 	/* Called when a conntrack entry is destroyed */ | 	/* Called when a conntrack entry is destroyed */ | ||||||
| 	void (*destroy)(struct nf_conn *ct); | 	void (*destroy)(struct nf_conn *ct); | ||||||
| 
 | 
 | ||||||
| 	int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff, | 	int (*error)(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb, | ||||||
| 		     enum ip_conntrack_info *ctinfo, | 		     unsigned int dataoff, enum ip_conntrack_info *ctinfo, | ||||||
| 		     u_int8_t pf, unsigned int hooknum); | 		     u_int8_t pf, unsigned int hooknum); | ||||||
| 
 | 
 | ||||||
| 	/* Print out the per-protocol part of the tuple. Return like seq_* */ | 	/* Print out the per-protocol part of the tuple. Return like seq_* */ | ||||||
|  |  | ||||||
|  | @ -163,7 +163,8 @@ icmp_error_message(struct net *net, struct sk_buff *skb, | ||||||
| 
 | 
 | ||||||
| /* Small and modified version of icmp_rcv */ | /* Small and modified version of icmp_rcv */ | ||||||
| static int | static int | ||||||
| icmp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | icmp_error(struct net *net, struct nf_conn *tmpl, | ||||||
|  | 	   struct sk_buff *skb, unsigned int dataoff, | ||||||
| 	   enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) | 	   enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) | ||||||
| { | { | ||||||
| 	const struct icmphdr *icmph; | 	const struct icmphdr *icmph; | ||||||
|  |  | ||||||
|  | @ -179,7 +179,8 @@ icmpv6_error_message(struct net *net, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int | static int | ||||||
| icmpv6_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | icmpv6_error(struct net *net, struct nf_conn *tmpl, | ||||||
|  | 	     struct sk_buff *skb, unsigned int dataoff, | ||||||
| 	     enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) | 	     enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) | ||||||
| { | { | ||||||
| 	const struct icmp6hdr *icmp6h; | 	const struct icmp6hdr *icmp6h; | ||||||
|  |  | ||||||
|  | @ -799,7 +799,8 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum, | ||||||
| 	 * inverse of the return code tells to the netfilter | 	 * inverse of the return code tells to the netfilter | ||||||
| 	 * core what to do with the packet. */ | 	 * core what to do with the packet. */ | ||||||
| 	if (l4proto->error != NULL) { | 	if (l4proto->error != NULL) { | ||||||
| 		ret = l4proto->error(net, skb, dataoff, &ctinfo, pf, hooknum); | 		ret = l4proto->error(net, tmpl, skb, dataoff, &ctinfo, | ||||||
|  | 				     pf, hooknum); | ||||||
| 		if (ret <= 0) { | 		if (ret <= 0) { | ||||||
| 			NF_CT_STAT_INC_ATOMIC(net, error); | 			NF_CT_STAT_INC_ATOMIC(net, error); | ||||||
| 			NF_CT_STAT_INC_ATOMIC(net, invalid); | 			NF_CT_STAT_INC_ATOMIC(net, invalid); | ||||||
|  |  | ||||||
|  | @ -561,8 +561,9 @@ static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb, | ||||||
| 	return NF_ACCEPT; | 	return NF_ACCEPT; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int dccp_error(struct net *net, struct sk_buff *skb, | static int dccp_error(struct net *net, struct nf_conn *tmpl, | ||||||
| 		      unsigned int dataoff, enum ip_conntrack_info *ctinfo, | 		      struct sk_buff *skb, unsigned int dataoff, | ||||||
|  | 		      enum ip_conntrack_info *ctinfo, | ||||||
| 		      u_int8_t pf, unsigned int hooknum) | 		      u_int8_t pf, unsigned int hooknum) | ||||||
| { | { | ||||||
| 	struct dccp_hdr _dh, *dh; | 	struct dccp_hdr _dh, *dh; | ||||||
|  |  | ||||||
|  | @ -760,7 +760,7 @@ static const u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) + 1] = | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /* Protect conntrack agaist broken packets. Code taken from ipt_unclean.c.  */ | /* Protect conntrack agaist broken packets. Code taken from ipt_unclean.c.  */ | ||||||
| static int tcp_error(struct net *net, | static int tcp_error(struct net *net, struct nf_conn *tmpl, | ||||||
| 		     struct sk_buff *skb, | 		     struct sk_buff *skb, | ||||||
| 		     unsigned int dataoff, | 		     unsigned int dataoff, | ||||||
| 		     enum ip_conntrack_info *ctinfo, | 		     enum ip_conntrack_info *ctinfo, | ||||||
|  |  | ||||||
|  | @ -91,8 +91,8 @@ static bool udp_new(struct nf_conn *ct, const struct sk_buff *skb, | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int udp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | static int udp_error(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb, | ||||||
| 		     enum ip_conntrack_info *ctinfo, | 		     unsigned int dataoff, enum ip_conntrack_info *ctinfo, | ||||||
| 		     u_int8_t pf, | 		     u_int8_t pf, | ||||||
| 		     unsigned int hooknum) | 		     unsigned int hooknum) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -89,7 +89,7 @@ static bool udplite_new(struct nf_conn *ct, const struct sk_buff *skb, | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int udplite_error(struct net *net, | static int udplite_error(struct net *net, struct nf_conn *tmpl, | ||||||
| 			 struct sk_buff *skb, | 			 struct sk_buff *skb, | ||||||
| 			 unsigned int dataoff, | 			 unsigned int dataoff, | ||||||
| 			 enum ip_conntrack_info *ctinfo, | 			 enum ip_conntrack_info *ctinfo, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Patrick McHardy
						Patrick McHardy