Jozsef Kadlecsik | 5b1158e | 2006-12-02 22:07:13 -0800 | [diff] [blame] | 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. */ |
Joe Perches | 4e77be4 | 2013-09-23 11:37:48 -0700 | [diff] [blame] | 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); |
Patrick McHardy | 010c0b9 | 2010-02-11 12:27:09 +0100 | [diff] [blame] | 15 | |
| 16 | static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, |
| 17 | struct nf_conn *ct, |
| 18 | enum ip_conntrack_info ctinfo, |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 19 | unsigned int protoff, |
Patrick McHardy | 010c0b9 | 2010-02-11 12:27:09 +0100 | [diff] [blame] | 20 | unsigned int match_offset, |
| 21 | unsigned int match_len, |
| 22 | const char *rep_buffer, |
| 23 | unsigned int rep_len) |
| 24 | { |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 25 | return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff, |
Patrick McHardy | 010c0b9 | 2010-02-11 12:27:09 +0100 | [diff] [blame] | 26 | match_offset, match_len, |
| 27 | rep_buffer, rep_len, true); |
| 28 | } |
| 29 | |
Joe Perches | 4e77be4 | 2013-09-23 11:37:48 -0700 | [diff] [blame] | 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); |
Patrick McHardy | 010c0b9 | 2010-02-11 12:27:09 +0100 | [diff] [blame] | 35 | |
Jozsef Kadlecsik | 5b1158e | 2006-12-02 22:07:13 -0800 | [diff] [blame] | 36 | /* Setup NAT on this expected conntrack so it follows master, but goes |
| 37 | * to port ct->master->saved_proto. */ |
Joe Perches | 4e77be4 | 2013-09-23 11:37:48 -0700 | [diff] [blame] | 38 | void nf_nat_follow_master(struct nf_conn *ct, struct nf_conntrack_expect *this); |
Jozsef Kadlecsik | f9dd09c | 2009-11-06 00:43:42 -0800 | [diff] [blame] | 39 | |
Jozsef Kadlecsik | 5b1158e | 2006-12-02 22:07:13 -0800 | [diff] [blame] | 40 | #endif |