neighbour.h 4.0 KB

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