neighbour.h 3.9 KB

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