Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __LINUX_NETFILTER_H |
| 2 | #define __LINUX_NETFILTER_H |
| 3 | |
| 4 | #ifdef __KERNEL__ |
| 5 | #include <linux/init.h> |
| 6 | #include <linux/types.h> |
| 7 | #include <linux/skbuff.h> |
| 8 | #include <linux/net.h> |
| 9 | #include <linux/if.h> |
| 10 | #include <linux/wait.h> |
| 11 | #include <linux/list.h> |
| 12 | #endif |
| 13 | #include <linux/compiler.h> |
| 14 | |
| 15 | /* Responses from hook functions. */ |
| 16 | #define NF_DROP 0 |
| 17 | #define NF_ACCEPT 1 |
| 18 | #define NF_STOLEN 2 |
| 19 | #define NF_QUEUE 3 |
| 20 | #define NF_REPEAT 4 |
| 21 | #define NF_STOP 5 |
| 22 | #define NF_MAX_VERDICT NF_STOP |
| 23 | |
Harald Welte | 0ab43f8 | 2005-08-09 19:43:44 -0700 | [diff] [blame] | 24 | /* we overload the higher bits for encoding auxiliary data such as the queue |
| 25 | * number. Not nice, but better than additional function arguments. */ |
| 26 | #define NF_VERDICT_MASK 0x0000ffff |
| 27 | #define NF_VERDICT_BITS 16 |
| 28 | |
| 29 | #define NF_VERDICT_QMASK 0xffff0000 |
| 30 | #define NF_VERDICT_QBITS 16 |
| 31 | |
Harald Welte | b766b30 | 2005-08-12 11:36:44 -0700 | [diff] [blame] | 32 | #define NF_QUEUE_NR(x) (((x << NF_VERDICT_QBITS) & NF_VERDICT_QMASK) | NF_QUEUE) |
Harald Welte | 0ab43f8 | 2005-08-09 19:43:44 -0700 | [diff] [blame] | 33 | |
Harald Welte | 6869c4d | 2005-08-09 19:24:19 -0700 | [diff] [blame] | 34 | /* only for userspace compatibility */ |
| 35 | #ifndef __KERNEL__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | /* Generic cache responses from hook functions. |
| 37 | <= 0x2000 is used for protocol-flags. */ |
| 38 | #define NFC_UNKNOWN 0x4000 |
| 39 | #define NFC_ALTERED 0x8000 |
Harald Welte | 6869c4d | 2005-08-09 19:24:19 -0700 | [diff] [blame] | 40 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
| 42 | #ifdef __KERNEL__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #ifdef CONFIG_NETFILTER |
| 44 | |
| 45 | extern void netfilter_init(void); |
| 46 | |
| 47 | /* Largest hook number + 1 */ |
| 48 | #define NF_MAX_HOOKS 8 |
| 49 | |
| 50 | struct sk_buff; |
| 51 | struct net_device; |
| 52 | |
| 53 | typedef unsigned int nf_hookfn(unsigned int hooknum, |
| 54 | struct sk_buff **skb, |
| 55 | const struct net_device *in, |
| 56 | const struct net_device *out, |
| 57 | int (*okfn)(struct sk_buff *)); |
| 58 | |
| 59 | struct nf_hook_ops |
| 60 | { |
| 61 | struct list_head list; |
| 62 | |
| 63 | /* User fills in from here down. */ |
| 64 | nf_hookfn *hook; |
| 65 | struct module *owner; |
| 66 | int pf; |
| 67 | int hooknum; |
| 68 | /* Hooks are ordered in ascending priority. */ |
| 69 | int priority; |
| 70 | }; |
| 71 | |
| 72 | struct nf_sockopt_ops |
| 73 | { |
| 74 | struct list_head list; |
| 75 | |
| 76 | int pf; |
| 77 | |
| 78 | /* Non-inclusive ranges: use 0/0/NULL to never get called. */ |
| 79 | int set_optmin; |
| 80 | int set_optmax; |
| 81 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); |
Dmitry Mishin | 3fdadf7 | 2006-03-20 22:45:21 -0800 | [diff] [blame] | 82 | int (*compat_set)(struct sock *sk, int optval, |
| 83 | void __user *user, unsigned int len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
| 85 | int get_optmin; |
| 86 | int get_optmax; |
| 87 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); |
Dmitry Mishin | 3fdadf7 | 2006-03-20 22:45:21 -0800 | [diff] [blame] | 88 | int (*compat_get)(struct sock *sk, int optval, |
| 89 | void __user *user, int *len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | |
| 91 | /* Number of users inside set() or get(). */ |
| 92 | unsigned int use; |
| 93 | struct task_struct *cleanup_task; |
| 94 | }; |
| 95 | |
| 96 | /* Each queued (to userspace) skbuff has one of these. */ |
| 97 | struct nf_info |
| 98 | { |
| 99 | /* The ops struct which sent us to userspace. */ |
| 100 | struct nf_hook_ops *elem; |
| 101 | |
| 102 | /* If we're sent to userspace, this keeps housekeeping info */ |
| 103 | int pf; |
| 104 | unsigned int hook; |
| 105 | struct net_device *indev, *outdev; |
| 106 | int (*okfn)(struct sk_buff *); |
| 107 | }; |
| 108 | |
| 109 | /* Function to register/unregister hook points. */ |
| 110 | int nf_register_hook(struct nf_hook_ops *reg); |
| 111 | void nf_unregister_hook(struct nf_hook_ops *reg); |
Patrick McHardy | 972d1cb | 2006-04-06 14:09:12 -0700 | [diff] [blame] | 112 | int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n); |
| 113 | void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | |
| 115 | /* Functions to register get/setsockopt ranges (non-inclusive). You |
| 116 | need to check permissions yourself! */ |
| 117 | int nf_register_sockopt(struct nf_sockopt_ops *reg); |
| 118 | void nf_unregister_sockopt(struct nf_sockopt_ops *reg); |
| 119 | |
Patrick McHardy | d62f9ed | 2006-11-29 02:35:17 +0100 | [diff] [blame] | 120 | #ifdef CONFIG_SYSCTL |
| 121 | /* Sysctl registration */ |
| 122 | struct ctl_table_header *nf_register_sysctl_table(struct ctl_table *path, |
| 123 | struct ctl_table *table); |
| 124 | void nf_unregister_sysctl_table(struct ctl_table_header *header, |
| 125 | struct ctl_table *table); |
| 126 | extern struct ctl_table nf_net_netfilter_sysctl_path[]; |
| 127 | extern struct ctl_table nf_net_ipv4_netfilter_sysctl_path[]; |
| 128 | #endif /* CONFIG_SYSCTL */ |
| 129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; |
| 131 | |
Harald Welte | 608c8e4 | 2005-08-09 19:58:27 -0700 | [diff] [blame] | 132 | /* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will |
| 133 | * disappear once iptables is replaced with pkttables. Please DO NOT use them |
| 134 | * for any new code! */ |
| 135 | #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
| 136 | #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ |
| 137 | #define NF_LOG_IPOPT 0x04 /* Log IP options */ |
| 138 | #define NF_LOG_UID 0x08 /* Log UID owning local socket */ |
| 139 | #define NF_LOG_MASK 0x0f |
| 140 | |
| 141 | #define NF_LOG_TYPE_LOG 0x01 |
| 142 | #define NF_LOG_TYPE_ULOG 0x02 |
| 143 | |
| 144 | struct nf_loginfo { |
| 145 | u_int8_t type; |
| 146 | union { |
| 147 | struct { |
| 148 | u_int32_t copy_len; |
| 149 | u_int16_t group; |
| 150 | u_int16_t qthreshold; |
| 151 | } ulog; |
| 152 | struct { |
| 153 | u_int8_t level; |
| 154 | u_int8_t logflags; |
| 155 | } log; |
| 156 | } u; |
| 157 | }; |
| 158 | |
| 159 | typedef void nf_logfn(unsigned int pf, |
| 160 | unsigned int hooknum, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | const struct sk_buff *skb, |
| 162 | const struct net_device *in, |
| 163 | const struct net_device *out, |
Harald Welte | 608c8e4 | 2005-08-09 19:58:27 -0700 | [diff] [blame] | 164 | const struct nf_loginfo *li, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | const char *prefix); |
| 166 | |
Harald Welte | 608c8e4 | 2005-08-09 19:58:27 -0700 | [diff] [blame] | 167 | struct nf_logger { |
| 168 | struct module *me; |
| 169 | nf_logfn *logfn; |
| 170 | char *name; |
| 171 | }; |
| 172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | /* Function to register/unregister log function. */ |
Harald Welte | 608c8e4 | 2005-08-09 19:58:27 -0700 | [diff] [blame] | 174 | int nf_log_register(int pf, struct nf_logger *logger); |
Patrick McHardy | e92ad99 | 2007-02-12 11:11:55 -0800 | [diff] [blame] | 175 | void nf_log_unregister(struct nf_logger *logger); |
Patrick McHardy | 9dc6aa5 | 2007-02-12 11:11:24 -0800 | [diff] [blame] | 176 | void nf_log_unregister_pf(int pf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | |
| 178 | /* Calls the registered backend logging function */ |
| 179 | void nf_log_packet(int pf, |
| 180 | unsigned int hooknum, |
| 181 | const struct sk_buff *skb, |
| 182 | const struct net_device *in, |
| 183 | const struct net_device *out, |
Harald Welte | 608c8e4 | 2005-08-09 19:58:27 -0700 | [diff] [blame] | 184 | struct nf_loginfo *li, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | const char *fmt, ...); |
Patrick McHardy | 16a6677 | 2006-01-06 23:01:48 -0800 | [diff] [blame] | 186 | |
| 187 | int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, |
| 188 | struct net_device *indev, struct net_device *outdev, |
| 189 | int (*okfn)(struct sk_buff *), int thresh); |
| 190 | |
| 191 | /** |
| 192 | * nf_hook_thresh - call a netfilter hook |
| 193 | * |
| 194 | * Returns 1 if the hook has allowed the packet to pass. The function |
| 195 | * okfn must be invoked by the caller in this case. Any other return |
| 196 | * value indicates the packet has been consumed by the hook. |
| 197 | */ |
| 198 | static inline int nf_hook_thresh(int pf, unsigned int hook, |
| 199 | struct sk_buff **pskb, |
| 200 | struct net_device *indev, |
| 201 | struct net_device *outdev, |
Patrick McHardy | 48d5cad | 2006-02-15 15:10:22 -0800 | [diff] [blame] | 202 | int (*okfn)(struct sk_buff *), int thresh, |
| 203 | int cond) |
Patrick McHardy | 16a6677 | 2006-01-06 23:01:48 -0800 | [diff] [blame] | 204 | { |
Patrick McHardy | 48d5cad | 2006-02-15 15:10:22 -0800 | [diff] [blame] | 205 | if (!cond) |
| 206 | return 1; |
Patrick McHardy | 16a6677 | 2006-01-06 23:01:48 -0800 | [diff] [blame] | 207 | #ifndef CONFIG_NETFILTER_DEBUG |
| 208 | if (list_empty(&nf_hooks[pf][hook])) |
| 209 | return 1; |
| 210 | #endif |
| 211 | return nf_hook_slow(pf, hook, pskb, indev, outdev, okfn, thresh); |
| 212 | } |
| 213 | |
| 214 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb, |
| 215 | struct net_device *indev, struct net_device *outdev, |
| 216 | int (*okfn)(struct sk_buff *)) |
| 217 | { |
Patrick McHardy | 48d5cad | 2006-02-15 15:10:22 -0800 | [diff] [blame] | 218 | return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN, 1); |
Patrick McHardy | 16a6677 | 2006-01-06 23:01:48 -0800 | [diff] [blame] | 219 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | |
| 221 | /* Activate hook; either okfn or kfree_skb called, unless a hook |
| 222 | returns NF_STOLEN (in which case, it's up to the hook to deal with |
| 223 | the consequences). |
| 224 | |
| 225 | Returns -ERRNO if packet dropped. Zero means queued, stolen or |
| 226 | accepted. |
| 227 | */ |
| 228 | |
| 229 | /* RR: |
| 230 | > I don't want nf_hook to return anything because people might forget |
| 231 | > about async and trust the return value to mean "packet was ok". |
| 232 | |
| 233 | AK: |
| 234 | Just document it clearly, then you can expect some sense from kernel |
| 235 | coders :) |
| 236 | */ |
| 237 | |
| 238 | /* This is gross, but inline doesn't cut it for avoiding the function |
| 239 | call in fast path: gcc doesn't inline (needs value tracking?). --RR */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | |
Patrick McHardy | 16a6677 | 2006-01-06 23:01:48 -0800 | [diff] [blame] | 241 | /* HX: It's slightly less gross now. */ |
| 242 | |
| 243 | #define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ |
| 244 | ({int __ret; \ |
Patrick McHardy | 48d5cad | 2006-02-15 15:10:22 -0800 | [diff] [blame] | 245 | if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh, 1)) == 1)\ |
| 246 | __ret = (okfn)(skb); \ |
| 247 | __ret;}) |
| 248 | |
| 249 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ |
| 250 | ({int __ret; \ |
| 251 | if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\ |
Patrick McHardy | 16a6677 | 2006-01-06 23:01:48 -0800 | [diff] [blame] | 252 | __ret = (okfn)(skb); \ |
| 253 | __ret;}) |
| 254 | |
| 255 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ |
| 256 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | |
| 258 | /* Call setsockopt() */ |
| 259 | int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, |
| 260 | int len); |
| 261 | int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, |
| 262 | int *len); |
| 263 | |
Dmitry Mishin | 3fdadf7 | 2006-03-20 22:45:21 -0800 | [diff] [blame] | 264 | int compat_nf_setsockopt(struct sock *sk, int pf, int optval, |
| 265 | char __user *opt, int len); |
| 266 | int compat_nf_getsockopt(struct sock *sk, int pf, int optval, |
| 267 | char __user *opt, int *len); |
| 268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | /* Packet queuing */ |
Harald Welte | bbd86b9f | 2005-08-09 20:23:11 -0700 | [diff] [blame] | 270 | struct nf_queue_handler { |
| 271 | int (*outfn)(struct sk_buff *skb, struct nf_info *info, |
| 272 | unsigned int queuenum, void *data); |
| 273 | void *data; |
| 274 | char *name; |
| 275 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | extern int nf_register_queue_handler(int pf, |
Harald Welte | bbd86b9f | 2005-08-09 20:23:11 -0700 | [diff] [blame] | 277 | struct nf_queue_handler *qh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | extern int nf_unregister_queue_handler(int pf); |
Harald Welte | bbd86b9f | 2005-08-09 20:23:11 -0700 | [diff] [blame] | 279 | extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | extern void nf_reinject(struct sk_buff *skb, |
| 281 | struct nf_info *info, |
| 282 | unsigned int verdict); |
| 283 | |
| 284 | extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); |
| 285 | extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); |
| 286 | |
| 287 | /* FIXME: Before cache is ever used, this must be implemented for real. */ |
| 288 | extern void nf_invalidate_cache(int pf); |
| 289 | |
Harald Welte | 089af26 | 2005-08-09 19:37:23 -0700 | [diff] [blame] | 290 | /* Call this before modifying an existing packet: ensures it is |
| 291 | modifiable and linear to the point you care about (writable_len). |
| 292 | Returns true or false. */ |
| 293 | extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); |
| 294 | |
Al Viro | 43bc0ca | 2006-11-14 21:43:23 -0800 | [diff] [blame] | 295 | static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) |
| 296 | { |
| 297 | __be32 diff[] = { ~from, to }; |
| 298 | |
| 299 | *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); |
| 300 | } |
| 301 | |
| 302 | static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to) |
| 303 | { |
| 304 | nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to); |
| 305 | } |
| 306 | |
| 307 | extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, |
| 308 | __be32 from, __be32 to, int pseudohdr); |
| 309 | |
| 310 | static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, |
| 311 | __be16 from, __be16 to, int pseudohdr) |
| 312 | { |
| 313 | nf_proto_csum_replace4(sum, skb, (__force __be32)from, |
| 314 | (__force __be32)to, pseudohdr); |
| 315 | } |
Patrick McHardy | 4cf411d | 2006-08-05 00:58:33 -0700 | [diff] [blame] | 316 | |
Patrick McHardy | bce8032 | 2006-04-06 14:18:09 -0700 | [diff] [blame] | 317 | struct nf_afinfo { |
| 318 | unsigned short family; |
Al Viro | b51655b | 2006-11-14 21:40:42 -0800 | [diff] [blame] | 319 | __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, |
Patrick McHardy | 422c346 | 2006-04-06 14:18:43 -0700 | [diff] [blame] | 320 | unsigned int dataoff, u_int8_t protocol); |
Patrick McHardy | bce8032 | 2006-04-06 14:18:09 -0700 | [diff] [blame] | 321 | void (*saveroute)(const struct sk_buff *skb, |
| 322 | struct nf_info *info); |
| 323 | int (*reroute)(struct sk_buff **skb, |
| 324 | const struct nf_info *info); |
| 325 | int route_key_size; |
Harald Welte | 2cc7d57 | 2005-08-09 19:42:34 -0700 | [diff] [blame] | 326 | }; |
| 327 | |
Patrick McHardy | bce8032 | 2006-04-06 14:18:09 -0700 | [diff] [blame] | 328 | extern struct nf_afinfo *nf_afinfo[]; |
| 329 | static inline struct nf_afinfo *nf_get_afinfo(unsigned short family) |
| 330 | { |
| 331 | return rcu_dereference(nf_afinfo[family]); |
| 332 | } |
Harald Welte | 2cc7d57 | 2005-08-09 19:42:34 -0700 | [diff] [blame] | 333 | |
Al Viro | b51655b | 2006-11-14 21:40:42 -0800 | [diff] [blame] | 334 | static inline __sum16 |
Patrick McHardy | 422c346 | 2006-04-06 14:18:43 -0700 | [diff] [blame] | 335 | nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, |
| 336 | u_int8_t protocol, unsigned short family) |
| 337 | { |
| 338 | struct nf_afinfo *afinfo; |
Al Viro | b51655b | 2006-11-14 21:40:42 -0800 | [diff] [blame] | 339 | __sum16 csum = 0; |
Patrick McHardy | 422c346 | 2006-04-06 14:18:43 -0700 | [diff] [blame] | 340 | |
| 341 | rcu_read_lock(); |
| 342 | afinfo = nf_get_afinfo(family); |
| 343 | if (afinfo) |
| 344 | csum = afinfo->checksum(skb, hook, dataoff, protocol); |
| 345 | rcu_read_unlock(); |
| 346 | return csum; |
| 347 | } |
| 348 | |
Patrick McHardy | bce8032 | 2006-04-06 14:18:09 -0700 | [diff] [blame] | 349 | extern int nf_register_afinfo(struct nf_afinfo *afinfo); |
| 350 | extern void nf_unregister_afinfo(struct nf_afinfo *afinfo); |
| 351 | |
| 352 | #define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info)) |
Harald Welte | 2cc7d57 | 2005-08-09 19:42:34 -0700 | [diff] [blame] | 353 | |
Patrick McHardy | eb9c7eb | 2006-01-06 23:06:30 -0800 | [diff] [blame] | 354 | #include <net/flow.h> |
| 355 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); |
| 356 | |
| 357 | static inline void |
| 358 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) |
| 359 | { |
Jozsef Kadlecsik | 5b1158e | 2006-12-02 22:07:13 -0800 | [diff] [blame] | 360 | #if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED) |
Patrick McHardy | eb9c7eb | 2006-01-06 23:06:30 -0800 | [diff] [blame] | 361 | void (*decodefn)(struct sk_buff *, struct flowi *); |
| 362 | |
| 363 | if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL) |
| 364 | decodefn(skb, fl); |
| 365 | #endif |
| 366 | } |
| 367 | |
Harald Welte | 608c8e4 | 2005-08-09 19:58:27 -0700 | [diff] [blame] | 368 | #ifdef CONFIG_PROC_FS |
| 369 | #include <linux/proc_fs.h> |
| 370 | extern struct proc_dir_entry *proc_net_netfilter; |
| 371 | #endif |
| 372 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | #else /* !CONFIG_NETFILTER */ |
| 374 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) |
Patrick McHardy | 48d5cad | 2006-02-15 15:10:22 -0800 | [diff] [blame] | 375 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) |
David S. Miller | f53b61d | 2006-01-07 12:50:27 -0800 | [diff] [blame] | 376 | static inline int nf_hook_thresh(int pf, unsigned int hook, |
| 377 | struct sk_buff **pskb, |
| 378 | struct net_device *indev, |
| 379 | struct net_device *outdev, |
Patrick McHardy | 48d5cad | 2006-02-15 15:10:22 -0800 | [diff] [blame] | 380 | int (*okfn)(struct sk_buff *), int thresh, |
| 381 | int cond) |
David S. Miller | f53b61d | 2006-01-07 12:50:27 -0800 | [diff] [blame] | 382 | { |
| 383 | return okfn(*pskb); |
| 384 | } |
| 385 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb, |
| 386 | struct net_device *indev, struct net_device *outdev, |
| 387 | int (*okfn)(struct sk_buff *)) |
| 388 | { |
Patrick McHardy | 9c92d34 | 2006-02-15 15:18:19 -0800 | [diff] [blame] | 389 | return 1; |
David S. Miller | f53b61d | 2006-01-07 12:50:27 -0800 | [diff] [blame] | 390 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} |
David S. Miller | f53b61d | 2006-01-07 12:50:27 -0800 | [diff] [blame] | 392 | struct flowi; |
Patrick McHardy | eb9c7eb | 2006-01-06 23:06:30 -0800 | [diff] [blame] | 393 | static inline void |
| 394 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | #endif /*CONFIG_NETFILTER*/ |
| 396 | |
| 397 | #endif /*__KERNEL__*/ |
| 398 | #endif /*__LINUX_NETFILTER_H*/ |