neighbour.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #ifndef __LINUX_NEIGHBOUR_H
  2. #define __LINUX_NEIGHBOUR_H
  3. #include <linux/netlink.h>
  4. struct ndmsg
  5. {
  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. {
  16. NDA_UNSPEC,
  17. NDA_DST,
  18. NDA_LLADDR,
  19. NDA_CACHEINFO,
  20. NDA_PROBES,
  21. __NDA_MAX
  22. };
  23. #define NDA_MAX (__NDA_MAX - 1)
  24. /*
  25. * Neighbor Cache Entry Flags
  26. */
  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. {
  48. __u32 ndm_confirmed;
  49. __u32 ndm_used;
  50. __u32 ndm_updated;
  51. __u32 ndm_refcnt;
  52. };
  53. /*****************************************************************
  54. * Neighbour tables specific messages.
  55. *
  56. * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
  57. * NLM_F_DUMP flag set. Every neighbour table configuration is
  58. * spread over multiple messages to avoid running into message
  59. * size limits on systems with many interfaces. The first message
  60. * in the sequence transports all not device specific data such as
  61. * statistics, configuration, and the default parameter set.
  62. * This message is followed by 0..n messages carrying device
  63. * specific parameter sets.
  64. * Although the ordering should be sufficient, NDTA_NAME can be
  65. * used to identify sequences. The initial message can be identified
  66. * by checking for NDTA_CONFIG. The device specific messages do
  67. * not contain this TLV but have NDTPA_IFINDEX set to the
  68. * corresponding interface index.
  69. *
  70. * To change neighbour table attributes, send RTM_SETNEIGHTBL
  71. * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
  72. * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
  73. * otherwise. Device specific parameter sets can be changed by
  74. * setting NDTPA_IFINDEX to the interface index of the corresponding
  75. * device.
  76. ****/
  77. struct ndt_stats
  78. {
  79. __u64 ndts_allocs;
  80. __u64 ndts_destroys;
  81. __u64 ndts_hash_grows;
  82. __u64 ndts_res_failed;
  83. __u64 ndts_lookups;
  84. __u64 ndts_hits;
  85. __u64 ndts_rcv_probes_mcast;
  86. __u64 ndts_rcv_probes_ucast;
  87. __u64 ndts_periodic_gc_runs;
  88. __u64 ndts_forced_gc_runs;
  89. };
  90. enum {
  91. NDTPA_UNSPEC,
  92. NDTPA_IFINDEX, /* u32, unchangeable */
  93. NDTPA_REFCNT, /* u32, read-only */
  94. NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
  95. NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
  96. NDTPA_RETRANS_TIME, /* u64, msecs */
  97. NDTPA_GC_STALETIME, /* u64, msecs */
  98. NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
  99. NDTPA_QUEUE_LEN, /* u32 */
  100. NDTPA_APP_PROBES, /* u32 */
  101. NDTPA_UCAST_PROBES, /* u32 */
  102. NDTPA_MCAST_PROBES, /* u32 */
  103. NDTPA_ANYCAST_DELAY, /* u64, msecs */
  104. NDTPA_PROXY_DELAY, /* u64, msecs */
  105. NDTPA_PROXY_QLEN, /* u32 */
  106. NDTPA_LOCKTIME, /* u64, msecs */
  107. __NDTPA_MAX
  108. };
  109. #define NDTPA_MAX (__NDTPA_MAX - 1)
  110. struct ndtmsg
  111. {
  112. __u8 ndtm_family;
  113. __u8 ndtm_pad1;
  114. __u16 ndtm_pad2;
  115. };
  116. struct ndt_config
  117. {
  118. __u16 ndtc_key_len;
  119. __u16 ndtc_entry_size;
  120. __u32 ndtc_entries;
  121. __u32 ndtc_last_flush; /* delta to now in msecs */
  122. __u32 ndtc_last_rand; /* delta to now in msecs */
  123. __u32 ndtc_hash_rnd;
  124. __u32 ndtc_hash_mask;
  125. __u32 ndtc_hash_chain_gc;
  126. __u32 ndtc_proxy_qlen;
  127. };
  128. enum {
  129. NDTA_UNSPEC,
  130. NDTA_NAME, /* char *, unchangeable */
  131. NDTA_THRESH1, /* u32 */
  132. NDTA_THRESH2, /* u32 */
  133. NDTA_THRESH3, /* u32 */
  134. NDTA_CONFIG, /* struct ndt_config, read-only */
  135. NDTA_PARMS, /* nested TLV NDTPA_* */
  136. NDTA_STATS, /* struct ndt_stats, read-only */
  137. NDTA_GC_INTERVAL, /* u64, msecs */
  138. __NDTA_MAX
  139. };
  140. #define NDTA_MAX (__NDTA_MAX - 1)
  141. #endif