Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nf_nat_helper.h
Go to the documentation of this file.
1 #ifndef _NF_NAT_HELPER_H
2 #define _NF_NAT_HELPER_H
3 /* NAT protocol helper routines. */
4 
6 
7 struct sk_buff;
8 
9 /* These return true or false. */
10 extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
11  struct nf_conn *ct,
12  enum ip_conntrack_info ctinfo,
13  unsigned int protoff,
14  unsigned int match_offset,
15  unsigned int match_len,
16  const char *rep_buffer,
17  unsigned int rep_len, bool adjust);
18 
19 static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
20  struct nf_conn *ct,
21  enum ip_conntrack_info ctinfo,
22  unsigned int protoff,
23  unsigned int match_offset,
24  unsigned int match_len,
25  const char *rep_buffer,
26  unsigned int rep_len)
27 {
28  return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
29  match_offset, match_len,
30  rep_buffer, rep_len, true);
31 }
32 
33 extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
34  struct nf_conn *ct,
35  enum ip_conntrack_info ctinfo,
36  unsigned int protoff,
37  unsigned int match_offset,
38  unsigned int match_len,
39  const char *rep_buffer,
40  unsigned int rep_len);
41 
42 extern void nf_nat_set_seq_adjust(struct nf_conn *ct,
43  enum ip_conntrack_info ctinfo,
44  __be32 seq, s16 off);
45 extern int nf_nat_seq_adjust(struct sk_buff *skb,
46  struct nf_conn *ct,
47  enum ip_conntrack_info ctinfo,
48  unsigned int protoff);
49 extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb,
50  struct nf_conn *ct,
51  enum ip_conntrack_info ctinfo,
52  unsigned int protoff);
53 
54 /* Setup NAT on this expected conntrack so it follows master, but goes
55  * to port ct->master->saved_proto. */
56 extern void nf_nat_follow_master(struct nf_conn *ct,
57  struct nf_conntrack_expect *this);
58 
59 extern s16 nf_nat_get_offset(const struct nf_conn *ct,
60  enum ip_conntrack_dir dir,
61  u32 seq);
62 
63 extern void nf_nat_tcp_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
64  u32 dir, int off);
65 
66 #endif