nf_conntrack_expect.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * connection tracking expectations.
  3. */
  4. #ifndef _NF_CONNTRACK_EXPECT_H
  5. #define _NF_CONNTRACK_EXPECT_H
  6. #include <net/netfilter/nf_conntrack.h>
  7. extern struct list_head nf_conntrack_expect_list;
  8. extern struct kmem_cache *nf_conntrack_expect_cachep;
  9. extern const struct file_operations exp_file_ops;
  10. struct nf_conntrack_expect
  11. {
  12. /* Internal linked list (global expectation list) */
  13. struct list_head list;
  14. /* We expect this tuple, with the following mask */
  15. struct nf_conntrack_tuple tuple, mask;
  16. /* Function to call after setup and insertion */
  17. void (*expectfn)(struct nf_conn *new,
  18. struct nf_conntrack_expect *this);
  19. /* Helper to assign to new connection */
  20. struct nf_conntrack_helper *helper;
  21. /* The conntrack of the master connection */
  22. struct nf_conn *master;
  23. /* Timer function; deletes the expectation. */
  24. struct timer_list timeout;
  25. /* Usage count. */
  26. atomic_t use;
  27. /* Unique ID */
  28. unsigned int id;
  29. /* Flags */
  30. unsigned int flags;
  31. #ifdef CONFIG_NF_NAT_NEEDED
  32. __be32 saved_ip;
  33. /* This is the original per-proto part, used to map the
  34. * expected connection the way the recipient expects. */
  35. union nf_conntrack_man_proto saved_proto;
  36. /* Direction relative to the master connection. */
  37. enum ip_conntrack_dir dir;
  38. #endif
  39. };
  40. #define NF_CT_EXPECT_PERMANENT 0x1
  41. struct nf_conntrack_expect *
  42. __nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
  43. struct nf_conntrack_expect *
  44. nf_conntrack_expect_find_get(const struct nf_conntrack_tuple *tuple);
  45. struct nf_conntrack_expect *
  46. find_expectation(const struct nf_conntrack_tuple *tuple);
  47. void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
  48. void nf_ct_remove_expectations(struct nf_conn *ct);
  49. void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp);
  50. /* Allocate space for an expectation: this is mandatory before calling
  51. nf_conntrack_expect_related. You will have to call put afterwards. */
  52. struct nf_conntrack_expect *nf_conntrack_expect_alloc(struct nf_conn *me);
  53. void nf_conntrack_expect_init(struct nf_conntrack_expect *, int,
  54. union nf_conntrack_address *,
  55. union nf_conntrack_address *,
  56. u_int8_t, __be16 *, __be16 *);
  57. void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
  58. int nf_conntrack_expect_related(struct nf_conntrack_expect *expect);
  59. #endif /*_NF_CONNTRACK_EXPECT_H*/