logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

nfnetlink_queue.h (3585B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _NFNETLINK_QUEUE_H
  3. #define _NFNETLINK_QUEUE_H
  4. #include <linux/types.h>
  5. #include <linux/netfilter/nfnetlink.h>
  6. enum nfqnl_msg_types {
  7. NFQNL_MSG_PACKET, /* packet from kernel to userspace */
  8. NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */
  9. NFQNL_MSG_CONFIG, /* connect to a particular queue */
  10. NFQNL_MSG_VERDICT_BATCH, /* batchv from userspace to kernel */
  11. NFQNL_MSG_MAX
  12. };
  13. struct nfqnl_msg_packet_hdr {
  14. __be32 packet_id; /* unique ID of packet in queue */
  15. __be16 hw_protocol; /* hw protocol (network order) */
  16. __u8 hook; /* netfilter hook */
  17. } __attribute__ ((packed));
  18. struct nfqnl_msg_packet_hw {
  19. __be16 hw_addrlen;
  20. __u16 _pad;
  21. __u8 hw_addr[8];
  22. };
  23. struct nfqnl_msg_packet_timestamp {
  24. __aligned_be64 sec;
  25. __aligned_be64 usec;
  26. };
  27. enum nfqnl_vlan_attr {
  28. NFQA_VLAN_UNSPEC,
  29. NFQA_VLAN_PROTO, /* __be16 skb vlan_proto */
  30. NFQA_VLAN_TCI, /* __be16 skb htons(vlan_tci) */
  31. __NFQA_VLAN_MAX,
  32. };
  33. #define NFQA_VLAN_MAX (__NFQA_VLAN_MAX - 1)
  34. enum nfqnl_attr_type {
  35. NFQA_UNSPEC,
  36. NFQA_PACKET_HDR,
  37. NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */
  38. NFQA_MARK, /* __u32 nfmark */
  39. NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */
  40. NFQA_IFINDEX_INDEV, /* __u32 ifindex */
  41. NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */
  42. NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
  43. NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
  44. NFQA_HWADDR, /* nfqnl_msg_packet_hw */
  45. NFQA_PAYLOAD, /* opaque data payload */
  46. NFQA_CT, /* nfnetlink_conntrack.h */
  47. NFQA_CT_INFO, /* enum ip_conntrack_info */
  48. NFQA_CAP_LEN, /* __u32 length of captured packet */
  49. NFQA_SKB_INFO, /* __u32 skb meta information */
  50. NFQA_EXP, /* nfnetlink_conntrack.h */
  51. NFQA_UID, /* __u32 sk uid */
  52. NFQA_GID, /* __u32 sk gid */
  53. NFQA_SECCTX, /* security context string */
  54. NFQA_VLAN, /* nested attribute: packet vlan info */
  55. NFQA_L2HDR, /* full L2 header */
  56. NFQA_PRIORITY, /* skb->priority */
  57. NFQA_CGROUP_CLASSID, /* __u32 cgroup classid */
  58. __NFQA_MAX
  59. };
  60. #define NFQA_MAX (__NFQA_MAX - 1)
  61. struct nfqnl_msg_verdict_hdr {
  62. __be32 verdict;
  63. __be32 id;
  64. };
  65. enum nfqnl_msg_config_cmds {
  66. NFQNL_CFG_CMD_NONE,
  67. NFQNL_CFG_CMD_BIND,
  68. NFQNL_CFG_CMD_UNBIND,
  69. NFQNL_CFG_CMD_PF_BIND,
  70. NFQNL_CFG_CMD_PF_UNBIND,
  71. };
  72. struct nfqnl_msg_config_cmd {
  73. __u8 command; /* nfqnl_msg_config_cmds */
  74. __u8 _pad;
  75. __be16 pf; /* AF_xxx for PF_[UN]BIND */
  76. };
  77. enum nfqnl_config_mode {
  78. NFQNL_COPY_NONE,
  79. NFQNL_COPY_META,
  80. NFQNL_COPY_PACKET,
  81. };
  82. struct nfqnl_msg_config_params {
  83. __be32 copy_range;
  84. __u8 copy_mode; /* enum nfqnl_config_mode */
  85. } __attribute__ ((packed));
  86. enum nfqnl_attr_config {
  87. NFQA_CFG_UNSPEC,
  88. NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */
  89. NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */
  90. NFQA_CFG_QUEUE_MAXLEN, /* __u32 */
  91. NFQA_CFG_MASK, /* identify which flags to change */
  92. NFQA_CFG_FLAGS, /* value of these flags (__u32) */
  93. __NFQA_CFG_MAX
  94. };
  95. #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
  96. /* Flags for NFQA_CFG_FLAGS */
  97. #define NFQA_CFG_F_FAIL_OPEN (1 << 0)
  98. #define NFQA_CFG_F_CONNTRACK (1 << 1)
  99. #define NFQA_CFG_F_GSO (1 << 2)
  100. #define NFQA_CFG_F_UID_GID (1 << 3)
  101. #define NFQA_CFG_F_SECCTX (1 << 4)
  102. #define NFQA_CFG_F_MAX (1 << 5)
  103. /* flags for NFQA_SKB_INFO */
  104. /* packet appears to have wrong checksums, but they are ok */
  105. #define NFQA_SKB_CSUMNOTREADY (1 << 0)
  106. /* packet is GSO (i.e., exceeds device mtu) */
  107. #define NFQA_SKB_GSO (1 << 1)
  108. /* csum not validated (incoming device doesn't support hw checksum, etc.) */
  109. #define NFQA_SKB_CSUM_NOTVERIFIED (1 << 2)
  110. #endif /* _NFNETLINK_QUEUE_H */