2a5538e9aa
Move the specific NAT IPv6 core functions that are called from the hooks from ip6table_nat.c to nf_nat_l3proto_ipv6.c. This prepares the ground to allow iptables and nft to use the same NAT engine code that comes in a follow up patch. This also renames nf_nat_ipv6_fn to nft_nat_ipv6_fn in net/ipv6/netfilter/nft_chain_nat_ipv6.c to avoid a compilation breakage. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
125 lines
4.4 KiB
C
125 lines
4.4 KiB
C
#ifndef _NF_NAT_L3PROTO_H
|
|
#define _NF_NAT_L3PROTO_H
|
|
|
|
struct nf_nat_l4proto;
|
|
struct nf_nat_l3proto {
|
|
u8 l3proto;
|
|
|
|
bool (*in_range)(const struct nf_conntrack_tuple *t,
|
|
const struct nf_nat_range *range);
|
|
|
|
u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
|
|
|
|
bool (*manip_pkt)(struct sk_buff *skb,
|
|
unsigned int iphdroff,
|
|
const struct nf_nat_l4proto *l4proto,
|
|
const struct nf_conntrack_tuple *target,
|
|
enum nf_nat_manip_type maniptype);
|
|
|
|
void (*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
|
|
__sum16 *check,
|
|
const struct nf_conntrack_tuple *t,
|
|
enum nf_nat_manip_type maniptype);
|
|
|
|
void (*csum_recalc)(struct sk_buff *skb, u8 proto,
|
|
void *data, __sum16 *check,
|
|
int datalen, int oldlen);
|
|
|
|
void (*decode_session)(struct sk_buff *skb,
|
|
const struct nf_conn *ct,
|
|
enum ip_conntrack_dir dir,
|
|
unsigned long statusbit,
|
|
struct flowi *fl);
|
|
|
|
int (*nlattr_to_range)(struct nlattr *tb[],
|
|
struct nf_nat_range *range);
|
|
};
|
|
|
|
int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
|
|
void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
|
|
const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
|
|
|
|
int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
|
|
enum ip_conntrack_info ctinfo,
|
|
unsigned int hooknum);
|
|
|
|
unsigned int nf_nat_ipv4_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
unsigned int nf_nat_ipv4_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
unsigned int nf_nat_ipv4_local_fn(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
unsigned int nf_nat_ipv4_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
|
|
enum ip_conntrack_info ctinfo,
|
|
unsigned int hooknum, unsigned int hdrlen);
|
|
|
|
unsigned int nf_nat_ipv6_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
unsigned int nf_nat_ipv6_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
unsigned int nf_nat_ipv6_local_fn(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
unsigned int nf_nat_ipv6_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
unsigned int (*do_chain)(const struct nf_hook_ops *ops,
|
|
struct sk_buff *skb,
|
|
const struct net_device *in,
|
|
const struct net_device *out,
|
|
struct nf_conn *ct));
|
|
|
|
#endif /* _NF_NAT_L3PROTO_H */
|