drm/panfrost: Remove set but not used variable 'bo'
[linux/fpc-iii.git] / include / linux / netfilter_ipv6.h
blobaac42c28fe62d746c710370fa63c2c9aef2feae9
1 /* IPv6-specific defines for netfilter.
2 * (C)1998 Rusty Russell -- This code is GPL.
3 * (C)1999 David Jeffery
4 * this header was blatantly ripped from netfilter_ipv4.h
5 * it's amazing what adding a bunch of 6s can do =8^)
6 */
7 #ifndef __LINUX_IP6_NETFILTER_H
8 #define __LINUX_IP6_NETFILTER_H
10 #include <uapi/linux/netfilter_ipv6.h>
11 #include <net/tcp.h>
13 /* Check for an extension */
14 static inline int
15 nf_ip6_ext_hdr(u8 nexthdr)
16 { return (nexthdr == IPPROTO_HOPOPTS) ||
17 (nexthdr == IPPROTO_ROUTING) ||
18 (nexthdr == IPPROTO_FRAGMENT) ||
19 (nexthdr == IPPROTO_ESP) ||
20 (nexthdr == IPPROTO_AH) ||
21 (nexthdr == IPPROTO_NONE) ||
22 (nexthdr == IPPROTO_DSTOPTS);
25 /* Extra routing may needed on local out, as the QUEUE target never returns
26 * control to the table.
28 struct ip6_rt_info {
29 struct in6_addr daddr;
30 struct in6_addr saddr;
31 u_int32_t mark;
34 struct nf_queue_entry;
35 struct nf_bridge_frag_data;
38 * Hook functions for ipv6 to allow xt_* modules to be built-in even
39 * if IPv6 is a module.
41 struct nf_ipv6_ops {
42 #if IS_MODULE(CONFIG_IPV6)
43 int (*chk_addr)(struct net *net, const struct in6_addr *addr,
44 const struct net_device *dev, int strict);
45 int (*route_me_harder)(struct net *net, struct sk_buff *skb);
46 int (*dev_get_saddr)(struct net *net, const struct net_device *dev,
47 const struct in6_addr *daddr, unsigned int srcprefs,
48 struct in6_addr *saddr);
49 int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl,
50 bool strict);
51 u32 (*cookie_init_sequence)(const struct ipv6hdr *iph,
52 const struct tcphdr *th, u16 *mssp);
53 int (*cookie_v6_check)(const struct ipv6hdr *iph,
54 const struct tcphdr *th, __u32 cookie);
55 #endif
56 void (*route_input)(struct sk_buff *skb);
57 int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
58 int (*output)(struct net *, struct sock *, struct sk_buff *));
59 int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry);
60 #if IS_MODULE(CONFIG_IPV6)
61 int (*br_defrag)(struct net *net, struct sk_buff *skb, u32 user);
62 int (*br_fragment)(struct net *net, struct sock *sk,
63 struct sk_buff *skb,
64 struct nf_bridge_frag_data *data,
65 int (*output)(struct net *, struct sock *sk,
66 const struct nf_bridge_frag_data *data,
67 struct sk_buff *));
68 #endif
71 #ifdef CONFIG_NETFILTER
72 #include <net/addrconf.h>
74 extern const struct nf_ipv6_ops __rcu *nf_ipv6_ops;
75 static inline const struct nf_ipv6_ops *nf_get_ipv6_ops(void)
77 return rcu_dereference(nf_ipv6_ops);
80 static inline int nf_ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
81 const struct net_device *dev, int strict)
83 #if IS_MODULE(CONFIG_IPV6)
84 const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
86 if (!v6_ops)
87 return 1;
89 return v6_ops->chk_addr(net, addr, dev, strict);
90 #elif IS_BUILTIN(CONFIG_IPV6)
91 return ipv6_chk_addr(net, addr, dev, strict);
92 #else
93 return 1;
94 #endif
97 int __nf_ip6_route(struct net *net, struct dst_entry **dst,
98 struct flowi *fl, bool strict);
100 static inline int nf_ip6_route(struct net *net, struct dst_entry **dst,
101 struct flowi *fl, bool strict)
103 #if IS_MODULE(CONFIG_IPV6)
104 const struct nf_ipv6_ops *v6ops = nf_get_ipv6_ops();
106 if (v6ops)
107 return v6ops->route(net, dst, fl, strict);
109 return -EHOSTUNREACH;
110 #endif
111 #if IS_BUILTIN(CONFIG_IPV6)
112 return __nf_ip6_route(net, dst, fl, strict);
113 #else
114 return -EHOSTUNREACH;
115 #endif
118 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
120 static inline int nf_ipv6_br_defrag(struct net *net, struct sk_buff *skb,
121 u32 user)
123 #if IS_MODULE(CONFIG_IPV6)
124 const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
126 if (!v6_ops)
127 return 1;
129 return v6_ops->br_defrag(net, skb, user);
130 #elif IS_BUILTIN(CONFIG_IPV6)
131 return nf_ct_frag6_gather(net, skb, user);
132 #else
133 return 1;
134 #endif
137 int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
138 struct nf_bridge_frag_data *data,
139 int (*output)(struct net *, struct sock *sk,
140 const struct nf_bridge_frag_data *data,
141 struct sk_buff *));
143 static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk,
144 struct sk_buff *skb,
145 struct nf_bridge_frag_data *data,
146 int (*output)(struct net *, struct sock *sk,
147 const struct nf_bridge_frag_data *data,
148 struct sk_buff *))
150 #if IS_MODULE(CONFIG_IPV6)
151 const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
153 if (!v6_ops)
154 return 1;
156 return v6_ops->br_fragment(net, sk, skb, data, output);
157 #elif IS_BUILTIN(CONFIG_IPV6)
158 return br_ip6_fragment(net, sk, skb, data, output);
159 #else
160 return 1;
161 #endif
164 int ip6_route_me_harder(struct net *net, struct sk_buff *skb);
166 static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
168 #if IS_MODULE(CONFIG_IPV6)
169 const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
171 if (!v6_ops)
172 return -EHOSTUNREACH;
174 return v6_ops->route_me_harder(net, skb);
175 #elif IS_BUILTIN(CONFIG_IPV6)
176 return ip6_route_me_harder(net, skb);
177 #else
178 return -EHOSTUNREACH;
179 #endif
182 static inline u32 nf_ipv6_cookie_init_sequence(const struct ipv6hdr *iph,
183 const struct tcphdr *th,
184 u16 *mssp)
186 #if IS_ENABLED(CONFIG_SYN_COOKIES)
187 #if IS_MODULE(CONFIG_IPV6)
188 const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
190 if (v6_ops)
191 return v6_ops->cookie_init_sequence(iph, th, mssp);
192 #elif IS_BUILTIN(CONFIG_IPV6)
193 return __cookie_v6_init_sequence(iph, th, mssp);
194 #endif
195 #endif
196 return 0;
199 static inline int nf_cookie_v6_check(const struct ipv6hdr *iph,
200 const struct tcphdr *th, __u32 cookie)
202 #if IS_ENABLED(CONFIG_SYN_COOKIES)
203 #if IS_MODULE(CONFIG_IPV6)
204 const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
206 if (v6_ops)
207 return v6_ops->cookie_v6_check(iph, th, cookie);
208 #elif IS_BUILTIN(CONFIG_IPV6)
209 return __cookie_v6_check(iph, th, cookie);
210 #endif
211 #endif
212 return 0;
215 __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
216 unsigned int dataoff, u_int8_t protocol);
218 int ipv6_netfilter_init(void);
219 void ipv6_netfilter_fini(void);
221 #else /* CONFIG_NETFILTER */
222 static inline int ipv6_netfilter_init(void) { return 0; }
223 static inline void ipv6_netfilter_fini(void) { return; }
224 static inline const struct nf_ipv6_ops *nf_get_ipv6_ops(void) { return NULL; }
225 #endif /* CONFIG_NETFILTER */
227 #endif /*__LINUX_IP6_NETFILTER_H*/