Blame view

include/linux/netfilter.h 10.8 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
  #ifndef __LINUX_NETFILTER_H
  #define __LINUX_NETFILTER_H
  
  #ifdef __KERNEL__
  #include <linux/init.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
8
  #include <linux/skbuff.h>
  #include <linux/net.h>
  #include <linux/if.h>
2e3075a2c   Jan Engelhardt   [NETFILTER]: Exte...
9
10
  #include <linux/in.h>
  #include <linux/in6.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
12
13
  #include <linux/wait.h>
  #include <linux/list.h>
  #endif
c8942f1f0   Patrick McHardy   netfilter: Move l...
14
  #include <linux/types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
  #include <linux/compiler.h>
bee95250f   David S. Miller   net: Add linux/sy...
16
  #include <linux/sysctl.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
19
20
21
22
23
24
25
  
  /* Responses from hook functions. */
  #define NF_DROP 0
  #define NF_ACCEPT 1
  #define NF_STOLEN 2
  #define NF_QUEUE 3
  #define NF_REPEAT 4
  #define NF_STOP 5
  #define NF_MAX_VERDICT NF_STOP
0ab43f849   Harald Welte   [NETFILTER]: Core...
26
  /* we overload the higher bits for encoding auxiliary data such as the queue
f615df76e   Florian Westphal   netfilter: reduce...
27
28
29
30
31
   * number or errno values. Not nice, but better than additional function
   * arguments. */
  #define NF_VERDICT_MASK 0x000000ff
  
  /* extra verdict flags have mask 0x0000ff00 */
94b27cc36   Florian Westphal   netfilter: allow ...
32
  #define NF_VERDICT_FLAG_QUEUE_BYPASS	0x00008000
0ab43f849   Harald Welte   [NETFILTER]: Core...
33

f615df76e   Florian Westphal   netfilter: reduce...
34
  /* queue number (NF_QUEUE) or errno (NF_DROP) */
0ab43f849   Harald Welte   [NETFILTER]: Core...
35
36
  #define NF_VERDICT_QMASK 0xffff0000
  #define NF_VERDICT_QBITS 16
f615df76e   Florian Westphal   netfilter: reduce...
37
  #define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
0ab43f849   Harald Welte   [NETFILTER]: Core...
38

f615df76e   Florian Westphal   netfilter: reduce...
39
  #define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
da6836500   Eric Paris   netfilter: allow ...
40

6869c4d8e   Harald Welte   [NETFILTER]: redu...
41
42
  /* only for userspace compatibility */
  #ifndef __KERNEL__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
44
45
46
  /* Generic cache responses from hook functions.
     <= 0x2000 is used for protocol-flags. */
  #define NFC_UNKNOWN 0x4000
  #define NFC_ALTERED 0x8000
f615df76e   Florian Westphal   netfilter: reduce...
47
48
49
  
  /* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
  #define NF_VERDICT_BITS 16
6869c4d8e   Harald Welte   [NETFILTER]: redu...
50
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51

6e23ae2a4   Patrick McHardy   [NETFILTER]: Intr...
52
53
54
55
56
57
58
59
  enum nf_inet_hooks {
  	NF_INET_PRE_ROUTING,
  	NF_INET_LOCAL_IN,
  	NF_INET_FORWARD,
  	NF_INET_LOCAL_OUT,
  	NF_INET_POST_ROUTING,
  	NF_INET_NUMHOOKS
  };
7e9c6eeb1   Jan Engelhardt   netfilter: Introd...
60
61
62
63
64
65
66
67
68
  enum {
  	NFPROTO_UNSPEC =  0,
  	NFPROTO_IPV4   =  2,
  	NFPROTO_ARP    =  3,
  	NFPROTO_BRIDGE =  7,
  	NFPROTO_IPV6   = 10,
  	NFPROTO_DECNET = 12,
  	NFPROTO_NUMPROTO,
  };
643a2c15a   Jan Engelhardt   [NETFILTER]: Intr...
69
  union nf_inet_addr {
7b33ed221   Patrick McHardy   [NETFILTER]: Use ...
70
  	__u32		all[4];
643a2c15a   Jan Engelhardt   [NETFILTER]: Intr...
71
72
  	__be32		ip;
  	__be32		ip6[4];
2e3075a2c   Jan Engelhardt   [NETFILTER]: Exte...
73
74
  	struct in_addr	in;
  	struct in6_addr	in6;
643a2c15a   Jan Engelhardt   [NETFILTER]: Intr...
75
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
  #ifdef __KERNEL__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
  #ifdef CONFIG_NETFILTER
f615df76e   Florian Westphal   netfilter: reduce...
78
79
80
81
  static inline int NF_DROP_GETERR(int verdict)
  {
  	return -(verdict >> NF_VERDICT_QBITS);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82

b8beedd25   Patrick McHardy   [NETFILTER]: Add ...
83
84
85
86
87
88
89
90
  static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
  				   const union nf_inet_addr *a2)
  {
  	return a1->all[0] == a2->all[0] &&
  	       a1->all[1] == a2->all[1] &&
  	       a1->all[2] == a2->all[2] &&
  	       a1->all[3] == a2->all[3];
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
91
92
93
94
95
96
  extern void netfilter_init(void);
  
  /* Largest hook number + 1 */
  #define NF_MAX_HOOKS 8
  
  struct sk_buff;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
97
98
  
  typedef unsigned int nf_hookfn(unsigned int hooknum,
3db05fea5   Herbert Xu   [NETFILTER]: Repl...
99
  			       struct sk_buff *skb,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
100
101
102
  			       const struct net_device *in,
  			       const struct net_device *out,
  			       int (*okfn)(struct sk_buff *));
d94d9fee9   Eric Dumazet   net: cleanup incl...
103
  struct nf_hook_ops {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
105
106
107
108
  	struct list_head list;
  
  	/* User fills in from here down. */
  	nf_hookfn *hook;
  	struct module *owner;
76108cea0   Jan Engelhardt   netfilter: Use un...
109
110
  	u_int8_t pf;
  	unsigned int hooknum;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
111
112
113
  	/* Hooks are ordered in ascending priority. */
  	int priority;
  };
d94d9fee9   Eric Dumazet   net: cleanup incl...
114
  struct nf_sockopt_ops {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
115
  	struct list_head list;
76108cea0   Jan Engelhardt   netfilter: Use un...
116
  	u_int8_t pf;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
118
119
120
121
  
  	/* Non-inclusive ranges: use 0/0/NULL to never get called. */
  	int set_optmin;
  	int set_optmax;
  	int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len);
c30f540b6   Alexey Dobriyan   netfilter: xtable...
122
  #ifdef CONFIG_COMPAT
3fdadf7d2   Dmitry Mishin   [NET]: {get|set}s...
123
124
  	int (*compat_set)(struct sock *sk, int optval,
  			void __user *user, unsigned int len);
c30f540b6   Alexey Dobriyan   netfilter: xtable...
125
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
126
127
128
  	int get_optmin;
  	int get_optmax;
  	int (*get)(struct sock *sk, int optval, void __user *user, int *len);
c30f540b6   Alexey Dobriyan   netfilter: xtable...
129
  #ifdef CONFIG_COMPAT
3fdadf7d2   Dmitry Mishin   [NET]: {get|set}s...
130
131
  	int (*compat_get)(struct sock *sk, int optval,
  			void __user *user, int *len);
c30f540b6   Alexey Dobriyan   netfilter: xtable...
132
  #endif
16fcec35e   Neil Horman   [NETFILTER]: Fix/...
133
134
  	/* Use the module struct to lock set/get code in place */
  	struct module *owner;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
135
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
136
137
138
  /* Function to register/unregister hook points. */
  int nf_register_hook(struct nf_hook_ops *reg);
  void nf_unregister_hook(struct nf_hook_ops *reg);
972d1cb14   Patrick McHardy   [NETFILTER]: Add ...
139
140
  int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
  void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
141
142
143
144
145
  
  /* Functions to register get/setsockopt ranges (non-inclusive).  You
     need to check permissions yourself! */
  int nf_register_sockopt(struct nf_sockopt_ops *reg);
  void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
d62f9ed4a   Patrick McHardy   [NETFILTER]: nf_c...
146
147
  #ifdef CONFIG_SYSCTL
  /* Sysctl registration */
b3fd3ffe3   Pavel Emelyanov   [NETFILTER]: Use ...
148
149
  extern struct ctl_path nf_net_netfilter_sysctl_path[];
  extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
d62f9ed4a   Patrick McHardy   [NETFILTER]: nf_c...
150
  #endif /* CONFIG_SYSCTL */
7e9c6eeb1   Jan Engelhardt   netfilter: Introd...
151
  extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
152

a2d7ec58a   Eric Dumazet   netfilter: use ju...
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
  #if defined(CONFIG_JUMP_LABEL)
  #include <linux/jump_label.h>
  extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
  static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
  {
  	if (__builtin_constant_p(pf) &&
  	    __builtin_constant_p(hook))
  		return static_branch(&nf_hooks_needed[pf][hook]);
  
  	return !list_empty(&nf_hooks[pf][hook]);
  }
  #else
  static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
  {
  	return !list_empty(&nf_hooks[pf][hook]);
  }
  #endif
76108cea0   Jan Engelhardt   netfilter: Use un...
170
  int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
16a6677fd   Patrick McHardy   [XFRM]: Netfilter...
171
172
173
174
175
176
177
178
179
180
  		 struct net_device *indev, struct net_device *outdev,
  		 int (*okfn)(struct sk_buff *), int thresh);
  
  /**
   *	nf_hook_thresh - call a netfilter hook
   *	
   *	Returns 1 if the hook has allowed the packet to pass.  The function
   *	okfn must be invoked by the caller in this case.  Any other return
   *	value indicates the packet has been consumed by the hook.
   */
76108cea0   Jan Engelhardt   netfilter: Use un...
181
  static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
3db05fea5   Herbert Xu   [NETFILTER]: Repl...
182
  				 struct sk_buff *skb,
16a6677fd   Patrick McHardy   [XFRM]: Netfilter...
183
184
  				 struct net_device *indev,
  				 struct net_device *outdev,
23f3733d4   Jan Engelhardt   netfilter: reduce...
185
  				 int (*okfn)(struct sk_buff *), int thresh)
16a6677fd   Patrick McHardy   [XFRM]: Netfilter...
186
  {
a2d7ec58a   Eric Dumazet   netfilter: use ju...
187
188
189
  	if (nf_hooks_active(pf, hook))
  		return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
  	return 1;
16a6677fd   Patrick McHardy   [XFRM]: Netfilter...
190
  }
76108cea0   Jan Engelhardt   netfilter: Use un...
191
  static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
16a6677fd   Patrick McHardy   [XFRM]: Netfilter...
192
193
194
  			  struct net_device *indev, struct net_device *outdev,
  			  int (*okfn)(struct sk_buff *))
  {
23f3733d4   Jan Engelhardt   netfilter: reduce...
195
  	return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN);
16a6677fd   Patrick McHardy   [XFRM]: Netfilter...
196
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
                     
  /* Activate hook; either okfn or kfree_skb called, unless a hook
     returns NF_STOLEN (in which case, it's up to the hook to deal with
     the consequences).
  
     Returns -ERRNO if packet dropped.  Zero means queued, stolen or
     accepted.
  */
  
  /* RR:
     > I don't want nf_hook to return anything because people might forget
     > about async and trust the return value to mean "packet was ok".
  
     AK:
     Just document it clearly, then you can expect some sense from kernel
     coders :)
  */
2249065f4   Jan Engelhardt   netfilter: get ri...
214
215
216
217
218
219
220
221
222
223
  static inline int
  NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb,
  	       struct net_device *in, struct net_device *out,
  	       int (*okfn)(struct sk_buff *), int thresh)
  {
  	int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh);
  	if (ret == 1)
  		ret = okfn(skb);
  	return ret;
  }
48d5cad87   Patrick McHardy   [XFRM]: Fix SNAT-...
224

2249065f4   Jan Engelhardt   netfilter: get ri...
225
226
227
228
229
  static inline int
  NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb,
  	     struct net_device *in, struct net_device *out,
  	     int (*okfn)(struct sk_buff *), bool cond)
  {
4bac6b180   Patrick McHardy   netfilter: restor...
230
231
232
  	int ret;
  
  	if (!cond ||
ac5aa2e33   Eric Paris   netfilter: NF_HOO...
233
  	    ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1))
2249065f4   Jan Engelhardt   netfilter: get ri...
234
235
236
  		ret = okfn(skb);
  	return ret;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
237

2249065f4   Jan Engelhardt   netfilter: get ri...
238
239
240
241
242
243
244
  static inline int
  NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
  	struct net_device *in, struct net_device *out,
  	int (*okfn)(struct sk_buff *))
  {
  	return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
245
246
  
  /* Call setsockopt() */
76108cea0   Jan Engelhardt   netfilter: Use un...
247
  int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
b7058842c   David S. Miller   net: Make setsock...
248
  		  unsigned int len);
76108cea0   Jan Engelhardt   netfilter: Use un...
249
  int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
250
  		  int *len);
c30f540b6   Alexey Dobriyan   netfilter: xtable...
251
  #ifdef CONFIG_COMPAT
76108cea0   Jan Engelhardt   netfilter: Use un...
252
  int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
b7058842c   David S. Miller   net: Make setsock...
253
  		char __user *opt, unsigned int len);
76108cea0   Jan Engelhardt   netfilter: Use un...
254
  int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
3fdadf7d2   Dmitry Mishin   [NET]: {get|set}s...
255
  		char __user *opt, int *len);
c30f540b6   Alexey Dobriyan   netfilter: xtable...
256
  #endif
3fdadf7d2   Dmitry Mishin   [NET]: {get|set}s...
257

089af26c7   Harald Welte   [NETFILTER]: Rena...
258
259
260
  /* Call this before modifying an existing packet: ensures it is
     modifiable and linear to the point you care about (writable_len).
     Returns true or false. */
37d418792   Herbert Xu   [NETFILTER]: Do n...
261
  extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
089af26c7   Harald Welte   [NETFILTER]: Rena...
262

1841a4c7a   Patrick McHardy   [NETFILTER]: nf_c...
263
  struct flowi;
02f014d88   Patrick McHardy   [NETFILTER]: nf_q...
264
  struct nf_queue_entry;
c01cd429f   Patrick McHardy   [NETFILTER]: nf_q...
265

bce8032ef   Patrick McHardy   [NETFILTER]: Intr...
266
267
  struct nf_afinfo {
  	unsigned short	family;
b51655b95   Al Viro   [NET]: Annotate _...
268
  	__sum16		(*checksum)(struct sk_buff *skb, unsigned int hook,
422c346fa   Patrick McHardy   [NETFILTER]: Add ...
269
  				    unsigned int dataoff, u_int8_t protocol);
d63a65073   Patrick McHardy   [NETFILTER]: Add ...
270
271
272
273
274
  	__sum16		(*checksum_partial)(struct sk_buff *skb,
  					    unsigned int hook,
  					    unsigned int dataoff,
  					    unsigned int len,
  					    u_int8_t protocol);
31ad3dd64   Florian Westphal   netfilter: af_inf...
275
  	int		(*route)(struct net *net, struct dst_entry **dst,
0fae2e774   Florian Westphal   netfilter: af_inf...
276
  				 struct flowi *fl, bool strict);
bce8032ef   Patrick McHardy   [NETFILTER]: Intr...
277
  	void		(*saveroute)(const struct sk_buff *skb,
02f014d88   Patrick McHardy   [NETFILTER]: nf_q...
278
  				     struct nf_queue_entry *entry);
3db05fea5   Herbert Xu   [NETFILTER]: Repl...
279
  	int		(*reroute)(struct sk_buff *skb,
02f014d88   Patrick McHardy   [NETFILTER]: nf_q...
280
  				   const struct nf_queue_entry *entry);
bce8032ef   Patrick McHardy   [NETFILTER]: Intr...
281
  	int		route_key_size;
2cc7d5730   Harald Welte   [NETFILTER]: Move...
282
  };
0e60ebe04   Eric Dumazet   netfilter: add __...
283
  extern const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO];
1e796fda0   Patrick McHardy   [NETFILTER]: cons...
284
  static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
bce8032ef   Patrick McHardy   [NETFILTER]: Intr...
285
286
287
  {
  	return rcu_dereference(nf_afinfo[family]);
  }
2cc7d5730   Harald Welte   [NETFILTER]: Move...
288

b51655b95   Al Viro   [NET]: Annotate _...
289
  static inline __sum16
422c346fa   Patrick McHardy   [NETFILTER]: Add ...
290
291
292
  nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
  	    u_int8_t protocol, unsigned short family)
  {
1e796fda0   Patrick McHardy   [NETFILTER]: cons...
293
  	const struct nf_afinfo *afinfo;
b51655b95   Al Viro   [NET]: Annotate _...
294
  	__sum16 csum = 0;
422c346fa   Patrick McHardy   [NETFILTER]: Add ...
295
296
297
298
299
300
301
302
  
  	rcu_read_lock();
  	afinfo = nf_get_afinfo(family);
  	if (afinfo)
  		csum = afinfo->checksum(skb, hook, dataoff, protocol);
  	rcu_read_unlock();
  	return csum;
  }
d63a65073   Patrick McHardy   [NETFILTER]: Add ...
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
  static inline __sum16
  nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
  		    unsigned int dataoff, unsigned int len,
  		    u_int8_t protocol, unsigned short family)
  {
  	const struct nf_afinfo *afinfo;
  	__sum16 csum = 0;
  
  	rcu_read_lock();
  	afinfo = nf_get_afinfo(family);
  	if (afinfo)
  		csum = afinfo->checksum_partial(skb, hook, dataoff, len,
  						protocol);
  	rcu_read_unlock();
  	return csum;
  }
1e796fda0   Patrick McHardy   [NETFILTER]: cons...
319
320
  extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
  extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
bce8032ef   Patrick McHardy   [NETFILTER]: Intr...
321

eb9c7ebe6   Patrick McHardy   [NETFILTER]: Hand...
322
323
324
325
  #include <net/flow.h>
  extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
  
  static inline void
76108cea0   Jan Engelhardt   netfilter: Use un...
326
  nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
eb9c7ebe6   Patrick McHardy   [NETFILTER]: Hand...
327
  {
051578ccb   Patrick McHardy   [NETFILTER]: nf_n...
328
  #ifdef CONFIG_NF_NAT_NEEDED
eb9c7ebe6   Patrick McHardy   [NETFILTER]: Hand...
329
  	void (*decodefn)(struct sk_buff *, struct flowi *);
051578ccb   Patrick McHardy   [NETFILTER]: nf_n...
330
331
332
333
334
335
336
  	if (family == AF_INET) {
  		rcu_read_lock();
  		decodefn = rcu_dereference(ip_nat_decode_session);
  		if (decodefn)
  			decodefn(skb, fl);
  		rcu_read_unlock();
  	}
eb9c7ebe6   Patrick McHardy   [NETFILTER]: Hand...
337
338
  #endif
  }
608c8e4f7   Harald Welte   [NETFILTER]: Exte...
339
340
341
342
  #ifdef CONFIG_PROC_FS
  #include <linux/proc_fs.h>
  extern struct proc_dir_entry *proc_net_netfilter;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
343
344
  #else /* !CONFIG_NETFILTER */
  #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
48d5cad87   Patrick McHardy   [XFRM]: Fix SNAT-...
345
  #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
76108cea0   Jan Engelhardt   netfilter: Use un...
346
  static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
3db05fea5   Herbert Xu   [NETFILTER]: Repl...
347
  				 struct sk_buff *skb,
f53b61d8c   David S. Miller   [NETFILTER]: Add ...
348
349
  				 struct net_device *indev,
  				 struct net_device *outdev,
23f3733d4   Jan Engelhardt   netfilter: reduce...
350
  				 int (*okfn)(struct sk_buff *), int thresh)
f53b61d8c   David S. Miller   [NETFILTER]: Add ...
351
  {
3db05fea5   Herbert Xu   [NETFILTER]: Repl...
352
  	return okfn(skb);
f53b61d8c   David S. Miller   [NETFILTER]: Add ...
353
  }
76108cea0   Jan Engelhardt   netfilter: Use un...
354
  static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
f53b61d8c   David S. Miller   [NETFILTER]: Add ...
355
356
357
  			  struct net_device *indev, struct net_device *outdev,
  			  int (*okfn)(struct sk_buff *))
  {
9c92d3486   Patrick McHardy   [NETFILTER]: Don'...
358
  	return 1;
f53b61d8c   David S. Miller   [NETFILTER]: Add ...
359
  }
f53b61d8c   David S. Miller   [NETFILTER]: Add ...
360
  struct flowi;
eb9c7ebe6   Patrick McHardy   [NETFILTER]: Hand...
361
  static inline void
76108cea0   Jan Engelhardt   netfilter: Use un...
362
363
364
  nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
  {
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
365
  #endif /*CONFIG_NETFILTER*/
5f79e0f91   Yasuyuki Kozakai   [NETFILTER]: nf_c...
366
  #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
0e60ebe04   Eric Dumazet   netfilter: add __...
367
  extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) __rcu;
5f79e0f91   Yasuyuki Kozakai   [NETFILTER]: nf_c...
368
  extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
0e60ebe04   Eric Dumazet   netfilter: add __...
369
  extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
5f79e0f91   Yasuyuki Kozakai   [NETFILTER]: nf_c...
370
371
372
  #else
  static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
373
374
  #endif /*__KERNEL__*/
  #endif /*__LINUX_NETFILTER_H*/