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_osf.h (2665B)


  1. #ifndef _NF_OSF_H
  2. #define _NF_OSF_H
  3. #include <linux/types.h>
  4. #include <linux/ip.h>
  5. #include <linux/tcp.h>
  6. #define MAXGENRELEN 32
  7. #define NF_OSF_GENRE (1 << 0)
  8. #define NF_OSF_TTL (1 << 1)
  9. #define NF_OSF_LOG (1 << 2)
  10. #define NF_OSF_INVERT (1 << 3)
  11. #define NF_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */
  12. #define NF_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */
  13. #define NF_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */
  14. #define NF_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */
  15. /* Check if ip TTL is less than fingerprint one */
  16. #define NF_OSF_TTL_LESS 1
  17. /* Do not compare ip and fingerprint TTL at all */
  18. #define NF_OSF_TTL_NOCHECK 2
  19. #define NF_OSF_FLAGMASK (NF_OSF_GENRE | NF_OSF_TTL | \
  20. NF_OSF_LOG | NF_OSF_INVERT)
  21. /* Wildcard MSS (kind of).
  22. * It is used to implement a state machine for the different wildcard values
  23. * of the MSS and window sizes.
  24. */
  25. struct nf_osf_wc {
  26. __u32 wc;
  27. __u32 val;
  28. };
  29. /* This struct represents IANA options
  30. * http://www.iana.org/assignments/tcp-parameters
  31. */
  32. struct nf_osf_opt {
  33. __u16 kind, length;
  34. struct nf_osf_wc wc;
  35. };
  36. struct nf_osf_info {
  37. char genre[MAXGENRELEN];
  38. __u32 len;
  39. __u32 flags;
  40. __u32 loglevel;
  41. __u32 ttl;
  42. };
  43. struct nf_osf_user_finger {
  44. struct nf_osf_wc wss;
  45. __u8 ttl, df;
  46. __u16 ss, mss;
  47. __u16 opt_num;
  48. char genre[MAXGENRELEN];
  49. char version[MAXGENRELEN];
  50. char subtype[MAXGENRELEN];
  51. /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */
  52. struct nf_osf_opt opt[MAX_IPOPTLEN];
  53. };
  54. struct nf_osf_nlmsg {
  55. struct nf_osf_user_finger f;
  56. struct iphdr ip;
  57. struct tcphdr tcp;
  58. };
  59. /* Defines for IANA option kinds */
  60. enum iana_options {
  61. OSFOPT_EOL = 0, /* End of options */
  62. OSFOPT_NOP, /* NOP */
  63. OSFOPT_MSS, /* Maximum segment size */
  64. OSFOPT_WSO, /* Window scale option */
  65. OSFOPT_SACKP, /* SACK permitted */
  66. OSFOPT_SACK, /* SACK */
  67. OSFOPT_ECHO,
  68. OSFOPT_ECHOREPLY,
  69. OSFOPT_TS, /* Timestamp option */
  70. OSFOPT_POCP, /* Partial Order Connection Permitted */
  71. OSFOPT_POSP, /* Partial Order Service Profile */
  72. /* Others are not used in the current OSF */
  73. OSFOPT_EMPTY = 255,
  74. };
  75. /* Initial window size option state machine: multiple of mss, mtu or
  76. * plain numeric value. Can also be made as plain numeric value which
  77. * is not a multiple of specified value.
  78. */
  79. enum nf_osf_window_size_options {
  80. OSF_WSS_PLAIN = 0,
  81. OSF_WSS_MSS,
  82. OSF_WSS_MTU,
  83. OSF_WSS_MODULO,
  84. OSF_WSS_MAX,
  85. };
  86. enum nf_osf_attr_type {
  87. OSF_ATTR_UNSPEC,
  88. OSF_ATTR_FINGER,
  89. OSF_ATTR_MAX,
  90. };
  91. /*
  92. * Add/remove fingerprint from the kernel.
  93. */
  94. enum nf_osf_msg_types {
  95. OSF_MSG_ADD,
  96. OSF_MSG_REMOVE,
  97. OSF_MSG_MAX,
  98. };
  99. #endif /* _NF_OSF_H */