neighbour.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. #define NTF_SELF 0x02
  30. #define NTF_MASTER 0x04
  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. __u32 ndm_confirmed;
  50. __u32 ndm_used;
  51. __u32 ndm_updated;
  52. __u32 ndm_refcnt;
  53. };
  54. /*****************************************************************
  55. * Neighbour tables specific messages.
  56. *
  57. * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
  58. * NLM_F_DUMP flag set. Every neighbour table configuration is
  59. * spread over multiple messages to avoid running into message
  60. * size limits on systems with many interfaces. The first message
  61. * in the sequence transports all not device specific data such as
  62. * statistics, configuration, and the default parameter set.
  63. * This message is followed by 0..n messages carrying device
  64. * specific parameter sets.
  65. * Although the ordering should be sufficient, NDTA_NAME can be
  66. * used to identify sequences. The initial message can be identified
  67. * by checking for NDTA_CONFIG. The device specific messages do
  68. * not contain this TLV but have NDTPA_IFINDEX set to the
  69. * corresponding interface index.
  70. *
  71. * To change neighbour table attributes, send RTM_SETNEIGHTBL
  72. * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
  73. * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
  74. * otherwise. Device specific parameter sets can be changed by
  75. * setting NDTPA_IFINDEX to the interface index of the corresponding
  76. * device.
  77. ****/
  78. struct ndt_stats {
  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_QUEUE_LENBYTES, /* u32 */
  108. __NDTPA_MAX
  109. };
  110. #define NDTPA_MAX (__NDTPA_MAX - 1)
  111. struct ndtmsg {
  112. __u8 ndtm_family;
  113. __u8 ndtm_pad1;
  114. __u16 ndtm_pad2;
  115. };
  116. struct ndt_config {
  117. __u16 ndtc_key_len;
  118. __u16 ndtc_entry_size;
  119. __u32 ndtc_entries;
  120. __u32 ndtc_last_flush; /* delta to now in msecs */
  121. __u32 ndtc_last_rand; /* delta to now in msecs */
  122. __u32 ndtc_hash_rnd;
  123. __u32 ndtc_hash_mask;
  124. __u32 ndtc_hash_chain_gc;
  125. __u32 ndtc_proxy_qlen;
  126. };
  127. enum {
  128. NDTA_UNSPEC,
  129. NDTA_NAME, /* char *, unchangeable */
  130. NDTA_THRESH1, /* u32 */
  131. NDTA_THRESH2, /* u32 */
  132. NDTA_THRESH3, /* u32 */
  133. NDTA_CONFIG, /* struct ndt_config, read-only */
  134. NDTA_PARMS, /* nested TLV NDTPA_* */
  135. NDTA_STATS, /* struct ndt_stats, read-only */
  136. NDTA_GC_INTERVAL, /* u64, msecs */
  137. __NDTA_MAX
  138. };
  139. #define NDTA_MAX (__NDTA_MAX - 1)
  140. #endif