c9bb6165a1
This patch fixes a few problems with CONFIG_IPV6=y and
CONFIG_NF_CONNTRACK_BRIDGE=m:
In file included from net/netfilter/utils.c:5:
include/linux/netfilter_ipv6.h: In function 'nf_ipv6_br_defrag':
include/linux/netfilter_ipv6.h:110:9: error: implicit declaration of function 'nf_ct_frag6_gather'; did you mean 'nf_ct_attach'? [-Werror=implicit-function-declaration]
And these too:
net/ipv6/netfilter.c:242:2: error: unknown field 'br_defrag' specified in initializer
net/ipv6/netfilter.c:243:2: error: unknown field 'br_fragment' specified in initializer
This patch includes an original chunk from wenxu.
Fixes: 764dd163ac
("netfilter: nf_conntrack_bridge: add support for IPv6")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: Yuehaibing <yuehaibing@huawei.com>
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
170 lines
4.7 KiB
C
170 lines
4.7 KiB
C
/* IPv6-specific defines for netfilter.
|
|
* (C)1998 Rusty Russell -- This code is GPL.
|
|
* (C)1999 David Jeffery
|
|
* this header was blatantly ripped from netfilter_ipv4.h
|
|
* it's amazing what adding a bunch of 6s can do =8^)
|
|
*/
|
|
#ifndef __LINUX_IP6_NETFILTER_H
|
|
#define __LINUX_IP6_NETFILTER_H
|
|
|
|
#include <uapi/linux/netfilter_ipv6.h>
|
|
|
|
/* Extra routing may needed on local out, as the QUEUE target never returns
|
|
* control to the table.
|
|
*/
|
|
struct ip6_rt_info {
|
|
struct in6_addr daddr;
|
|
struct in6_addr saddr;
|
|
u_int32_t mark;
|
|
};
|
|
|
|
struct nf_queue_entry;
|
|
struct nf_ct_bridge_frag_data;
|
|
|
|
/*
|
|
* Hook functions for ipv6 to allow xt_* modules to be built-in even
|
|
* if IPv6 is a module.
|
|
*/
|
|
struct nf_ipv6_ops {
|
|
#if IS_MODULE(CONFIG_IPV6)
|
|
int (*chk_addr)(struct net *net, const struct in6_addr *addr,
|
|
const struct net_device *dev, int strict);
|
|
int (*route_me_harder)(struct net *net, struct sk_buff *skb);
|
|
int (*dev_get_saddr)(struct net *net, const struct net_device *dev,
|
|
const struct in6_addr *daddr, unsigned int srcprefs,
|
|
struct in6_addr *saddr);
|
|
int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl,
|
|
bool strict);
|
|
#endif
|
|
void (*route_input)(struct sk_buff *skb);
|
|
int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
|
|
int (*output)(struct net *, struct sock *, struct sk_buff *));
|
|
int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry);
|
|
#if IS_MODULE(CONFIG_IPV6)
|
|
int (*br_defrag)(struct net *net, struct sk_buff *skb, u32 user);
|
|
int (*br_fragment)(struct net *net, struct sock *sk,
|
|
struct sk_buff *skb,
|
|
struct nf_ct_bridge_frag_data *data,
|
|
int (*output)(struct net *, struct sock *sk,
|
|
const struct nf_ct_bridge_frag_data *data,
|
|
struct sk_buff *));
|
|
#endif
|
|
};
|
|
|
|
#ifdef CONFIG_NETFILTER
|
|
#include <net/addrconf.h>
|
|
|
|
extern const struct nf_ipv6_ops __rcu *nf_ipv6_ops;
|
|
static inline const struct nf_ipv6_ops *nf_get_ipv6_ops(void)
|
|
{
|
|
return rcu_dereference(nf_ipv6_ops);
|
|
}
|
|
|
|
static inline int nf_ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
|
|
const struct net_device *dev, int strict)
|
|
{
|
|
#if IS_MODULE(CONFIG_IPV6)
|
|
const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
|
|
|
|
if (!v6_ops)
|
|
return 1;
|
|
|
|
return v6_ops->chk_addr(net, addr, dev, strict);
|
|
#else
|
|
return ipv6_chk_addr(net, addr, dev, strict);
|
|
#endif
|
|
}
|
|
|
|
int __nf_ip6_route(struct net *net, struct dst_entry **dst,
|
|
struct flowi *fl, bool strict);
|
|
|
|
static inline int nf_ip6_route(struct net *net, struct dst_entry **dst,
|
|
struct flowi *fl, bool strict)
|
|
{
|
|
#if IS_MODULE(CONFIG_IPV6)
|
|
const struct nf_ipv6_ops *v6ops = nf_get_ipv6_ops();
|
|
|
|
if (v6ops)
|
|
return v6ops->route(net, dst, fl, strict);
|
|
|
|
return -EHOSTUNREACH;
|
|
#endif
|
|
#if IS_BUILTIN(CONFIG_IPV6)
|
|
return __nf_ip6_route(net, dst, fl, strict);
|
|
#else
|
|
return -EHOSTUNREACH;
|
|
#endif
|
|
}
|
|
|
|
#include <net/netfilter/ipv6/nf_defrag_ipv6.h>
|
|
|
|
static inline int nf_ipv6_br_defrag(struct net *net, struct sk_buff *skb,
|
|
u32 user)
|
|
{
|
|
#if IS_MODULE(CONFIG_IPV6)
|
|
const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
|
|
|
|
if (!v6_ops)
|
|
return 1;
|
|
|
|
return v6_ops->br_defrag(net, skb, user);
|
|
#else
|
|
return nf_ct_frag6_gather(net, skb, user);
|
|
#endif
|
|
}
|
|
|
|
int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
|
|
struct nf_ct_bridge_frag_data *data,
|
|
int (*output)(struct net *, struct sock *sk,
|
|
const struct nf_ct_bridge_frag_data *data,
|
|
struct sk_buff *));
|
|
|
|
static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk,
|
|
struct sk_buff *skb,
|
|
struct nf_ct_bridge_frag_data *data,
|
|
int (*output)(struct net *, struct sock *sk,
|
|
const struct nf_ct_bridge_frag_data *data,
|
|
struct sk_buff *))
|
|
{
|
|
#if IS_MODULE(CONFIG_IPV6)
|
|
const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
|
|
|
|
if (!v6_ops)
|
|
return 1;
|
|
|
|
return v6_ops->br_fragment(net, sk, skb, data, output);
|
|
#else
|
|
return br_ip6_fragment(net, sk, skb, data, output);
|
|
#endif
|
|
}
|
|
|
|
int ip6_route_me_harder(struct net *net, struct sk_buff *skb);
|
|
|
|
static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
|
|
{
|
|
#if IS_MODULE(CONFIG_IPV6)
|
|
const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
|
|
|
|
if (!v6_ops)
|
|
return -EHOSTUNREACH;
|
|
|
|
return v6_ops->route_me_harder(net, skb);
|
|
#else
|
|
return ip6_route_me_harder(net, skb);
|
|
#endif
|
|
}
|
|
|
|
__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
|
|
unsigned int dataoff, u_int8_t protocol);
|
|
|
|
int ipv6_netfilter_init(void);
|
|
void ipv6_netfilter_fini(void);
|
|
|
|
#else /* CONFIG_NETFILTER */
|
|
static inline int ipv6_netfilter_init(void) { return 0; }
|
|
static inline void ipv6_netfilter_fini(void) { return; }
|
|
static inline const struct nf_ipv6_ops *nf_get_ipv6_ops(void) { return NULL; }
|
|
#endif /* CONFIG_NETFILTER */
|
|
|
|
#endif /*__LINUX_IP6_NETFILTER_H*/
|