neighbour.h 4.1 KB

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