netfilter_ipv4.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef __LINUX_IP_NETFILTER_H
  2. #define __LINUX_IP_NETFILTER_H
  3. /* IPv4-specific defines for netfilter.
  4. * (C)1998 Rusty Russell -- This code is GPL.
  5. */
  6. #include <linux/netfilter.h>
  7. /* only for userspace compatibility */
  8. #ifndef __KERNEL__
  9. /* IP Cache bits. */
  10. /* Src IP address. */
  11. #define NFC_IP_SRC 0x0001
  12. /* Dest IP address. */
  13. #define NFC_IP_DST 0x0002
  14. /* Input device. */
  15. #define NFC_IP_IF_IN 0x0004
  16. /* Output device. */
  17. #define NFC_IP_IF_OUT 0x0008
  18. /* TOS. */
  19. #define NFC_IP_TOS 0x0010
  20. /* Protocol. */
  21. #define NFC_IP_PROTO 0x0020
  22. /* IP options. */
  23. #define NFC_IP_OPTIONS 0x0040
  24. /* Frag & flags. */
  25. #define NFC_IP_FRAG 0x0080
  26. /* Per-protocol information: only matters if proto match. */
  27. /* TCP flags. */
  28. #define NFC_IP_TCPFLAGS 0x0100
  29. /* Source port. */
  30. #define NFC_IP_SRC_PT 0x0200
  31. /* Dest port. */
  32. #define NFC_IP_DST_PT 0x0400
  33. /* Something else about the proto */
  34. #define NFC_IP_PROTO_UNKNOWN 0x2000
  35. #endif /* ! __KERNEL__ */
  36. /* IP Hooks */
  37. /* After promisc drops, checksum checks. */
  38. #define NF_IP_PRE_ROUTING 0
  39. /* If the packet is destined for this box. */
  40. #define NF_IP_LOCAL_IN 1
  41. /* If the packet is destined for another interface. */
  42. #define NF_IP_FORWARD 2
  43. /* Packets coming from a local process. */
  44. #define NF_IP_LOCAL_OUT 3
  45. /* Packets about to hit the wire. */
  46. #define NF_IP_POST_ROUTING 4
  47. #define NF_IP_NUMHOOKS 5
  48. enum nf_ip_hook_priorities {
  49. NF_IP_PRI_FIRST = INT_MIN,
  50. NF_IP_PRI_CONNTRACK_DEFRAG = -400,
  51. NF_IP_PRI_RAW = -300,
  52. NF_IP_PRI_SELINUX_FIRST = -225,
  53. NF_IP_PRI_CONNTRACK = -200,
  54. NF_IP_PRI_MANGLE = -150,
  55. NF_IP_PRI_NAT_DST = -100,
  56. NF_IP_PRI_FILTER = 0,
  57. NF_IP_PRI_NAT_SRC = 100,
  58. NF_IP_PRI_SELINUX_LAST = 225,
  59. NF_IP_PRI_CONNTRACK_HELPER = INT_MAX - 2,
  60. NF_IP_PRI_NAT_SEQ_ADJUST = INT_MAX - 1,
  61. NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
  62. NF_IP_PRI_LAST = INT_MAX,
  63. };
  64. /* Arguments for setsockopt SOL_IP: */
  65. /* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */
  66. /* 2.2 firewalling (+ masq) went from 64 through 76 */
  67. /* 2.4 firewalling went 64 through 67. */
  68. #define SO_ORIGINAL_DST 80
  69. #ifdef __KERNEL__
  70. extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type);
  71. extern int ip_xfrm_me_harder(struct sk_buff **pskb);
  72. extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
  73. unsigned int dataoff, u_int8_t protocol);
  74. #endif /*__KERNEL__*/
  75. #endif /*__LINUX_IP_NETFILTER_H*/