isisd.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * IS-IS Rout(e)ing protocol - isisd.h
  3. *
  4. * Copyright (C) 2001,2002 Sampo Saaristo
  5. * Tampere University of Technology
  6. * Institute of Communications Engineering
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public Licenseas published by the Free
  10. * Software Foundation; either version 2 of the License, or (at your option)
  11. * any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef ISISD_H
  22. #define ISISD_H
  23. #define ISISD_VERSION "0.0.7"
  24. #include "isisd/isis_constants.h"
  25. #include "isisd/isis_common.h"
  26. #include "isisd/isis_redist.h"
  27. #include "isis_flags.h"
  28. #include "dict.h"
  29. /* uncomment if you are a developer in bug hunt */
  30. /* #define EXTREME_DEBUG */
  31. /* #define EXTREME_TLV_DEBUG */
  32. struct isis
  33. {
  34. u_long process_id;
  35. int sysid_set;
  36. u_char sysid[ISIS_SYS_ID_LEN]; /* SystemID for this IS */
  37. u_int32_t router_id; /* Router ID from zebra */
  38. struct list *area_list; /* list of IS-IS areas */
  39. struct list *init_circ_list;
  40. struct list *nexthops; /* IPv4 next hops from this IS */
  41. #ifdef HAVE_IPV6
  42. struct list *nexthops6; /* IPv6 next hops from this IS */
  43. #endif /* HAVE_IPV6 */
  44. u_char max_area_addrs; /* maximumAreaAdresses */
  45. struct area_addr *man_area_addrs; /* manualAreaAddresses */
  46. u_int32_t debugs; /* bitmap for debug */
  47. time_t uptime; /* when did we start */
  48. struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */
  49. struct route_table *ext_info[REDIST_PROTOCOL_COUNT];
  50. };
  51. extern struct isis *isis;
  52. struct isis_area
  53. {
  54. struct isis *isis; /* back pointer */
  55. dict_t *lspdb[ISIS_LEVELS]; /* link-state dbs */
  56. struct isis_spftree *spftree[ISIS_LEVELS]; /* The v4 SPTs */
  57. struct route_table *route_table[ISIS_LEVELS]; /* IPv4 routes */
  58. #ifdef HAVE_IPV6
  59. struct isis_spftree *spftree6[ISIS_LEVELS]; /* The v6 SPTs */
  60. struct route_table *route_table6[ISIS_LEVELS]; /* IPv6 routes */
  61. #endif
  62. #define DEFAULT_LSP_MTU 1497
  63. unsigned int lsp_mtu; /* Size of LSPs to generate */
  64. struct list *circuit_list; /* IS-IS circuits */
  65. struct flags flags;
  66. struct thread *t_tick; /* LSP walker */
  67. struct thread *t_lsp_refresh[ISIS_LEVELS];
  68. /* t_lsp_refresh is used in two ways:
  69. * a) regular refresh of LSPs
  70. * b) (possibly throttled) updates to LSPs
  71. *
  72. * The lsp_regenerate_pending flag tracks whether the timer is active
  73. * for the a) or the b) case.
  74. *
  75. * It is of utmost importance to clear this flag when the timer is
  76. * rescheduled for normal refresh, because otherwise, updates will
  77. * be delayed until the next regular refresh.
  78. */
  79. int lsp_regenerate_pending[ISIS_LEVELS];
  80. /*
  81. * Configurables
  82. */
  83. struct isis_passwd area_passwd;
  84. struct isis_passwd domain_passwd;
  85. /* do we support dynamic hostnames? */
  86. char dynhostname;
  87. /* do we support new style metrics? */
  88. char newmetric;
  89. char oldmetric;
  90. /* identifies the routing instance */
  91. char *area_tag;
  92. /* area addresses for this area */
  93. struct list *area_addrs;
  94. u_int16_t max_lsp_lifetime[ISIS_LEVELS];
  95. char is_type; /* level-1 level-1-2 or level-2-only */
  96. /* are we overloaded? */
  97. char overload_bit;
  98. /* L1/L2 router identifier for inter-area traffic */
  99. char attached_bit;
  100. u_int16_t lsp_refresh[ISIS_LEVELS];
  101. /* minimum time allowed before lsp retransmission */
  102. u_int16_t lsp_gen_interval[ISIS_LEVELS];
  103. /* min interval between between consequtive SPFs */
  104. u_int16_t min_spf_interval[ISIS_LEVELS];
  105. /* the percentage of LSP mtu size used, before generating a new frag */
  106. int lsp_frag_threshold;
  107. int ip_circuits;
  108. /* logging adjacency changes? */
  109. u_char log_adj_changes;
  110. #ifdef HAVE_IPV6
  111. int ipv6_circuits;
  112. #endif /* HAVE_IPV6 */
  113. /* Counters */
  114. u_int32_t circuit_state_changes;
  115. struct isis_redist redist_settings[REDIST_PROTOCOL_COUNT]
  116. [ZEBRA_ROUTE_MAX + 1][ISIS_LEVELS];
  117. struct route_table *ext_reach[REDIST_PROTOCOL_COUNT][ISIS_LEVELS];
  118. #ifdef TOPOLOGY_GENERATE
  119. struct list *topology;
  120. u_char topology_baseis[ISIS_SYS_ID_LEN]; /* IS for the first IS emulated. */
  121. char *topology_basedynh; /* Dynamic hostname base. */
  122. char top_params[200]; /* FIXME: what is reasonable? */
  123. #endif /* TOPOLOGY_GENERATE */
  124. };
  125. void isis_init (void);
  126. void isis_new(unsigned long);
  127. struct isis_area *isis_area_create(const char *);
  128. struct isis_area *isis_area_lookup (const char *);
  129. int isis_area_get (struct vty *vty, const char *area_tag);
  130. void print_debug(struct vty *, int, int);
  131. void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit);
  132. void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit);
  133. void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname);
  134. void isis_area_metricstyle_set(struct isis_area *area, bool old_metric,
  135. bool new_metric);
  136. void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu);
  137. void isis_area_is_type_set(struct isis_area *area, int is_type);
  138. void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level,
  139. uint16_t max_lsp_lifetime);
  140. void isis_area_lsp_refresh_set(struct isis_area *area, int level,
  141. uint16_t lsp_refresh);
  142. /* IS_LEVEL_1 sets area_passwd, IS_LEVEL_2 domain_passwd */
  143. int isis_area_passwd_unset (struct isis_area *area, int level);
  144. int isis_area_passwd_cleartext_set (struct isis_area *area, int level,
  145. const char *passwd, u_char snp_auth);
  146. int isis_area_passwd_hmac_md5_set (struct isis_area *area, int level,
  147. const char *passwd, u_char snp_auth);
  148. void isis_vty_init (void);
  149. /* Master of threads. */
  150. extern struct thread_master *master;
  151. #define DEBUG_ADJ_PACKETS (1<<0)
  152. #define DEBUG_CHECKSUM_ERRORS (1<<1)
  153. #define DEBUG_LOCAL_UPDATES (1<<2)
  154. #define DEBUG_PROTOCOL_ERRORS (1<<3)
  155. #define DEBUG_SNP_PACKETS (1<<4)
  156. #define DEBUG_UPDATE_PACKETS (1<<5)
  157. #define DEBUG_SPF_EVENTS (1<<6)
  158. #define DEBUG_SPF_STATS (1<<7)
  159. #define DEBUG_SPF_TRIGGERS (1<<8)
  160. #define DEBUG_RTE_EVENTS (1<<9)
  161. #define DEBUG_EVENTS (1<<10)
  162. #define DEBUG_ZEBRA (1<<11)
  163. #define DEBUG_PACKET_DUMP (1<<12)
  164. #define DEBUG_LSP_GEN (1<<13)
  165. #define DEBUG_LSP_SCHED (1<<14)
  166. #define lsp_debug(...) \
  167. do \
  168. { \
  169. if (isis->debugs & DEBUG_LSP_GEN) \
  170. zlog_debug(__VA_ARGS__); \
  171. } \
  172. while (0)
  173. #define sched_debug(...) \
  174. do \
  175. { \
  176. if (isis->debugs & DEBUG_LSP_SCHED) \
  177. zlog_debug(__VA_ARGS__); \
  178. } \
  179. while (0)
  180. #define DEBUG_TE (1<<13)
  181. #define IS_DEBUG_ISIS(x) (isis->debugs & x)
  182. #endif /* ISISD_H */