1 #ifndef _NF_NAT_HELPER_H
2 #define _NF_NAT_HELPER_H
3 /* NAT protocol helper routines. */
4 
5 #include <net/netfilter/nf_conntrack.h>
6 
7 struct sk_buff;
8 
9 /* These return true or false. */
10 int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, struct nf_conn *ct,
11 			       enum ip_conntrack_info ctinfo,
12 			       unsigned int protoff, unsigned int match_offset,
13 			       unsigned int match_len, const char *rep_buffer,
14 			       unsigned int rep_len, bool adjust);
15 
nf_nat_mangle_tcp_packet(struct sk_buff * skb,struct nf_conn * ct,enum ip_conntrack_info ctinfo,unsigned int protoff,unsigned int match_offset,unsigned int match_len,const char * rep_buffer,unsigned int rep_len)16 static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
17 					   struct nf_conn *ct,
18 					   enum ip_conntrack_info ctinfo,
19 					   unsigned int protoff,
20 					   unsigned int match_offset,
21 					   unsigned int match_len,
22 					   const char *rep_buffer,
23 					   unsigned int rep_len)
24 {
25 	return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
26 					  match_offset, match_len,
27 					  rep_buffer, rep_len, true);
28 }
29 
30 int nf_nat_mangle_udp_packet(struct sk_buff *skb, struct nf_conn *ct,
31 			     enum ip_conntrack_info ctinfo,
32 			     unsigned int protoff, unsigned int match_offset,
33 			     unsigned int match_len, const char *rep_buffer,
34 			     unsigned int rep_len);
35 
36 /* Setup NAT on this expected conntrack so it follows master, but goes
37  * to port ct->master->saved_proto. */
38 void nf_nat_follow_master(struct nf_conn *ct, struct nf_conntrack_expect *this);
39 
40 #endif
41