neighbour.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. #ifndef __LINUX_NEIGHBOUR_H
  2. #define __LINUX_NEIGHBOUR_H
  3. #include <linux/types.h>
  4. #include <linux/netlink.h>
  5. struct ndmsg {
  6. __u8 ndm_family;
  7. __u8 ndm_pad1;
  8. __u16 ndm_pad2;
  9. __s32 ndm_ifindex;
  10. __u16 ndm_state;
  11. __u8 ndm_flags;
  12. __u8 ndm_type;
  13. };
  14. enum {
  15. NDA_UNSPEC,
  16. NDA_DST,
  17. NDA_LLADDR,
  18. NDA_CACHEINFO,
  19. NDA_PROBES,
  20. __NDA_MAX
  21. };
  22. #define NDA_MAX (__NDA_MAX - 1)
  23. /*
  24. * Neighbor Cache Entry Flags
  25. */
  26. #define NTF_USE 0x01
  27. #define NTF_PROXY 0x08 /* == ATF_PUBL */
  28. #define NTF_ROUTER 0x80
  29. /*
  30. * Neighbor Cache Entry States.
  31. */
  32. #define NUD_INCOMPLETE 0x01
  33. #define NUD_REACHABLE 0x02
  34. #define NUD_STALE 0x04
  35. #define NUD_DELAY 0x08
  36. #define NUD_PROBE 0x10
  37. #define NUD_FAILED 0x20
  38. /* Dummy states */
  39. #define NUD_NOARP 0x40
  40. #define NUD_PERMANENT 0x80
  41. #define NUD_NONE 0x00
  42. /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change
  43. and make no address resolution or NUD.
  44. NUD_PERMANENT is also cannot be deleted by garbage collectors.
  45. */
  46. struct nda_cacheinfo {
  47. __u32 ndm_confirmed;
  48. __u32 ndm_used;
  49. __u32 ndm_updated;
  50. __u32 ndm_refcnt;
  51. };
  52. /*****************************************************************
  53. * Neighbour tables specific messages.
  54. *
  55. * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
  56. * NLM_F_DUMP flag set. Every neighbour table configuration is
  57. * spread over multiple messages to avoid running into message
  58. * size limits on systems with many interfaces. The first message
  59. * in the sequence transports all not device specific data such as
  60. * statistics, configuration, and the default parameter set.
  61. * This message is followed by 0..n messages carrying device
  62. * specific parameter sets.
  63. * Although the ordering should be sufficient, NDTA_NAME can be
  64. * used to identify sequences. The initial message can be identified
  65. * by checking for NDTA_CONFIG. The device specific messages do
  66. * not contain this TLV but have NDTPA_IFINDEX set to the
  67. * corresponding interface index.
  68. *
  69. * To change neighbour table attributes, send RTM_SETNEIGHTBL
  70. * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
  71. * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
  72. * otherwise. Device specific parameter sets can be changed by
  73. * setting NDTPA_IFINDEX to the interface index of the corresponding
  74. * device.
  75. ****/
  76. struct ndt_stats {
  77. __u64 ndts_allocs;
  78. __u64 ndts_destroys;
  79. __u64 ndts_hash_grows;
  80. __u64 ndts_res_failed;
  81. __u64 ndts_lookups;
  82. __u64 ndts_hits;
  83. __u64 ndts_rcv_probes_mcast;
  84. __u64 ndts_rcv_probes_ucast;
  85. __u64 ndts_periodic_gc_runs;
  86. __u64 ndts_forced_gc_runs;
  87. };
  88. enum {
  89. NDTPA_UNSPEC,
  90. NDTPA_IFINDEX, /* u32, unchangeable */
  91. NDTPA_REFCNT, /* u32, read-only */
  92. NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
  93. NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
  94. NDTPA_RETRANS_TIME, /* u64, msecs */
  95. NDTPA_GC_STALETIME, /* u64, msecs */
  96. NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
  97. NDTPA_QUEUE_LEN, /* u32 */
  98. NDTPA_APP_PROBES, /* u32 */
  99. NDTPA_UCAST_PROBES, /* u32 */
  100. NDTPA_MCAST_PROBES, /* u32 */
  101. NDTPA_ANYCAST_DELAY, /* u64, msecs */
  102. NDTPA_PROXY_DELAY, /* u64, msecs */
  103. NDTPA_PROXY_QLEN, /* u32 */
  104. NDTPA_LOCKTIME, /* u64, msecs */
  105. NDTPA_QUEUE_LENBYTES, /* u32 */
  106. __NDTPA_MAX
  107. };
  108. #define NDTPA_MAX (__NDTPA_MAX - 1)
  109. struct ndtmsg {
  110. __u8 ndtm_family;
  111. __u8 ndtm_pad1;
  112. __u16 ndtm_pad2;
  113. };
  114. struct ndt_config {
  115. __u16 ndtc_key_len;
  116. __u16 ndtc_entry_size;
  117. __u32 ndtc_entries;
  118. __u32 ndtc_last_flush; /* delta to now in msecs */
  119. __u32 ndtc_last_rand; /* delta to now in msecs */
  120. __u32 ndtc_hash_rnd;
  121. __u32 ndtc_hash_mask;
  122. __u32 ndtc_hash_chain_gc;
  123. __u32 ndtc_proxy_qlen;
  124. };
  125. enum {
  126. NDTA_UNSPEC,
  127. NDTA_NAME, /* char *, unchangeable */
  128. NDTA_THRESH1, /* u32 */
  129. NDTA_THRESH2, /* u32 */
  130. NDTA_THRESH3, /* u32 */
  131. NDTA_CONFIG, /* struct ndt_config, read-only */
  132. NDTA_PARMS, /* nested TLV NDTPA_* */
  133. NDTA_STATS, /* struct ndt_stats, read-only */
  134. NDTA_GC_INTERVAL, /* u64, msecs */
  135. __NDTA_MAX
  136. };
  137. #define NDTA_MAX (__NDTA_MAX - 1)
  138. #endif