Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _IP_CONNTRACK_H |
| 2 | #define _IP_CONNTRACK_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 4 | #include <linux/netfilter/nf_conntrack_common.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | |
| 6 | #ifdef __KERNEL__ |
| 7 | #include <linux/config.h> |
| 8 | #include <linux/netfilter_ipv4/ip_conntrack_tuple.h> |
| 9 | #include <linux/bitops.h> |
| 10 | #include <linux/compiler.h> |
| 11 | #include <asm/atomic.h> |
| 12 | |
| 13 | #include <linux/netfilter_ipv4/ip_conntrack_tcp.h> |
| 14 | #include <linux/netfilter_ipv4/ip_conntrack_icmp.h> |
Harald Welte | 926b50f | 2005-09-19 15:33:08 -0700 | [diff] [blame] | 15 | #include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/netfilter_ipv4/ip_conntrack_sctp.h> |
| 17 | |
| 18 | /* per conntrack: protocol private data */ |
| 19 | union ip_conntrack_proto { |
| 20 | /* insert conntrack proto private data here */ |
Harald Welte | 926b50f | 2005-09-19 15:33:08 -0700 | [diff] [blame] | 21 | struct ip_ct_gre gre; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | struct ip_ct_sctp sctp; |
| 23 | struct ip_ct_tcp tcp; |
| 24 | struct ip_ct_icmp icmp; |
| 25 | }; |
| 26 | |
| 27 | union ip_conntrack_expect_proto { |
| 28 | /* insert expect proto private data here */ |
| 29 | }; |
| 30 | |
| 31 | /* Add protocol helper include file here */ |
Jing Min Zhao | 5e35941d | 2006-03-20 23:41:17 -0800 | [diff] [blame] | 32 | #include <linux/netfilter_ipv4/ip_conntrack_h323.h> |
Harald Welte | 926b50f | 2005-09-19 15:33:08 -0700 | [diff] [blame] | 33 | #include <linux/netfilter_ipv4/ip_conntrack_pptp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include <linux/netfilter_ipv4/ip_conntrack_amanda.h> |
| 35 | #include <linux/netfilter_ipv4/ip_conntrack_ftp.h> |
| 36 | #include <linux/netfilter_ipv4/ip_conntrack_irc.h> |
| 37 | |
| 38 | /* per conntrack: application helper private data */ |
| 39 | union ip_conntrack_help { |
| 40 | /* insert conntrack helper private data (master) here */ |
Jing Min Zhao | 5e35941d | 2006-03-20 23:41:17 -0800 | [diff] [blame] | 41 | struct ip_ct_h323_master ct_h323_info; |
Harald Welte | 926b50f | 2005-09-19 15:33:08 -0700 | [diff] [blame] | 42 | struct ip_ct_pptp_master ct_pptp_info; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | struct ip_ct_ftp_master ct_ftp_info; |
| 44 | struct ip_ct_irc_master ct_irc_info; |
| 45 | }; |
| 46 | |
| 47 | #ifdef CONFIG_IP_NF_NAT_NEEDED |
| 48 | #include <linux/netfilter_ipv4/ip_nat.h> |
Harald Welte | 926b50f | 2005-09-19 15:33:08 -0700 | [diff] [blame] | 49 | #include <linux/netfilter_ipv4/ip_nat_pptp.h> |
| 50 | |
| 51 | /* per conntrack: nat application helper private data */ |
| 52 | union ip_conntrack_nat_help { |
| 53 | /* insert nat helper private data here */ |
| 54 | struct ip_nat_pptp nat_pptp_info; |
| 55 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #endif |
| 57 | |
| 58 | #include <linux/types.h> |
| 59 | #include <linux/skbuff.h> |
| 60 | |
| 61 | #ifdef CONFIG_NETFILTER_DEBUG |
| 62 | #define IP_NF_ASSERT(x) \ |
| 63 | do { \ |
| 64 | if (!(x)) \ |
| 65 | /* Wooah! I'm tripping my conntrack in a frenzy of \ |
| 66 | netplay... */ \ |
| 67 | printk("NF_IP_ASSERT: %s:%i(%s)\n", \ |
| 68 | __FILE__, __LINE__, __FUNCTION__); \ |
| 69 | } while(0) |
| 70 | #else |
| 71 | #define IP_NF_ASSERT(x) |
| 72 | #endif |
| 73 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | struct ip_conntrack_helper; |
| 75 | |
| 76 | struct ip_conntrack |
| 77 | { |
| 78 | /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, |
| 79 | plus 1 for any connection(s) we are `master' for */ |
| 80 | struct nf_conntrack ct_general; |
| 81 | |
| 82 | /* Have we seen traffic both ways yet? (bitset) */ |
| 83 | unsigned long status; |
| 84 | |
| 85 | /* Timer function; drops refcnt when it goes off. */ |
| 86 | struct timer_list timeout; |
| 87 | |
| 88 | #ifdef CONFIG_IP_NF_CT_ACCT |
| 89 | /* Accounting Information (same cache line as other written members) */ |
| 90 | struct ip_conntrack_counter counters[IP_CT_DIR_MAX]; |
| 91 | #endif |
| 92 | /* If we were expected by an expectation, this will be it */ |
| 93 | struct ip_conntrack *master; |
| 94 | |
| 95 | /* Current number of expected connections */ |
| 96 | unsigned int expecting; |
| 97 | |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 98 | /* Unique ID that identifies this conntrack*/ |
| 99 | unsigned int id; |
| 100 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | /* Helper, if any. */ |
| 102 | struct ip_conntrack_helper *helper; |
| 103 | |
| 104 | /* Storage reserved for other modules: */ |
| 105 | union ip_conntrack_proto proto; |
| 106 | |
| 107 | union ip_conntrack_help help; |
| 108 | |
| 109 | #ifdef CONFIG_IP_NF_NAT_NEEDED |
| 110 | struct { |
| 111 | struct ip_nat_info info; |
Harald Welte | 926b50f | 2005-09-19 15:33:08 -0700 | [diff] [blame] | 112 | union ip_conntrack_nat_help help; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | #if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ |
| 114 | defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) |
| 115 | int masq_index; |
| 116 | #endif |
| 117 | } nat; |
| 118 | #endif /* CONFIG_IP_NF_NAT_NEEDED */ |
| 119 | |
| 120 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) |
Harald Welte | bf3a46a | 2005-08-09 19:22:01 -0700 | [diff] [blame] | 121 | u_int32_t mark; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | #endif |
| 123 | |
| 124 | /* Traversed often, so hopefully in different cacheline to top */ |
| 125 | /* These are my tuples; original and reply */ |
| 126 | struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; |
| 127 | }; |
| 128 | |
| 129 | struct ip_conntrack_expect |
| 130 | { |
| 131 | /* Internal linked list (global expectation list) */ |
| 132 | struct list_head list; |
| 133 | |
| 134 | /* We expect this tuple, with the following mask */ |
| 135 | struct ip_conntrack_tuple tuple, mask; |
| 136 | |
| 137 | /* Function to call after setup and insertion */ |
| 138 | void (*expectfn)(struct ip_conntrack *new, |
| 139 | struct ip_conntrack_expect *this); |
| 140 | |
| 141 | /* The conntrack of the master connection */ |
| 142 | struct ip_conntrack *master; |
| 143 | |
| 144 | /* Timer function; deletes the expectation. */ |
| 145 | struct timer_list timeout; |
| 146 | |
Rusty Russell | 4acdbdb | 2005-07-21 13:14:46 -0700 | [diff] [blame] | 147 | /* Usage count. */ |
| 148 | atomic_t use; |
| 149 | |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 150 | /* Unique ID */ |
| 151 | unsigned int id; |
| 152 | |
Patrick McHardy | 2248bcf | 2005-09-06 15:06:42 -0700 | [diff] [blame] | 153 | /* Flags */ |
| 154 | unsigned int flags; |
| 155 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | #ifdef CONFIG_IP_NF_NAT_NEEDED |
| 157 | /* This is the original per-proto part, used to map the |
| 158 | * expected connection the way the recipient expects. */ |
| 159 | union ip_conntrack_manip_proto saved_proto; |
| 160 | /* Direction relative to the master connection. */ |
| 161 | enum ip_conntrack_dir dir; |
| 162 | #endif |
| 163 | }; |
| 164 | |
Patrick McHardy | 2248bcf | 2005-09-06 15:06:42 -0700 | [diff] [blame] | 165 | #define IP_CT_EXPECT_PERMANENT 0x1 |
| 166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | static inline struct ip_conntrack * |
| 168 | tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash) |
| 169 | { |
| 170 | return container_of(hash, struct ip_conntrack, |
| 171 | tuplehash[hash->tuple.dst.dir]); |
| 172 | } |
| 173 | |
| 174 | /* get master conntrack via master expectation */ |
| 175 | #define master_ct(conntr) (conntr->master) |
| 176 | |
| 177 | /* Alter reply tuple (maybe alter helper). */ |
| 178 | extern void |
| 179 | ip_conntrack_alter_reply(struct ip_conntrack *conntrack, |
| 180 | const struct ip_conntrack_tuple *newreply); |
| 181 | |
| 182 | /* Is this tuple taken? (ignoring any belonging to the given |
| 183 | conntrack). */ |
| 184 | extern int |
| 185 | ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple, |
| 186 | const struct ip_conntrack *ignored_conntrack); |
| 187 | |
| 188 | /* Return conntrack_info and tuple hash for given skb. */ |
| 189 | static inline struct ip_conntrack * |
| 190 | ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo) |
| 191 | { |
| 192 | *ctinfo = skb->nfctinfo; |
| 193 | return (struct ip_conntrack *)skb->nfct; |
| 194 | } |
| 195 | |
| 196 | /* decrement reference count on a conntrack */ |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 197 | static inline void |
| 198 | ip_conntrack_put(struct ip_conntrack *ct) |
| 199 | { |
| 200 | IP_NF_ASSERT(ct); |
| 201 | nf_conntrack_put(&ct->ct_general); |
| 202 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | extern int invert_tuplepr(struct ip_conntrack_tuple *inverse, |
| 205 | const struct ip_conntrack_tuple *orig); |
| 206 | |
Harald Welte | 1dfbab5 | 2005-09-22 23:46:57 -0700 | [diff] [blame] | 207 | extern void __ip_ct_refresh_acct(struct ip_conntrack *ct, |
| 208 | enum ip_conntrack_info ctinfo, |
| 209 | const struct sk_buff *skb, |
| 210 | unsigned long extra_jiffies, |
| 211 | int do_acct); |
| 212 | |
| 213 | /* Refresh conntrack for this many jiffies and do accounting */ |
| 214 | static inline void ip_ct_refresh_acct(struct ip_conntrack *ct, |
| 215 | enum ip_conntrack_info ctinfo, |
| 216 | const struct sk_buff *skb, |
| 217 | unsigned long extra_jiffies) |
| 218 | { |
| 219 | __ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1); |
| 220 | } |
| 221 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | /* Refresh conntrack for this many jiffies */ |
Harald Welte | 1dfbab5 | 2005-09-22 23:46:57 -0700 | [diff] [blame] | 223 | static inline void ip_ct_refresh(struct ip_conntrack *ct, |
| 224 | const struct sk_buff *skb, |
| 225 | unsigned long extra_jiffies) |
| 226 | { |
| 227 | __ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0); |
| 228 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | |
| 230 | /* These are for NAT. Icky. */ |
| 231 | /* Update TCP window tracking data when NAT mangles the packet */ |
| 232 | extern void ip_conntrack_tcp_update(struct sk_buff *skb, |
| 233 | struct ip_conntrack *conntrack, |
| 234 | enum ip_conntrack_dir dir); |
| 235 | |
| 236 | /* Call me when a conntrack is destroyed. */ |
| 237 | extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack); |
| 238 | |
| 239 | /* Fake conntrack entry for untracked connections */ |
| 240 | extern struct ip_conntrack ip_conntrack_untracked; |
| 241 | |
| 242 | /* Returns new sk_buff, or NULL */ |
| 243 | struct sk_buff * |
| 244 | ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user); |
| 245 | |
| 246 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ |
| 247 | extern void |
| 248 | ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data), |
| 249 | void *data); |
| 250 | |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 251 | extern struct ip_conntrack_helper * |
| 252 | __ip_conntrack_helper_find_byname(const char *); |
| 253 | extern struct ip_conntrack_helper * |
| 254 | ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple); |
| 255 | extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper); |
| 256 | |
| 257 | extern struct ip_conntrack_protocol * |
| 258 | __ip_conntrack_proto_find(u_int8_t protocol); |
| 259 | extern struct ip_conntrack_protocol * |
| 260 | ip_conntrack_proto_find_get(u_int8_t protocol); |
| 261 | extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto); |
| 262 | |
| 263 | extern void ip_ct_remove_expectations(struct ip_conntrack *ct); |
| 264 | |
| 265 | extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *, |
| 266 | struct ip_conntrack_tuple *); |
| 267 | |
| 268 | extern void ip_conntrack_free(struct ip_conntrack *ct); |
| 269 | |
| 270 | extern void ip_conntrack_hash_insert(struct ip_conntrack *ct); |
| 271 | |
| 272 | extern struct ip_conntrack_expect * |
| 273 | __ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); |
| 274 | |
| 275 | extern struct ip_conntrack_expect * |
Patrick McHardy | a41bc00 | 2005-09-19 15:35:31 -0700 | [diff] [blame] | 276 | ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 277 | |
| 278 | extern struct ip_conntrack_tuple_hash * |
| 279 | __ip_conntrack_find(const struct ip_conntrack_tuple *tuple, |
| 280 | const struct ip_conntrack *ignored_conntrack); |
| 281 | |
| 282 | extern void ip_conntrack_flush(void); |
| 283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | /* It's confirmed if it is, or has been in the hash table. */ |
| 285 | static inline int is_confirmed(struct ip_conntrack *ct) |
| 286 | { |
| 287 | return test_bit(IPS_CONFIRMED_BIT, &ct->status); |
| 288 | } |
| 289 | |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 290 | static inline int is_dying(struct ip_conntrack *ct) |
| 291 | { |
| 292 | return test_bit(IPS_DYING_BIT, &ct->status); |
| 293 | } |
| 294 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | extern unsigned int ip_conntrack_htable_size; |
| 296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) |
| 298 | |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 299 | #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS |
| 300 | #include <linux/notifier.h> |
Patrick McHardy | a86888b | 2005-08-09 20:02:13 -0700 | [diff] [blame] | 301 | #include <linux/interrupt.h> |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 302 | |
| 303 | struct ip_conntrack_ecache { |
| 304 | struct ip_conntrack *ct; |
| 305 | unsigned int events; |
| 306 | }; |
| 307 | DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache); |
| 308 | |
| 309 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x) |
| 310 | |
Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame^] | 311 | extern struct atomic_notifier_head ip_conntrack_chain; |
| 312 | extern struct atomic_notifier_head ip_conntrack_expect_chain; |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 313 | |
| 314 | static inline int ip_conntrack_register_notifier(struct notifier_block *nb) |
| 315 | { |
Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame^] | 316 | return atomic_notifier_chain_register(&ip_conntrack_chain, nb); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb) |
| 320 | { |
Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame^] | 321 | return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | static inline int |
| 325 | ip_conntrack_expect_register_notifier(struct notifier_block *nb) |
| 326 | { |
Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame^] | 327 | return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | static inline int |
| 331 | ip_conntrack_expect_unregister_notifier(struct notifier_block *nb) |
| 332 | { |
Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame^] | 333 | return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain, |
| 334 | nb); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 335 | } |
| 336 | |
Patrick McHardy | a86888b | 2005-08-09 20:02:13 -0700 | [diff] [blame] | 337 | extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct); |
| 338 | extern void __ip_ct_event_cache_init(struct ip_conntrack *ct); |
| 339 | |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 340 | static inline void |
| 341 | ip_conntrack_event_cache(enum ip_conntrack_events event, |
| 342 | const struct sk_buff *skb) |
| 343 | { |
Patrick McHardy | a86888b | 2005-08-09 20:02:13 -0700 | [diff] [blame] | 344 | struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct; |
| 345 | struct ip_conntrack_ecache *ecache; |
| 346 | |
| 347 | local_bh_disable(); |
| 348 | ecache = &__get_cpu_var(ip_conntrack_ecache); |
| 349 | if (ct != ecache->ct) |
| 350 | __ip_ct_event_cache_init(ct); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 351 | ecache->events |= event; |
Patrick McHardy | a86888b | 2005-08-09 20:02:13 -0700 | [diff] [blame] | 352 | local_bh_enable(); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 353 | } |
| 354 | |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 355 | static inline void ip_conntrack_event(enum ip_conntrack_events event, |
| 356 | struct ip_conntrack *ct) |
| 357 | { |
| 358 | if (is_confirmed(ct) && !is_dying(ct)) |
Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame^] | 359 | atomic_notifier_call_chain(&ip_conntrack_chain, event, ct); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | static inline void |
| 363 | ip_conntrack_expect_event(enum ip_conntrack_expect_events event, |
| 364 | struct ip_conntrack_expect *exp) |
| 365 | { |
Alan Stern | e041c68 | 2006-03-27 01:16:30 -0800 | [diff] [blame^] | 366 | atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp); |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 367 | } |
| 368 | #else /* CONFIG_IP_NF_CONNTRACK_EVENTS */ |
| 369 | static inline void ip_conntrack_event_cache(enum ip_conntrack_events event, |
| 370 | const struct sk_buff *skb) {} |
| 371 | static inline void ip_conntrack_event(enum ip_conntrack_events event, |
| 372 | struct ip_conntrack *ct) {} |
Patrick McHardy | a86888b | 2005-08-09 20:02:13 -0700 | [diff] [blame] | 373 | static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {} |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 374 | static inline void |
| 375 | ip_conntrack_expect_event(enum ip_conntrack_expect_events event, |
| 376 | struct ip_conntrack_expect *exp) {} |
| 377 | #endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */ |
| 378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | #ifdef CONFIG_IP_NF_NAT_NEEDED |
| 380 | static inline int ip_nat_initialized(struct ip_conntrack *conntrack, |
| 381 | enum ip_nat_manip_type manip) |
| 382 | { |
| 383 | if (manip == IP_NAT_MANIP_SRC) |
| 384 | return test_bit(IPS_SRC_NAT_DONE_BIT, &conntrack->status); |
| 385 | return test_bit(IPS_DST_NAT_DONE_BIT, &conntrack->status); |
| 386 | } |
| 387 | #endif /* CONFIG_IP_NF_NAT_NEEDED */ |
| 388 | |
| 389 | #endif /* __KERNEL__ */ |
| 390 | #endif /* _IP_CONNTRACK_H */ |