blob: 01bcc6bfbcc9034e399a938a6a6dd83b2bed6ef7 [file] [log] [blame]
Jozsef Kadlecsik5b1158e2006-12-02 22:07:13 -08001#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
7struct sk_buff;
8
9/* These return true or false. */
Joe Perches4e77be42013-09-23 11:37:48 -070010int __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 McHardy010c0b92010-02-11 12:27:09 +010015
16static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
17 struct nf_conn *ct,
18 enum ip_conntrack_info ctinfo,
Patrick McHardy051966c2012-08-26 19:14:04 +020019 unsigned int protoff,
Patrick McHardy010c0b92010-02-11 12:27:09 +010020 unsigned int match_offset,
21 unsigned int match_len,
22 const char *rep_buffer,
23 unsigned int rep_len)
24{
Patrick McHardy051966c2012-08-26 19:14:04 +020025 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
Patrick McHardy010c0b92010-02-11 12:27:09 +010026 match_offset, match_len,
27 rep_buffer, rep_len, true);
28}
29
Joe Perches4e77be42013-09-23 11:37:48 -070030int 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 McHardy010c0b92010-02-11 12:27:09 +010035
Jozsef Kadlecsik5b1158e2006-12-02 22:07:13 -080036/* Setup NAT on this expected conntrack so it follows master, but goes
37 * to port ct->master->saved_proto. */
Joe Perches4e77be42013-09-23 11:37:48 -070038void nf_nat_follow_master(struct nf_conn *ct, struct nf_conntrack_expect *this);
Jozsef Kadlecsikf9dd09c2009-11-06 00:43:42 -080039
Jozsef Kadlecsik5b1158e2006-12-02 22:07:13 -080040#endif