isisd.c 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406
  1. /*
  2. * IS-IS Rout(e)ing protocol - isisd.c
  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. #include <zebra.h>
  22. #include "thread.h"
  23. #include "vty.h"
  24. #include "command.h"
  25. #include "log.h"
  26. #include "memory.h"
  27. #include "time.h"
  28. #include "linklist.h"
  29. #include "if.h"
  30. #include "hash.h"
  31. #include "stream.h"
  32. #include "prefix.h"
  33. #include "table.h"
  34. #include "isisd/dict.h"
  35. #include "isisd/include-netbsd/iso.h"
  36. #include "isisd/isis_constants.h"
  37. #include "isisd/isis_common.h"
  38. #include "isisd/isis_flags.h"
  39. #include "isisd/isis_circuit.h"
  40. #include "isisd/isis_csm.h"
  41. #include "isisd/isisd.h"
  42. #include "isisd/isis_dynhn.h"
  43. #include "isisd/isis_adjacency.h"
  44. #include "isisd/isis_pdu.h"
  45. #include "isisd/isis_misc.h"
  46. #include "isisd/isis_constants.h"
  47. #include "isisd/isis_tlv.h"
  48. #include "isisd/isis_lsp.h"
  49. #include "isisd/isis_spf.h"
  50. #include "isisd/isis_route.h"
  51. #include "isisd/isis_zebra.h"
  52. #include "isisd/isis_events.h"
  53. #include "isisd/isis_te.h"
  54. #ifdef TOPOLOGY_GENERATE
  55. #include "spgrid.h"
  56. u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 };
  57. #endif /* TOPOLOGY_GENERATE */
  58. struct isis *isis = NULL;
  59. /*
  60. * Prototypes.
  61. */
  62. int isis_area_get(struct vty *, const char *);
  63. int isis_area_destroy(struct vty *, const char *);
  64. int area_net_title(struct vty *, const char *);
  65. int area_clear_net_title(struct vty *, const char *);
  66. int show_isis_interface_common(struct vty *, const char *ifname, char);
  67. int show_isis_neighbor_common(struct vty *, const char *id, char);
  68. int clear_isis_neighbor_common(struct vty *, const char *id);
  69. int isis_config_write(struct vty *);
  70. void
  71. isis_new (unsigned long process_id)
  72. {
  73. isis = XCALLOC (MTYPE_ISIS, sizeof (struct isis));
  74. /*
  75. * Default values
  76. */
  77. isis->max_area_addrs = 3;
  78. isis->process_id = process_id;
  79. isis->router_id = 0;
  80. isis->area_list = list_new ();
  81. isis->init_circ_list = list_new ();
  82. isis->uptime = time (NULL);
  83. isis->nexthops = list_new ();
  84. #ifdef HAVE_IPV6
  85. isis->nexthops6 = list_new ();
  86. #endif /* HAVE_IPV6 */
  87. dyn_cache_init ();
  88. /*
  89. * uncomment the next line for full debugs
  90. */
  91. /* isis->debugs = 0xFFFF; */
  92. isisMplsTE.status = disable; /* Only support TE metric */
  93. }
  94. struct isis_area *
  95. isis_area_create (const char *area_tag)
  96. {
  97. struct isis_area *area;
  98. area = XCALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
  99. /*
  100. * The first instance is level-1-2 rest are level-1, unless otherwise
  101. * configured
  102. */
  103. if (listcount (isis->area_list) > 0)
  104. area->is_type = IS_LEVEL_1;
  105. else
  106. area->is_type = IS_LEVEL_1_AND_2;
  107. /*
  108. * intialize the databases
  109. */
  110. if (area->is_type & IS_LEVEL_1)
  111. {
  112. area->lspdb[0] = lsp_db_init ();
  113. area->route_table[0] = route_table_init ();
  114. #ifdef HAVE_IPV6
  115. area->route_table6[0] = route_table_init ();
  116. #endif /* HAVE_IPV6 */
  117. }
  118. if (area->is_type & IS_LEVEL_2)
  119. {
  120. area->lspdb[1] = lsp_db_init ();
  121. area->route_table[1] = route_table_init ();
  122. #ifdef HAVE_IPV6
  123. area->route_table6[1] = route_table_init ();
  124. #endif /* HAVE_IPV6 */
  125. }
  126. spftree_area_init (area);
  127. area->circuit_list = list_new ();
  128. area->area_addrs = list_new ();
  129. THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
  130. flags_initialize (&area->flags);
  131. /*
  132. * Default values
  133. */
  134. area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */
  135. area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */
  136. area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
  137. area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
  138. area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
  139. area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
  140. area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
  141. area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
  142. area->dynhostname = 1;
  143. area->oldmetric = 0;
  144. area->newmetric = 1;
  145. area->lsp_frag_threshold = 90;
  146. area->lsp_mtu = DEFAULT_LSP_MTU;
  147. #ifdef TOPOLOGY_GENERATE
  148. memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
  149. #endif /* TOPOLOGY_GENERATE */
  150. area->area_tag = strdup (area_tag);
  151. listnode_add (isis->area_list, area);
  152. area->isis = isis;
  153. return area;
  154. }
  155. struct isis_area *
  156. isis_area_lookup (const char *area_tag)
  157. {
  158. struct isis_area *area;
  159. struct listnode *node;
  160. for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
  161. if ((area->area_tag == NULL && area_tag == NULL) ||
  162. (area->area_tag && area_tag
  163. && strcmp (area->area_tag, area_tag) == 0))
  164. return area;
  165. return NULL;
  166. }
  167. int
  168. isis_area_get (struct vty *vty, const char *area_tag)
  169. {
  170. struct isis_area *area;
  171. area = isis_area_lookup (area_tag);
  172. if (area)
  173. {
  174. vty->node = ISIS_NODE;
  175. vty->index = area;
  176. return CMD_SUCCESS;
  177. }
  178. area = isis_area_create (area_tag);
  179. if (isis->debugs & DEBUG_EVENTS)
  180. zlog_debug ("New IS-IS area instance %s", area->area_tag);
  181. vty->node = ISIS_NODE;
  182. vty->index = area;
  183. return CMD_SUCCESS;
  184. }
  185. int
  186. isis_area_destroy (struct vty *vty, const char *area_tag)
  187. {
  188. struct isis_area *area;
  189. struct listnode *node, *nnode;
  190. struct isis_circuit *circuit;
  191. struct area_addr *addr;
  192. area = isis_area_lookup (area_tag);
  193. if (area == NULL)
  194. {
  195. vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
  196. return CMD_ERR_NO_MATCH;
  197. }
  198. if (area->circuit_list)
  199. {
  200. for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
  201. {
  202. circuit->ip_router = 0;
  203. #ifdef HAVE_IPV6
  204. circuit->ipv6_router = 0;
  205. #endif
  206. isis_csm_state_change (ISIS_DISABLE, circuit, area);
  207. }
  208. list_delete (area->circuit_list);
  209. area->circuit_list = NULL;
  210. }
  211. if (area->lspdb[0] != NULL)
  212. {
  213. lsp_db_destroy (area->lspdb[0]);
  214. area->lspdb[0] = NULL;
  215. }
  216. if (area->lspdb[1] != NULL)
  217. {
  218. lsp_db_destroy (area->lspdb[1]);
  219. area->lspdb[1] = NULL;
  220. }
  221. spftree_area_del (area);
  222. /* invalidate and validate would delete all routes from zebra */
  223. isis_route_invalidate (area);
  224. isis_route_validate (area);
  225. if (area->route_table[0])
  226. {
  227. route_table_finish (area->route_table[0]);
  228. area->route_table[0] = NULL;
  229. }
  230. if (area->route_table[1])
  231. {
  232. route_table_finish (area->route_table[1]);
  233. area->route_table[1] = NULL;
  234. }
  235. #ifdef HAVE_IPV6
  236. if (area->route_table6[0])
  237. {
  238. route_table_finish (area->route_table6[0]);
  239. area->route_table6[0] = NULL;
  240. }
  241. if (area->route_table6[1])
  242. {
  243. route_table_finish (area->route_table6[1]);
  244. area->route_table6[1] = NULL;
  245. }
  246. #endif /* HAVE_IPV6 */
  247. isis_redist_area_finish(area);
  248. for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addr))
  249. {
  250. list_delete_node (area->area_addrs, node);
  251. XFREE (MTYPE_ISIS_AREA_ADDR, addr);
  252. }
  253. area->area_addrs = NULL;
  254. THREAD_TIMER_OFF (area->t_tick);
  255. THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
  256. THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
  257. thread_cancel_event (master, area);
  258. listnode_delete (isis->area_list, area);
  259. free (area->area_tag);
  260. XFREE (MTYPE_ISIS_AREA, area);
  261. if (listcount (isis->area_list) == 0)
  262. {
  263. memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
  264. isis->sysid_set = 0;
  265. }
  266. return CMD_SUCCESS;
  267. }
  268. int
  269. area_net_title (struct vty *vty, const char *net_title)
  270. {
  271. struct isis_area *area;
  272. struct area_addr *addr;
  273. struct area_addr *addrp;
  274. struct listnode *node;
  275. u_char buff[255];
  276. area = vty->index;
  277. if (!area)
  278. {
  279. vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
  280. return CMD_ERR_NO_MATCH;
  281. }
  282. /* We check that we are not over the maximal number of addresses */
  283. if (listcount (area->area_addrs) >= isis->max_area_addrs)
  284. {
  285. vty_out (vty, "Maximum of area addresses (%d) already reached %s",
  286. isis->max_area_addrs, VTY_NEWLINE);
  287. return CMD_ERR_NOTHING_TODO;
  288. }
  289. addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
  290. addr->addr_len = dotformat2buff (buff, net_title);
  291. memcpy (addr->area_addr, buff, addr->addr_len);
  292. #ifdef EXTREME_DEBUG
  293. zlog_debug ("added area address %s for area %s (address length %d)",
  294. net_title, area->area_tag, addr->addr_len);
  295. #endif /* EXTREME_DEBUG */
  296. if (addr->addr_len < 8 || addr->addr_len > 20)
  297. {
  298. vty_out (vty, "area address must be at least 8..20 octets long (%d)%s",
  299. addr->addr_len, VTY_NEWLINE);
  300. XFREE (MTYPE_ISIS_AREA_ADDR, addr);
  301. return CMD_ERR_AMBIGUOUS;
  302. }
  303. if (addr->area_addr[addr->addr_len-1] != 0)
  304. {
  305. vty_out (vty, "nsel byte (last byte) in area address must be 0%s",
  306. VTY_NEWLINE);
  307. XFREE (MTYPE_ISIS_AREA_ADDR, addr);
  308. return CMD_ERR_AMBIGUOUS;
  309. }
  310. if (isis->sysid_set == 0)
  311. {
  312. /*
  313. * First area address - get the SystemID for this router
  314. */
  315. memcpy (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN);
  316. isis->sysid_set = 1;
  317. if (isis->debugs & DEBUG_EVENTS)
  318. zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
  319. }
  320. else
  321. {
  322. /*
  323. * Check that the SystemID portions match
  324. */
  325. if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN))
  326. {
  327. vty_out (vty,
  328. "System ID must not change when defining additional area"
  329. " addresses%s", VTY_NEWLINE);
  330. XFREE (MTYPE_ISIS_AREA_ADDR, addr);
  331. return CMD_ERR_AMBIGUOUS;
  332. }
  333. /* now we see that we don't already have this address */
  334. for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
  335. {
  336. if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) != (addr->addr_len))
  337. continue;
  338. if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
  339. {
  340. XFREE (MTYPE_ISIS_AREA_ADDR, addr);
  341. return CMD_SUCCESS; /* silent fail */
  342. }
  343. }
  344. }
  345. /*
  346. * Forget the systemID part of the address
  347. */
  348. addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
  349. listnode_add (area->area_addrs, addr);
  350. /* only now we can safely generate our LSPs for this area */
  351. if (listcount (area->area_addrs) > 0)
  352. {
  353. if (area->is_type & IS_LEVEL_1)
  354. lsp_generate (area, IS_LEVEL_1);
  355. if (area->is_type & IS_LEVEL_2)
  356. lsp_generate (area, IS_LEVEL_2);
  357. }
  358. return CMD_SUCCESS;
  359. }
  360. int
  361. area_clear_net_title (struct vty *vty, const char *net_title)
  362. {
  363. struct isis_area *area;
  364. struct area_addr addr, *addrp = NULL;
  365. struct listnode *node;
  366. u_char buff[255];
  367. area = vty->index;
  368. if (!area)
  369. {
  370. vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
  371. return CMD_ERR_NO_MATCH;
  372. }
  373. addr.addr_len = dotformat2buff (buff, net_title);
  374. if (addr.addr_len < 8 || addr.addr_len > 20)
  375. {
  376. vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
  377. addr.addr_len, VTY_NEWLINE);
  378. return CMD_ERR_AMBIGUOUS;
  379. }
  380. memcpy (addr.area_addr, buff, (int) addr.addr_len);
  381. for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
  382. if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len &&
  383. !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
  384. break;
  385. if (!addrp)
  386. {
  387. vty_out (vty, "No area address %s for area %s %s", net_title,
  388. area->area_tag, VTY_NEWLINE);
  389. return CMD_ERR_NO_MATCH;
  390. }
  391. listnode_delete (area->area_addrs, addrp);
  392. XFREE (MTYPE_ISIS_AREA_ADDR, addrp);
  393. /*
  394. * Last area address - reset the SystemID for this router
  395. */
  396. if (listcount (area->area_addrs) == 0)
  397. {
  398. memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
  399. isis->sysid_set = 0;
  400. if (isis->debugs & DEBUG_EVENTS)
  401. zlog_debug ("Router has no SystemID");
  402. }
  403. return CMD_SUCCESS;
  404. }
  405. /*
  406. * 'show isis interface' command
  407. */
  408. int
  409. show_isis_interface_common (struct vty *vty, const char *ifname, char detail)
  410. {
  411. struct listnode *anode, *cnode;
  412. struct isis_area *area;
  413. struct isis_circuit *circuit;
  414. if (!isis)
  415. {
  416. vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
  417. return CMD_SUCCESS;
  418. }
  419. for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
  420. {
  421. vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
  422. if (detail == ISIS_UI_LEVEL_BRIEF)
  423. vty_out (vty, " Interface CircId State Type Level%s",
  424. VTY_NEWLINE);
  425. for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
  426. if (!ifname)
  427. isis_circuit_print_vty (circuit, vty, detail);
  428. else if (strcmp(circuit->interface->name, ifname) == 0)
  429. isis_circuit_print_vty (circuit, vty, detail);
  430. }
  431. return CMD_SUCCESS;
  432. }
  433. DEFUN (show_isis_interface,
  434. show_isis_interface_cmd,
  435. "show isis interface",
  436. SHOW_STR
  437. "ISIS network information\n"
  438. "ISIS interface\n")
  439. {
  440. return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
  441. }
  442. DEFUN (show_isis_interface_detail,
  443. show_isis_interface_detail_cmd,
  444. "show isis interface detail",
  445. SHOW_STR
  446. "ISIS network information\n"
  447. "ISIS interface\n"
  448. "show detailed information\n")
  449. {
  450. return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
  451. }
  452. DEFUN (show_isis_interface_arg,
  453. show_isis_interface_arg_cmd,
  454. "show isis interface WORD",
  455. SHOW_STR
  456. "ISIS network information\n"
  457. "ISIS interface\n"
  458. "ISIS interface name\n")
  459. {
  460. return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
  461. }
  462. /*
  463. * 'show isis neighbor' command
  464. */
  465. int
  466. show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
  467. {
  468. struct listnode *anode, *cnode, *node;
  469. struct isis_area *area;
  470. struct isis_circuit *circuit;
  471. struct list *adjdb;
  472. struct isis_adjacency *adj;
  473. struct isis_dynhn *dynhn;
  474. u_char sysid[ISIS_SYS_ID_LEN];
  475. int i;
  476. if (!isis)
  477. {
  478. vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
  479. return CMD_SUCCESS;
  480. }
  481. memset (sysid, 0, ISIS_SYS_ID_LEN);
  482. if (id)
  483. {
  484. if (sysid2buff (sysid, id) == 0)
  485. {
  486. dynhn = dynhn_find_by_name (id);
  487. if (dynhn == NULL)
  488. {
  489. vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
  490. return CMD_SUCCESS;
  491. }
  492. memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
  493. }
  494. }
  495. for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
  496. {
  497. vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
  498. if (detail == ISIS_UI_LEVEL_BRIEF)
  499. vty_out (vty, " System Id Interface L State"
  500. " Holdtime SNPA%s", VTY_NEWLINE);
  501. for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
  502. {
  503. if (circuit->circ_type == CIRCUIT_T_BROADCAST)
  504. {
  505. for (i = 0; i < 2; i++)
  506. {
  507. adjdb = circuit->u.bc.adjdb[i];
  508. if (adjdb && adjdb->count)
  509. {
  510. for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj))
  511. if (!id || !memcmp (adj->sysid, sysid,
  512. ISIS_SYS_ID_LEN))
  513. isis_adj_print_vty (adj, vty, detail);
  514. }
  515. }
  516. }
  517. else if (circuit->circ_type == CIRCUIT_T_P2P &&
  518. circuit->u.p2p.neighbor)
  519. {
  520. adj = circuit->u.p2p.neighbor;
  521. if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
  522. isis_adj_print_vty (adj, vty, detail);
  523. }
  524. }
  525. }
  526. return CMD_SUCCESS;
  527. }
  528. /*
  529. * 'clear isis neighbor' command
  530. */
  531. int
  532. clear_isis_neighbor_common (struct vty *vty, const char *id)
  533. {
  534. struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
  535. struct isis_area *area;
  536. struct isis_circuit *circuit;
  537. struct list *adjdb;
  538. struct isis_adjacency *adj;
  539. struct isis_dynhn *dynhn;
  540. u_char sysid[ISIS_SYS_ID_LEN];
  541. int i;
  542. if (!isis)
  543. {
  544. vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
  545. return CMD_SUCCESS;
  546. }
  547. memset (sysid, 0, ISIS_SYS_ID_LEN);
  548. if (id)
  549. {
  550. if (sysid2buff (sysid, id) == 0)
  551. {
  552. dynhn = dynhn_find_by_name (id);
  553. if (dynhn == NULL)
  554. {
  555. vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
  556. return CMD_SUCCESS;
  557. }
  558. memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
  559. }
  560. }
  561. for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
  562. {
  563. for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnextnode, circuit))
  564. {
  565. if (circuit->circ_type == CIRCUIT_T_BROADCAST)
  566. {
  567. for (i = 0; i < 2; i++)
  568. {
  569. adjdb = circuit->u.bc.adjdb[i];
  570. if (adjdb && adjdb->count)
  571. {
  572. for (ALL_LIST_ELEMENTS (adjdb, node, nnode, adj))
  573. if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
  574. isis_adj_state_change (adj, ISIS_ADJ_DOWN,
  575. "clear user request");
  576. }
  577. }
  578. }
  579. else if (circuit->circ_type == CIRCUIT_T_P2P &&
  580. circuit->u.p2p.neighbor)
  581. {
  582. adj = circuit->u.p2p.neighbor;
  583. if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
  584. isis_adj_state_change (adj, ISIS_ADJ_DOWN,
  585. "clear user request");
  586. }
  587. }
  588. }
  589. return CMD_SUCCESS;
  590. }
  591. DEFUN (show_isis_neighbor,
  592. show_isis_neighbor_cmd,
  593. "show isis neighbor",
  594. SHOW_STR
  595. "ISIS network information\n"
  596. "ISIS neighbor adjacencies\n")
  597. {
  598. return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
  599. }
  600. DEFUN (show_isis_neighbor_detail,
  601. show_isis_neighbor_detail_cmd,
  602. "show isis neighbor detail",
  603. SHOW_STR
  604. "ISIS network information\n"
  605. "ISIS neighbor adjacencies\n"
  606. "show detailed information\n")
  607. {
  608. return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
  609. }
  610. DEFUN (show_isis_neighbor_arg,
  611. show_isis_neighbor_arg_cmd,
  612. "show isis neighbor WORD",
  613. SHOW_STR
  614. "ISIS network information\n"
  615. "ISIS neighbor adjacencies\n"
  616. "System id\n")
  617. {
  618. return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
  619. }
  620. DEFUN (clear_isis_neighbor,
  621. clear_isis_neighbor_cmd,
  622. "clear isis neighbor",
  623. CLEAR_STR
  624. "Reset ISIS network information\n"
  625. "Reset ISIS neighbor adjacencies\n")
  626. {
  627. return clear_isis_neighbor_common (vty, NULL);
  628. }
  629. DEFUN (clear_isis_neighbor_arg,
  630. clear_isis_neighbor_arg_cmd,
  631. "clear isis neighbor WORD",
  632. CLEAR_STR
  633. "ISIS network information\n"
  634. "ISIS neighbor adjacencies\n"
  635. "System id\n")
  636. {
  637. return clear_isis_neighbor_common (vty, argv[0]);
  638. }
  639. /*
  640. * 'isis debug', 'show debugging'
  641. */
  642. void
  643. print_debug (struct vty *vty, int flags, int onoff)
  644. {
  645. char onoffs[4];
  646. if (onoff)
  647. strcpy (onoffs, "on");
  648. else
  649. strcpy (onoffs, "off");
  650. if (flags & DEBUG_ADJ_PACKETS)
  651. vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
  652. VTY_NEWLINE);
  653. if (flags & DEBUG_CHECKSUM_ERRORS)
  654. vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
  655. VTY_NEWLINE);
  656. if (flags & DEBUG_LOCAL_UPDATES)
  657. vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
  658. VTY_NEWLINE);
  659. if (flags & DEBUG_PROTOCOL_ERRORS)
  660. vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
  661. VTY_NEWLINE);
  662. if (flags & DEBUG_SNP_PACKETS)
  663. vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
  664. VTY_NEWLINE);
  665. if (flags & DEBUG_SPF_EVENTS)
  666. vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
  667. if (flags & DEBUG_SPF_STATS)
  668. vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
  669. onoffs, VTY_NEWLINE);
  670. if (flags & DEBUG_SPF_TRIGGERS)
  671. vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
  672. VTY_NEWLINE);
  673. if (flags & DEBUG_UPDATE_PACKETS)
  674. vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
  675. VTY_NEWLINE);
  676. if (flags & DEBUG_RTE_EVENTS)
  677. vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
  678. VTY_NEWLINE);
  679. if (flags & DEBUG_EVENTS)
  680. vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
  681. if (flags & DEBUG_PACKET_DUMP)
  682. vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE);
  683. if (flags & DEBUG_LSP_GEN)
  684. vty_out (vty, "IS-IS LSP generation debugging is %s%s", onoffs, VTY_NEWLINE);
  685. if (flags & DEBUG_LSP_SCHED)
  686. vty_out (vty, "IS-IS LSP scheduling debugging is %s%s", onoffs, VTY_NEWLINE);
  687. }
  688. DEFUN (show_debugging,
  689. show_debugging_isis_cmd,
  690. "show debugging isis",
  691. SHOW_STR
  692. "State of each debugging option\n")
  693. {
  694. if (isis->debugs) {
  695. vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
  696. print_debug (vty, isis->debugs, 1);
  697. }
  698. return CMD_SUCCESS;
  699. }
  700. /* Debug node. */
  701. static struct cmd_node debug_node = {
  702. DEBUG_NODE,
  703. "",
  704. 1
  705. };
  706. static int
  707. config_write_debug (struct vty *vty)
  708. {
  709. int write = 0;
  710. int flags = isis->debugs;
  711. if (flags & DEBUG_ADJ_PACKETS)
  712. {
  713. vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
  714. write++;
  715. }
  716. if (flags & DEBUG_CHECKSUM_ERRORS)
  717. {
  718. vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
  719. write++;
  720. }
  721. if (flags & DEBUG_LOCAL_UPDATES)
  722. {
  723. vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
  724. write++;
  725. }
  726. if (flags & DEBUG_PROTOCOL_ERRORS)
  727. {
  728. vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
  729. write++;
  730. }
  731. if (flags & DEBUG_SNP_PACKETS)
  732. {
  733. vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
  734. write++;
  735. }
  736. if (flags & DEBUG_SPF_EVENTS)
  737. {
  738. vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
  739. write++;
  740. }
  741. if (flags & DEBUG_SPF_STATS)
  742. {
  743. vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
  744. write++;
  745. }
  746. if (flags & DEBUG_SPF_TRIGGERS)
  747. {
  748. vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
  749. write++;
  750. }
  751. if (flags & DEBUG_UPDATE_PACKETS)
  752. {
  753. vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
  754. write++;
  755. }
  756. if (flags & DEBUG_RTE_EVENTS)
  757. {
  758. vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
  759. write++;
  760. }
  761. if (flags & DEBUG_EVENTS)
  762. {
  763. vty_out (vty, "debug isis events%s", VTY_NEWLINE);
  764. write++;
  765. }
  766. if (flags & DEBUG_PACKET_DUMP)
  767. {
  768. vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE);
  769. write++;
  770. }
  771. if (flags & DEBUG_LSP_GEN)
  772. {
  773. vty_out (vty, "debug isis lsp-gen%s", VTY_NEWLINE);
  774. write++;
  775. }
  776. if (flags & DEBUG_LSP_SCHED)
  777. {
  778. vty_out (vty, "debug isis lsp-sched%s", VTY_NEWLINE);
  779. write++;
  780. }
  781. return write;
  782. }
  783. DEFUN (debug_isis_adj,
  784. debug_isis_adj_cmd,
  785. "debug isis adj-packets",
  786. DEBUG_STR
  787. "IS-IS information\n"
  788. "IS-IS Adjacency related packets\n")
  789. {
  790. isis->debugs |= DEBUG_ADJ_PACKETS;
  791. print_debug (vty, DEBUG_ADJ_PACKETS, 1);
  792. return CMD_SUCCESS;
  793. }
  794. DEFUN (no_debug_isis_adj,
  795. no_debug_isis_adj_cmd,
  796. "no debug isis adj-packets",
  797. UNDEBUG_STR
  798. "IS-IS information\n"
  799. "IS-IS Adjacency related packets\n")
  800. {
  801. isis->debugs &= ~DEBUG_ADJ_PACKETS;
  802. print_debug (vty, DEBUG_ADJ_PACKETS, 0);
  803. return CMD_SUCCESS;
  804. }
  805. DEFUN (debug_isis_csum,
  806. debug_isis_csum_cmd,
  807. "debug isis checksum-errors",
  808. DEBUG_STR
  809. "IS-IS information\n"
  810. "IS-IS LSP checksum errors\n")
  811. {
  812. isis->debugs |= DEBUG_CHECKSUM_ERRORS;
  813. print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
  814. return CMD_SUCCESS;
  815. }
  816. DEFUN (no_debug_isis_csum,
  817. no_debug_isis_csum_cmd,
  818. "no debug isis checksum-errors",
  819. UNDEBUG_STR
  820. "IS-IS information\n"
  821. "IS-IS LSP checksum errors\n")
  822. {
  823. isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
  824. print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
  825. return CMD_SUCCESS;
  826. }
  827. DEFUN (debug_isis_lupd,
  828. debug_isis_lupd_cmd,
  829. "debug isis local-updates",
  830. DEBUG_STR
  831. "IS-IS information\n"
  832. "IS-IS local update packets\n")
  833. {
  834. isis->debugs |= DEBUG_LOCAL_UPDATES;
  835. print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
  836. return CMD_SUCCESS;
  837. }
  838. DEFUN (no_debug_isis_lupd,
  839. no_debug_isis_lupd_cmd,
  840. "no debug isis local-updates",
  841. UNDEBUG_STR
  842. "IS-IS information\n"
  843. "IS-IS local update packets\n")
  844. {
  845. isis->debugs &= ~DEBUG_LOCAL_UPDATES;
  846. print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
  847. return CMD_SUCCESS;
  848. }
  849. DEFUN (debug_isis_err,
  850. debug_isis_err_cmd,
  851. "debug isis protocol-errors",
  852. DEBUG_STR
  853. "IS-IS information\n"
  854. "IS-IS LSP protocol errors\n")
  855. {
  856. isis->debugs |= DEBUG_PROTOCOL_ERRORS;
  857. print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
  858. return CMD_SUCCESS;
  859. }
  860. DEFUN (no_debug_isis_err,
  861. no_debug_isis_err_cmd,
  862. "no debug isis protocol-errors",
  863. UNDEBUG_STR
  864. "IS-IS information\n"
  865. "IS-IS LSP protocol errors\n")
  866. {
  867. isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
  868. print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
  869. return CMD_SUCCESS;
  870. }
  871. DEFUN (debug_isis_snp,
  872. debug_isis_snp_cmd,
  873. "debug isis snp-packets",
  874. DEBUG_STR
  875. "IS-IS information\n"
  876. "IS-IS CSNP/PSNP packets\n")
  877. {
  878. isis->debugs |= DEBUG_SNP_PACKETS;
  879. print_debug (vty, DEBUG_SNP_PACKETS, 1);
  880. return CMD_SUCCESS;
  881. }
  882. DEFUN (no_debug_isis_snp,
  883. no_debug_isis_snp_cmd,
  884. "no debug isis snp-packets",
  885. UNDEBUG_STR
  886. "IS-IS information\n"
  887. "IS-IS CSNP/PSNP packets\n")
  888. {
  889. isis->debugs &= ~DEBUG_SNP_PACKETS;
  890. print_debug (vty, DEBUG_SNP_PACKETS, 0);
  891. return CMD_SUCCESS;
  892. }
  893. DEFUN (debug_isis_upd,
  894. debug_isis_upd_cmd,
  895. "debug isis update-packets",
  896. DEBUG_STR
  897. "IS-IS information\n"
  898. "IS-IS Update related packets\n")
  899. {
  900. isis->debugs |= DEBUG_UPDATE_PACKETS;
  901. print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
  902. return CMD_SUCCESS;
  903. }
  904. DEFUN (no_debug_isis_upd,
  905. no_debug_isis_upd_cmd,
  906. "no debug isis update-packets",
  907. UNDEBUG_STR
  908. "IS-IS information\n"
  909. "IS-IS Update related packets\n")
  910. {
  911. isis->debugs &= ~DEBUG_UPDATE_PACKETS;
  912. print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
  913. return CMD_SUCCESS;
  914. }
  915. DEFUN (debug_isis_spfevents,
  916. debug_isis_spfevents_cmd,
  917. "debug isis spf-events",
  918. DEBUG_STR
  919. "IS-IS information\n"
  920. "IS-IS Shortest Path First Events\n")
  921. {
  922. isis->debugs |= DEBUG_SPF_EVENTS;
  923. print_debug (vty, DEBUG_SPF_EVENTS, 1);
  924. return CMD_SUCCESS;
  925. }
  926. DEFUN (no_debug_isis_spfevents,
  927. no_debug_isis_spfevents_cmd,
  928. "no debug isis spf-events",
  929. UNDEBUG_STR
  930. "IS-IS information\n"
  931. "IS-IS Shortest Path First Events\n")
  932. {
  933. isis->debugs &= ~DEBUG_SPF_EVENTS;
  934. print_debug (vty, DEBUG_SPF_EVENTS, 0);
  935. return CMD_SUCCESS;
  936. }
  937. DEFUN (debug_isis_spfstats,
  938. debug_isis_spfstats_cmd,
  939. "debug isis spf-statistics ",
  940. DEBUG_STR
  941. "IS-IS information\n"
  942. "IS-IS SPF Timing and Statistic Data\n")
  943. {
  944. isis->debugs |= DEBUG_SPF_STATS;
  945. print_debug (vty, DEBUG_SPF_STATS, 1);
  946. return CMD_SUCCESS;
  947. }
  948. DEFUN (no_debug_isis_spfstats,
  949. no_debug_isis_spfstats_cmd,
  950. "no debug isis spf-statistics",
  951. UNDEBUG_STR
  952. "IS-IS information\n"
  953. "IS-IS SPF Timing and Statistic Data\n")
  954. {
  955. isis->debugs &= ~DEBUG_SPF_STATS;
  956. print_debug (vty, DEBUG_SPF_STATS, 0);
  957. return CMD_SUCCESS;
  958. }
  959. DEFUN (debug_isis_spftrigg,
  960. debug_isis_spftrigg_cmd,
  961. "debug isis spf-triggers",
  962. DEBUG_STR
  963. "IS-IS information\n"
  964. "IS-IS SPF triggering events\n")
  965. {
  966. isis->debugs |= DEBUG_SPF_TRIGGERS;
  967. print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
  968. return CMD_SUCCESS;
  969. }
  970. DEFUN (no_debug_isis_spftrigg,
  971. no_debug_isis_spftrigg_cmd,
  972. "no debug isis spf-triggers",
  973. UNDEBUG_STR
  974. "IS-IS information\n"
  975. "IS-IS SPF triggering events\n")
  976. {
  977. isis->debugs &= ~DEBUG_SPF_TRIGGERS;
  978. print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
  979. return CMD_SUCCESS;
  980. }
  981. DEFUN (debug_isis_rtevents,
  982. debug_isis_rtevents_cmd,
  983. "debug isis route-events",
  984. DEBUG_STR
  985. "IS-IS information\n"
  986. "IS-IS Route related events\n")
  987. {
  988. isis->debugs |= DEBUG_RTE_EVENTS;
  989. print_debug (vty, DEBUG_RTE_EVENTS, 1);
  990. return CMD_SUCCESS;
  991. }
  992. DEFUN (no_debug_isis_rtevents,
  993. no_debug_isis_rtevents_cmd,
  994. "no debug isis route-events",
  995. UNDEBUG_STR
  996. "IS-IS information\n"
  997. "IS-IS Route related events\n")
  998. {
  999. isis->debugs &= ~DEBUG_RTE_EVENTS;
  1000. print_debug (vty, DEBUG_RTE_EVENTS, 0);
  1001. return CMD_SUCCESS;
  1002. }
  1003. DEFUN (debug_isis_events,
  1004. debug_isis_events_cmd,
  1005. "debug isis events",
  1006. DEBUG_STR
  1007. "IS-IS information\n"
  1008. "IS-IS Events\n")
  1009. {
  1010. isis->debugs |= DEBUG_EVENTS;
  1011. print_debug (vty, DEBUG_EVENTS, 1);
  1012. return CMD_SUCCESS;
  1013. }
  1014. DEFUN (no_debug_isis_events,
  1015. no_debug_isis_events_cmd,
  1016. "no debug isis events",
  1017. UNDEBUG_STR
  1018. "IS-IS information\n"
  1019. "IS-IS Events\n")
  1020. {
  1021. isis->debugs &= ~DEBUG_EVENTS;
  1022. print_debug (vty, DEBUG_EVENTS, 0);
  1023. return CMD_SUCCESS;
  1024. }
  1025. DEFUN (debug_isis_packet_dump,
  1026. debug_isis_packet_dump_cmd,
  1027. "debug isis packet-dump",
  1028. DEBUG_STR
  1029. "IS-IS information\n"
  1030. "IS-IS packet dump\n")
  1031. {
  1032. isis->debugs |= DEBUG_PACKET_DUMP;
  1033. print_debug (vty, DEBUG_PACKET_DUMP, 1);
  1034. return CMD_SUCCESS;
  1035. }
  1036. DEFUN (no_debug_isis_packet_dump,
  1037. no_debug_isis_packet_dump_cmd,
  1038. "no debug isis packet-dump",
  1039. UNDEBUG_STR
  1040. "IS-IS information\n"
  1041. "IS-IS packet dump\n")
  1042. {
  1043. isis->debugs &= ~DEBUG_PACKET_DUMP;
  1044. print_debug (vty, DEBUG_PACKET_DUMP, 0);
  1045. return CMD_SUCCESS;
  1046. }
  1047. DEFUN (debug_isis_lsp_gen,
  1048. debug_isis_lsp_gen_cmd,
  1049. "debug isis lsp-gen",
  1050. DEBUG_STR
  1051. "IS-IS information\n"
  1052. "IS-IS generation of own LSPs\n")
  1053. {
  1054. isis->debugs |= DEBUG_LSP_GEN;
  1055. print_debug (vty, DEBUG_LSP_GEN, 1);
  1056. return CMD_SUCCESS;
  1057. }
  1058. DEFUN (no_debug_isis_lsp_gen,
  1059. no_debug_isis_lsp_gen_cmd,
  1060. "no debug isis lsp-gen",
  1061. UNDEBUG_STR
  1062. "IS-IS information\n"
  1063. "IS-IS generation of own LSPs\n")
  1064. {
  1065. isis->debugs &= ~DEBUG_LSP_GEN;
  1066. print_debug (vty, DEBUG_LSP_GEN, 0);
  1067. return CMD_SUCCESS;
  1068. }
  1069. DEFUN (debug_isis_lsp_sched,
  1070. debug_isis_lsp_sched_cmd,
  1071. "debug isis lsp-sched",
  1072. DEBUG_STR
  1073. "IS-IS information\n"
  1074. "IS-IS scheduling of LSP generation\n")
  1075. {
  1076. isis->debugs |= DEBUG_LSP_SCHED;
  1077. print_debug (vty, DEBUG_LSP_SCHED, 1);
  1078. return CMD_SUCCESS;
  1079. }
  1080. DEFUN (no_debug_isis_lsp_sched,
  1081. no_debug_isis_lsp_sched_cmd,
  1082. "no debug isis lsp-gen",
  1083. UNDEBUG_STR
  1084. "IS-IS information\n"
  1085. "IS-IS scheduling of LSP generation\n")
  1086. {
  1087. isis->debugs &= ~DEBUG_LSP_SCHED;
  1088. print_debug (vty, DEBUG_LSP_SCHED, 0);
  1089. return CMD_SUCCESS;
  1090. }
  1091. DEFUN (show_hostname,
  1092. show_hostname_cmd,
  1093. "show isis hostname",
  1094. SHOW_STR
  1095. "IS-IS information\n"
  1096. "IS-IS Dynamic hostname mapping\n")
  1097. {
  1098. dynhn_print_all (vty);
  1099. return CMD_SUCCESS;
  1100. }
  1101. static void
  1102. vty_out_timestr(struct vty *vty, time_t uptime)
  1103. {
  1104. struct tm *tm;
  1105. time_t difftime = time (NULL);
  1106. difftime -= uptime;
  1107. tm = gmtime (&difftime);
  1108. #define ONE_DAY_SECOND 60*60*24
  1109. #define ONE_WEEK_SECOND 60*60*24*7
  1110. if (difftime < ONE_DAY_SECOND)
  1111. vty_out (vty, "%02d:%02d:%02d",
  1112. tm->tm_hour, tm->tm_min, tm->tm_sec);
  1113. else if (difftime < ONE_WEEK_SECOND)
  1114. vty_out (vty, "%dd%02dh%02dm",
  1115. tm->tm_yday, tm->tm_hour, tm->tm_min);
  1116. else
  1117. vty_out (vty, "%02dw%dd%02dh",
  1118. tm->tm_yday/7,
  1119. tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
  1120. vty_out (vty, " ago");
  1121. }
  1122. DEFUN (show_isis_summary,
  1123. show_isis_summary_cmd,
  1124. "show isis summary",
  1125. SHOW_STR "IS-IS information\n" "IS-IS summary\n")
  1126. {
  1127. struct listnode *node, *node2;
  1128. struct isis_area *area;
  1129. struct isis_spftree *spftree;
  1130. int level;
  1131. if (isis == NULL)
  1132. {
  1133. vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
  1134. return CMD_SUCCESS;
  1135. }
  1136. vty_out (vty, "Process Id : %ld%s", isis->process_id,
  1137. VTY_NEWLINE);
  1138. if (isis->sysid_set)
  1139. vty_out (vty, "System Id : %s%s", sysid_print (isis->sysid),
  1140. VTY_NEWLINE);
  1141. vty_out (vty, "Up time : ");
  1142. vty_out_timestr(vty, isis->uptime);
  1143. vty_out (vty, "%s", VTY_NEWLINE);
  1144. if (isis->area_list)
  1145. vty_out (vty, "Number of areas : %d%s", isis->area_list->count,
  1146. VTY_NEWLINE);
  1147. for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
  1148. {
  1149. vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
  1150. VTY_NEWLINE);
  1151. if (listcount (area->area_addrs) > 0)
  1152. {
  1153. struct area_addr *area_addr;
  1154. for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
  1155. {
  1156. vty_out (vty, " Net: %s%s",
  1157. isonet_print (area_addr->area_addr,
  1158. area_addr->addr_len + ISIS_SYS_ID_LEN +
  1159. 1), VTY_NEWLINE);
  1160. }
  1161. }
  1162. for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
  1163. {
  1164. if ((area->is_type & level) == 0)
  1165. continue;
  1166. vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
  1167. spftree = area->spftree[level - 1];
  1168. if (spftree->pending)
  1169. vty_out (vty, " IPv4 SPF: (pending)%s", VTY_NEWLINE);
  1170. else
  1171. vty_out (vty, " IPv4 SPF:%s", VTY_NEWLINE);
  1172. vty_out (vty, " minimum interval : %d%s",
  1173. area->min_spf_interval[level - 1], VTY_NEWLINE);
  1174. vty_out (vty, " last run elapsed : ");
  1175. vty_out_timestr(vty, spftree->last_run_timestamp);
  1176. vty_out (vty, "%s", VTY_NEWLINE);
  1177. vty_out (vty, " last run duration : %u usec%s",
  1178. (u_int32_t)spftree->last_run_duration, VTY_NEWLINE);
  1179. vty_out (vty, " run count : %d%s",
  1180. spftree->runcount, VTY_NEWLINE);
  1181. #ifdef HAVE_IPV6
  1182. spftree = area->spftree6[level - 1];
  1183. if (spftree->pending)
  1184. vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE);
  1185. else
  1186. vty_out (vty, " IPv6 SPF:%s", VTY_NEWLINE);
  1187. vty_out (vty, " minimum interval : %d%s",
  1188. area->min_spf_interval[level - 1], VTY_NEWLINE);
  1189. vty_out (vty, " last run elapsed : ");
  1190. vty_out_timestr(vty, spftree->last_run_timestamp);
  1191. vty_out (vty, "%s", VTY_NEWLINE);
  1192. vty_out (vty, " last run duration : %llu msec%s",
  1193. (unsigned long long)spftree->last_run_duration, VTY_NEWLINE);
  1194. vty_out (vty, " run count : %d%s",
  1195. spftree->runcount, VTY_NEWLINE);
  1196. #endif
  1197. }
  1198. }
  1199. vty_out (vty, "%s", VTY_NEWLINE);
  1200. return CMD_SUCCESS;
  1201. }
  1202. /*
  1203. * This function supports following display options:
  1204. * [ show isis database [detail] ]
  1205. * [ show isis database <sysid> [detail] ]
  1206. * [ show isis database <hostname> [detail] ]
  1207. * [ show isis database <sysid>.<pseudo-id> [detail] ]
  1208. * [ show isis database <hostname>.<pseudo-id> [detail] ]
  1209. * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
  1210. * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
  1211. * [ show isis database detail <sysid> ]
  1212. * [ show isis database detail <hostname> ]
  1213. * [ show isis database detail <sysid>.<pseudo-id> ]
  1214. * [ show isis database detail <hostname>.<pseudo-id> ]
  1215. * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
  1216. * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
  1217. */
  1218. static int
  1219. show_isis_database (struct vty *vty, const char *argv, int ui_level)
  1220. {
  1221. struct listnode *node;
  1222. struct isis_area *area;
  1223. struct isis_lsp *lsp;
  1224. struct isis_dynhn *dynhn;
  1225. const char *pos = argv;
  1226. u_char lspid[ISIS_SYS_ID_LEN+2];
  1227. char sysid[255];
  1228. u_char number[3];
  1229. int level, lsp_count;
  1230. if (isis->area_list->count == 0)
  1231. return CMD_SUCCESS;
  1232. memset (&lspid, 0, ISIS_SYS_ID_LEN);
  1233. memset (&sysid, 0, 255);
  1234. /*
  1235. * extract fragment and pseudo id from the string argv
  1236. * in the forms:
  1237. * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
  1238. * (b) <systemid/hostname>.<pseudo-id> or
  1239. * (c) <systemid/hostname> or
  1240. * Where systemid is in the form:
  1241. * xxxx.xxxx.xxxx
  1242. */
  1243. if (argv)
  1244. strncpy (sysid, argv, 254);
  1245. if (argv && strlen (argv) > 3)
  1246. {
  1247. pos = argv + strlen (argv) - 3;
  1248. if (strncmp (pos, "-", 1) == 0)
  1249. {
  1250. memcpy (number, ++pos, 2);
  1251. lspid[ISIS_SYS_ID_LEN+1] = (u_char) strtol ((char *)number, NULL, 16);
  1252. pos -= 4;
  1253. if (strncmp (pos, ".", 1) != 0)
  1254. return CMD_ERR_AMBIGUOUS;
  1255. }
  1256. if (strncmp (pos, ".", 1) == 0)
  1257. {
  1258. memcpy (number, ++pos, 2);
  1259. lspid[ISIS_SYS_ID_LEN] = (u_char) strtol ((char *)number, NULL, 16);
  1260. sysid[pos - argv - 1] = '\0';
  1261. }
  1262. }
  1263. for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
  1264. {
  1265. vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
  1266. VTY_NEWLINE);
  1267. for (level = 0; level < ISIS_LEVELS; level++)
  1268. {
  1269. if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
  1270. {
  1271. lsp = NULL;
  1272. if (argv != NULL)
  1273. {
  1274. /*
  1275. * Try to find the lsp-id if the argv string is in
  1276. * the form hostname.<pseudo-id>-<fragment>
  1277. */
  1278. if (sysid2buff (lspid, sysid))
  1279. {
  1280. lsp = lsp_search (lspid, area->lspdb[level]);
  1281. }
  1282. else if ((dynhn = dynhn_find_by_name (sysid)))
  1283. {
  1284. memcpy (lspid, dynhn->id, ISIS_SYS_ID_LEN);
  1285. lsp = lsp_search (lspid, area->lspdb[level]);
  1286. }
  1287. else if (strncmp(unix_hostname (), sysid, 15) == 0)
  1288. {
  1289. memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
  1290. lsp = lsp_search (lspid, area->lspdb[level]);
  1291. }
  1292. }
  1293. if (lsp != NULL || argv == NULL)
  1294. {
  1295. vty_out (vty, "IS-IS Level-%d link-state database:%s",
  1296. level + 1, VTY_NEWLINE);
  1297. /* print the title in all cases */
  1298. vty_out (vty, "LSP ID PduLen "
  1299. "SeqNumber Chksum Holdtime ATT/P/OL%s",
  1300. VTY_NEWLINE);
  1301. }
  1302. if (lsp)
  1303. {
  1304. if (ui_level == ISIS_UI_LEVEL_DETAIL)
  1305. lsp_print_detail (lsp, vty, area->dynhostname);
  1306. else
  1307. lsp_print (lsp, vty, area->dynhostname);
  1308. }
  1309. else if (argv == NULL)
  1310. {
  1311. lsp_count = lsp_print_all (vty, area->lspdb[level],
  1312. ui_level,
  1313. area->dynhostname);
  1314. vty_out (vty, " %u LSPs%s%s",
  1315. lsp_count, VTY_NEWLINE, VTY_NEWLINE);
  1316. }
  1317. }
  1318. }
  1319. }
  1320. return CMD_SUCCESS;
  1321. }
  1322. DEFUN (show_database_brief,
  1323. show_database_cmd,
  1324. "show isis database",
  1325. SHOW_STR
  1326. "IS-IS information\n"
  1327. "IS-IS link state database\n")
  1328. {
  1329. return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF);
  1330. }
  1331. DEFUN (show_database_lsp_brief,
  1332. show_database_arg_cmd,
  1333. "show isis database WORD",
  1334. SHOW_STR
  1335. "IS-IS information\n"
  1336. "IS-IS link state database\n"
  1337. "LSP ID\n")
  1338. {
  1339. return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF);
  1340. }
  1341. DEFUN (show_database_lsp_detail,
  1342. show_database_arg_detail_cmd,
  1343. "show isis database WORD detail",
  1344. SHOW_STR
  1345. "IS-IS information\n"
  1346. "IS-IS link state database\n"
  1347. "LSP ID\n"
  1348. "Detailed information\n")
  1349. {
  1350. return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
  1351. }
  1352. DEFUN (show_database_detail,
  1353. show_database_detail_cmd,
  1354. "show isis database detail",
  1355. SHOW_STR
  1356. "IS-IS information\n"
  1357. "IS-IS link state database\n")
  1358. {
  1359. return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL);
  1360. }
  1361. DEFUN (show_database_detail_lsp,
  1362. show_database_detail_arg_cmd,
  1363. "show isis database detail WORD",
  1364. SHOW_STR
  1365. "IS-IS information\n"
  1366. "IS-IS link state database\n"
  1367. "Detailed information\n"
  1368. "LSP ID\n")
  1369. {
  1370. return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
  1371. }
  1372. /*
  1373. * 'router isis' command
  1374. */
  1375. DEFUN (router_isis,
  1376. router_isis_cmd,
  1377. "router isis WORD",
  1378. ROUTER_STR
  1379. "ISO IS-IS\n"
  1380. "ISO Routing area tag")
  1381. {
  1382. return isis_area_get (vty, argv[0]);
  1383. }
  1384. /*
  1385. *'no router isis' command
  1386. */
  1387. DEFUN (no_router_isis,
  1388. no_router_isis_cmd,
  1389. "no router isis WORD",
  1390. "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
  1391. {
  1392. return isis_area_destroy (vty, argv[0]);
  1393. }
  1394. /*
  1395. * 'net' command
  1396. */
  1397. DEFUN (net,
  1398. net_cmd,
  1399. "net WORD",
  1400. "A Network Entity Title for this process (OSI only)\n"
  1401. "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
  1402. {
  1403. return area_net_title (vty, argv[0]);
  1404. }
  1405. /*
  1406. * 'no net' command
  1407. */
  1408. DEFUN (no_net,
  1409. no_net_cmd,
  1410. "no net WORD",
  1411. NO_STR
  1412. "A Network Entity Title for this process (OSI only)\n"
  1413. "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
  1414. {
  1415. return area_clear_net_title (vty, argv[0]);
  1416. }
  1417. void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu)
  1418. {
  1419. area->lsp_mtu = lsp_mtu;
  1420. lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1);
  1421. }
  1422. static int
  1423. isis_area_passwd_set(struct isis_area *area, int level, u_char passwd_type,
  1424. const char *passwd, u_char snp_auth)
  1425. {
  1426. struct isis_passwd *dest;
  1427. struct isis_passwd modified;
  1428. int len;
  1429. assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
  1430. dest = (level == IS_LEVEL_1) ? &area->area_passwd : &area->domain_passwd;
  1431. memset(&modified, 0, sizeof(modified));
  1432. if (passwd_type != ISIS_PASSWD_TYPE_UNUSED)
  1433. {
  1434. if (!passwd)
  1435. return -1;
  1436. len = strlen(passwd);
  1437. if (len > 254)
  1438. return -1;
  1439. modified.len = len;
  1440. strncpy((char*)modified.passwd, passwd, 255);
  1441. modified.type = passwd_type;
  1442. modified.snp_auth = snp_auth;
  1443. }
  1444. if (memcmp(&modified, dest, sizeof(modified)))
  1445. {
  1446. memcpy(dest, &modified, sizeof(modified));
  1447. lsp_regenerate_schedule(area, IS_LEVEL_1|IS_LEVEL_2, 1);
  1448. }
  1449. return 0;
  1450. }
  1451. int
  1452. isis_area_passwd_unset (struct isis_area *area, int level)
  1453. {
  1454. return isis_area_passwd_set (area, level, ISIS_PASSWD_TYPE_UNUSED, NULL, 0);
  1455. }
  1456. int
  1457. isis_area_passwd_cleartext_set (struct isis_area *area, int level,
  1458. const char *passwd, u_char snp_auth)
  1459. {
  1460. return isis_area_passwd_set (area, level, ISIS_PASSWD_TYPE_CLEARTXT,
  1461. passwd, snp_auth);
  1462. }
  1463. int
  1464. isis_area_passwd_hmac_md5_set (struct isis_area *area, int level,
  1465. const char *passwd, u_char snp_auth)
  1466. {
  1467. return isis_area_passwd_set (area, level, ISIS_PASSWD_TYPE_HMAC_MD5,
  1468. passwd, snp_auth);
  1469. }
  1470. static void
  1471. area_resign_level (struct isis_area *area, int level)
  1472. {
  1473. if (area->lspdb[level - 1])
  1474. {
  1475. lsp_db_destroy (area->lspdb[level - 1]);
  1476. area->lspdb[level - 1] = NULL;
  1477. }
  1478. if (area->spftree[level - 1])
  1479. {
  1480. isis_spftree_del (area->spftree[level - 1]);
  1481. area->spftree[level - 1] = NULL;
  1482. }
  1483. #ifdef HAVE_IPV6
  1484. if (area->spftree6[level - 1])
  1485. {
  1486. isis_spftree_del (area->spftree6[level - 1]);
  1487. area->spftree6[level - 1] = NULL;
  1488. }
  1489. #endif
  1490. if (area->route_table[level - 1])
  1491. {
  1492. route_table_finish (area->route_table[level - 1]);
  1493. area->route_table[level - 1] = NULL;
  1494. }
  1495. #ifdef HAVE_IPV6
  1496. if (area->route_table6[level - 1])
  1497. {
  1498. route_table_finish (area->route_table6[level - 1]);
  1499. area->route_table6[level - 1] = NULL;
  1500. }
  1501. #endif /* HAVE_IPV6 */
  1502. sched_debug("ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
  1503. area->area_tag, level);
  1504. THREAD_TIMER_OFF (area->t_lsp_refresh[level - 1]);
  1505. area->lsp_regenerate_pending[level - 1] = 0;
  1506. }
  1507. void
  1508. isis_area_is_type_set(struct isis_area *area, int is_type)
  1509. {
  1510. struct listnode *node;
  1511. struct isis_circuit *circuit;
  1512. if (isis->debugs & DEBUG_EVENTS)
  1513. zlog_debug ("ISIS-Evt (%s) system type change %s -> %s", area->area_tag,
  1514. circuit_t2string (area->is_type), circuit_t2string (is_type));
  1515. if (area->is_type == is_type)
  1516. return; /* No change */
  1517. switch (area->is_type)
  1518. {
  1519. case IS_LEVEL_1:
  1520. if (is_type == IS_LEVEL_2)
  1521. area_resign_level (area, IS_LEVEL_1);
  1522. if (area->lspdb[1] == NULL)
  1523. area->lspdb[1] = lsp_db_init ();
  1524. if (area->route_table[1] == NULL)
  1525. area->route_table[1] = route_table_init ();
  1526. #ifdef HAVE_IPV6
  1527. if (area->route_table6[1] == NULL)
  1528. area->route_table6[1] = route_table_init ();
  1529. #endif /* HAVE_IPV6 */
  1530. break;
  1531. case IS_LEVEL_1_AND_2:
  1532. if (is_type == IS_LEVEL_1)
  1533. area_resign_level (area, IS_LEVEL_2);
  1534. else
  1535. area_resign_level (area, IS_LEVEL_1);
  1536. break;
  1537. case IS_LEVEL_2:
  1538. if (is_type == IS_LEVEL_1)
  1539. area_resign_level (area, IS_LEVEL_2);
  1540. if (area->lspdb[0] == NULL)
  1541. area->lspdb[0] = lsp_db_init ();
  1542. if (area->route_table[0] == NULL)
  1543. area->route_table[0] = route_table_init ();
  1544. #ifdef HAVE_IPV6
  1545. if (area->route_table6[0] == NULL)
  1546. area->route_table6[0] = route_table_init ();
  1547. #endif /* HAVE_IPV6 */
  1548. break;
  1549. default:
  1550. break;
  1551. }
  1552. area->is_type = is_type;
  1553. /* override circuit's is_type */
  1554. if (area->is_type != IS_LEVEL_1_AND_2)
  1555. {
  1556. for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
  1557. isis_circuit_is_type_set (circuit, is_type);
  1558. }
  1559. spftree_area_init (area);
  1560. if (is_type & IS_LEVEL_1)
  1561. lsp_generate (area, IS_LEVEL_1);
  1562. if (is_type & IS_LEVEL_2)
  1563. lsp_generate (area, IS_LEVEL_2);
  1564. lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
  1565. return;
  1566. }
  1567. void isis_area_metricstyle_set(struct isis_area *area, bool old_metric,
  1568. bool new_metric)
  1569. {
  1570. if (area->oldmetric != old_metric
  1571. || area->newmetric != new_metric)
  1572. {
  1573. area->oldmetric = old_metric;
  1574. area->newmetric = new_metric;
  1575. lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
  1576. }
  1577. }
  1578. void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit)
  1579. {
  1580. char new_overload_bit = overload_bit ? LSPBIT_OL : 0;
  1581. if (new_overload_bit != area->overload_bit)
  1582. {
  1583. area->overload_bit = new_overload_bit;
  1584. lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
  1585. }
  1586. }
  1587. void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit)
  1588. {
  1589. char new_attached_bit = attached_bit ? LSPBIT_ATT : 0;
  1590. if (new_attached_bit != area->attached_bit)
  1591. {
  1592. area->attached_bit = new_attached_bit;
  1593. lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
  1594. }
  1595. }
  1596. void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname)
  1597. {
  1598. if (area->dynhostname != dynhostname)
  1599. {
  1600. area->dynhostname = dynhostname;
  1601. lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
  1602. }
  1603. }
  1604. void
  1605. isis_area_max_lsp_lifetime_set(struct isis_area *area, int level,
  1606. uint16_t max_lsp_lifetime)
  1607. {
  1608. assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
  1609. if (area->max_lsp_lifetime[level-1] == max_lsp_lifetime)
  1610. return;
  1611. area->max_lsp_lifetime[level-1] = max_lsp_lifetime;
  1612. lsp_regenerate_schedule(area, level, 1);
  1613. }
  1614. void
  1615. isis_area_lsp_refresh_set(struct isis_area *area, int level,
  1616. uint16_t lsp_refresh)
  1617. {
  1618. assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
  1619. if (area->lsp_refresh[level-1] == lsp_refresh)
  1620. return;
  1621. area->lsp_refresh[level-1] = lsp_refresh;
  1622. lsp_regenerate_schedule(area, level, 1);
  1623. }
  1624. DEFUN (log_adj_changes,
  1625. log_adj_changes_cmd,
  1626. "log-adjacency-changes",
  1627. "Log changes in adjacency state\n")
  1628. {
  1629. struct isis_area *area;
  1630. area = vty->index;
  1631. assert (area);
  1632. area->log_adj_changes = 1;
  1633. return CMD_SUCCESS;
  1634. }
  1635. DEFUN (no_log_adj_changes,
  1636. no_log_adj_changes_cmd,
  1637. "no log-adjacency-changes",
  1638. "Stop logging changes in adjacency state\n")
  1639. {
  1640. struct isis_area *area;
  1641. area = vty->index;
  1642. assert (area);
  1643. area->log_adj_changes = 0;
  1644. return CMD_SUCCESS;
  1645. }
  1646. #ifdef TOPOLOGY_GENERATE
  1647. DEFUN (topology_generate_grid,
  1648. topology_generate_grid_cmd,
  1649. "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
  1650. "[param]",
  1651. "Topology generation for IS-IS\n"
  1652. "Topology generation\n"
  1653. "Grid topology\n"
  1654. "X parameter of the grid\n"
  1655. "Y parameter of the grid\n"
  1656. "Random seed\n"
  1657. "Optional param 1\n"
  1658. "Optional param 2\n"
  1659. "Optional param 3\n"
  1660. "Topology\n")
  1661. {
  1662. struct isis_area *area;
  1663. area = vty->index;
  1664. assert (area);
  1665. if (!spgrid_check_params (vty, argc, argv))
  1666. {
  1667. if (area->topology)
  1668. list_delete (area->topology);
  1669. area->topology = list_new ();
  1670. memcpy (area->top_params, vty->buf, 200);
  1671. gen_spgrid_topology (vty, area->topology);
  1672. remove_topology_lsps (area);
  1673. generate_topology_lsps (area);
  1674. /* Regenerate L1 LSP to get two way connection to the generated
  1675. * topology. */
  1676. lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
  1677. }
  1678. return CMD_SUCCESS;
  1679. }
  1680. DEFUN (show_isis_generated_topology,
  1681. show_isis_generated_topology_cmd,
  1682. "show isis generated-topologies",
  1683. SHOW_STR
  1684. "ISIS network information\n"
  1685. "Show generated topologies\n")
  1686. {
  1687. struct isis_area *area;
  1688. struct listnode *node;
  1689. struct listnode *node2;
  1690. struct arc *arc;
  1691. for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
  1692. {
  1693. if (!area->topology)
  1694. continue;
  1695. vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
  1696. VTY_NEWLINE);
  1697. vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
  1698. for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
  1699. vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
  1700. arc->distance, VTY_NEWLINE);
  1701. }
  1702. return CMD_SUCCESS;
  1703. }
  1704. /* Base IS for topology generation. */
  1705. DEFUN (topology_baseis,
  1706. topology_baseis_cmd,
  1707. "topology base-is WORD",
  1708. "Topology generation for IS-IS\n"
  1709. "A Network IS Base for this topology\n"
  1710. "XXXX.XXXX.XXXX Network entity title (NET)\n")
  1711. {
  1712. struct isis_area *area;
  1713. u_char buff[ISIS_SYS_ID_LEN];
  1714. area = vty->index;
  1715. assert (area);
  1716. if (sysid2buff (buff, argv[0]))
  1717. sysid2buff (area->topology_baseis, argv[0]);
  1718. return CMD_SUCCESS;
  1719. }
  1720. DEFUN (no_topology_baseis,
  1721. no_topology_baseis_cmd,
  1722. "no topology base-is WORD",
  1723. NO_STR
  1724. "Topology generation for IS-IS\n"
  1725. "A Network IS Base for this topology\n"
  1726. "XXXX.XXXX.XXXX Network entity title (NET)\n")
  1727. {
  1728. struct isis_area *area;
  1729. area = vty->index;
  1730. assert (area);
  1731. memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
  1732. return CMD_SUCCESS;
  1733. }
  1734. ALIAS (no_topology_baseis,
  1735. no_topology_baseis_noid_cmd,
  1736. "no topology base-is",
  1737. NO_STR
  1738. "Topology generation for IS-IS\n"
  1739. "A Network IS Base for this topology\n")
  1740. DEFUN (topology_basedynh,
  1741. topology_basedynh_cmd,
  1742. "topology base-dynh WORD",
  1743. "Topology generation for IS-IS\n"
  1744. "Dynamic hostname base for this topology\n"
  1745. "Dynamic hostname base\n")
  1746. {
  1747. struct isis_area *area;
  1748. area = vty->index;
  1749. assert (area);
  1750. /* I hope that it's enough. */
  1751. area->topology_basedynh = strndup (argv[0], 16);
  1752. return CMD_SUCCESS;
  1753. }
  1754. #endif /* TOPOLOGY_GENERATE */
  1755. /* IS-IS configuration write function */
  1756. int
  1757. isis_config_write (struct vty *vty)
  1758. {
  1759. int write = 0;
  1760. if (isis != NULL)
  1761. {
  1762. struct isis_area *area;
  1763. struct listnode *node, *node2;
  1764. for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
  1765. {
  1766. /* ISIS - Area name */
  1767. vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
  1768. write++;
  1769. /* ISIS - Net */
  1770. if (listcount (area->area_addrs) > 0)
  1771. {
  1772. struct area_addr *area_addr;
  1773. for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
  1774. {
  1775. vty_out (vty, " net %s%s",
  1776. isonet_print (area_addr->area_addr,
  1777. area_addr->addr_len + ISIS_SYS_ID_LEN +
  1778. 1), VTY_NEWLINE);
  1779. write++;
  1780. }
  1781. }
  1782. /* ISIS - Dynamic hostname - Defaults to true so only display if
  1783. * false. */
  1784. if (!area->dynhostname)
  1785. {
  1786. vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
  1787. write++;
  1788. }
  1789. /* ISIS - Metric-Style - when true displays wide */
  1790. if (area->newmetric)
  1791. {
  1792. if (!area->oldmetric)
  1793. vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
  1794. else
  1795. vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
  1796. write++;
  1797. }
  1798. else
  1799. {
  1800. vty_out (vty, " metric-style narrow%s", VTY_NEWLINE);
  1801. write++;
  1802. }
  1803. /* ISIS - overload-bit */
  1804. if (area->overload_bit)
  1805. {
  1806. vty_out (vty, " set-overload-bit%s", VTY_NEWLINE);
  1807. write++;
  1808. }
  1809. /* ISIS - Area is-type (level-1-2 is default) */
  1810. if (area->is_type == IS_LEVEL_1)
  1811. {
  1812. vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
  1813. write++;
  1814. }
  1815. else if (area->is_type == IS_LEVEL_2)
  1816. {
  1817. vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
  1818. write++;
  1819. }
  1820. write += isis_redist_config_write(vty, area, AF_INET);
  1821. write += isis_redist_config_write(vty, area, AF_INET6);
  1822. /* ISIS - Lsp generation interval */
  1823. if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
  1824. {
  1825. if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
  1826. {
  1827. vty_out (vty, " lsp-gen-interval %d%s",
  1828. area->lsp_gen_interval[0], VTY_NEWLINE);
  1829. write++;
  1830. }
  1831. }
  1832. else
  1833. {
  1834. if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
  1835. {
  1836. vty_out (vty, " lsp-gen-interval level-1 %d%s",
  1837. area->lsp_gen_interval[0], VTY_NEWLINE);
  1838. write++;
  1839. }
  1840. if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL)
  1841. {
  1842. vty_out (vty, " lsp-gen-interval level-2 %d%s",
  1843. area->lsp_gen_interval[1], VTY_NEWLINE);
  1844. write++;
  1845. }
  1846. }
  1847. /* ISIS - LSP lifetime */
  1848. if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
  1849. {
  1850. if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
  1851. {
  1852. vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0],
  1853. VTY_NEWLINE);
  1854. write++;
  1855. }
  1856. }
  1857. else
  1858. {
  1859. if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
  1860. {
  1861. vty_out (vty, " max-lsp-lifetime level-1 %u%s",
  1862. area->max_lsp_lifetime[0], VTY_NEWLINE);
  1863. write++;
  1864. }
  1865. if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME)
  1866. {
  1867. vty_out (vty, " max-lsp-lifetime level-2 %u%s",
  1868. area->max_lsp_lifetime[1], VTY_NEWLINE);
  1869. write++;
  1870. }
  1871. }
  1872. /* ISIS - LSP refresh interval */
  1873. if (area->lsp_refresh[0] == area->lsp_refresh[1])
  1874. {
  1875. if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
  1876. {
  1877. vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0],
  1878. VTY_NEWLINE);
  1879. write++;
  1880. }
  1881. }
  1882. else
  1883. {
  1884. if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
  1885. {
  1886. vty_out (vty, " lsp-refresh-interval level-1 %u%s",
  1887. area->lsp_refresh[0], VTY_NEWLINE);
  1888. write++;
  1889. }
  1890. if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL)
  1891. {
  1892. vty_out (vty, " lsp-refresh-interval level-2 %u%s",
  1893. area->lsp_refresh[1], VTY_NEWLINE);
  1894. write++;
  1895. }
  1896. }
  1897. if (area->lsp_mtu != DEFAULT_LSP_MTU)
  1898. {
  1899. vty_out(vty, " lsp-mtu %u%s", area->lsp_mtu, VTY_NEWLINE);
  1900. write++;
  1901. }
  1902. /* Minimum SPF interval. */
  1903. if (area->min_spf_interval[0] == area->min_spf_interval[1])
  1904. {
  1905. if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
  1906. {
  1907. vty_out (vty, " spf-interval %d%s",
  1908. area->min_spf_interval[0], VTY_NEWLINE);
  1909. write++;
  1910. }
  1911. }
  1912. else
  1913. {
  1914. if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
  1915. {
  1916. vty_out (vty, " spf-interval level-1 %d%s",
  1917. area->min_spf_interval[0], VTY_NEWLINE);
  1918. write++;
  1919. }
  1920. if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
  1921. {
  1922. vty_out (vty, " spf-interval level-2 %d%s",
  1923. area->min_spf_interval[1], VTY_NEWLINE);
  1924. write++;
  1925. }
  1926. }
  1927. /* Authentication passwords. */
  1928. if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
  1929. {
  1930. vty_out(vty, " area-password md5 %s", area->area_passwd.passwd);
  1931. if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
  1932. {
  1933. vty_out(vty, " authenticate snp ");
  1934. if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
  1935. vty_out(vty, "validate");
  1936. else
  1937. vty_out(vty, "send-only");
  1938. }
  1939. vty_out(vty, "%s", VTY_NEWLINE);
  1940. write++;
  1941. }
  1942. else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
  1943. {
  1944. vty_out(vty, " area-password clear %s", area->area_passwd.passwd);
  1945. if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
  1946. {
  1947. vty_out(vty, " authenticate snp ");
  1948. if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
  1949. vty_out(vty, "validate");
  1950. else
  1951. vty_out(vty, "send-only");
  1952. }
  1953. vty_out(vty, "%s", VTY_NEWLINE);
  1954. write++;
  1955. }
  1956. if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
  1957. {
  1958. vty_out(vty, " domain-password md5 %s",
  1959. area->domain_passwd.passwd);
  1960. if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
  1961. {
  1962. vty_out(vty, " authenticate snp ");
  1963. if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
  1964. vty_out(vty, "validate");
  1965. else
  1966. vty_out(vty, "send-only");
  1967. }
  1968. vty_out(vty, "%s", VTY_NEWLINE);
  1969. write++;
  1970. }
  1971. else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
  1972. {
  1973. vty_out(vty, " domain-password clear %s",
  1974. area->domain_passwd.passwd);
  1975. if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
  1976. {
  1977. vty_out(vty, " authenticate snp ");
  1978. if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
  1979. vty_out(vty, "validate");
  1980. else
  1981. vty_out(vty, "send-only");
  1982. }
  1983. vty_out(vty, "%s", VTY_NEWLINE);
  1984. write++;
  1985. }
  1986. if (area->log_adj_changes)
  1987. {
  1988. vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE);
  1989. write++;
  1990. }
  1991. #ifdef TOPOLOGY_GENERATE
  1992. if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
  1993. ISIS_SYS_ID_LEN))
  1994. {
  1995. vty_out (vty, " topology base-is %s%s",
  1996. sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE);
  1997. write++;
  1998. }
  1999. if (area->topology_basedynh)
  2000. {
  2001. vty_out (vty, " topology base-dynh %s%s",
  2002. area->topology_basedynh, VTY_NEWLINE);
  2003. write++;
  2004. }
  2005. /* We save the whole command line here. */
  2006. if (strlen(area->top_params))
  2007. {
  2008. vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
  2009. write++;
  2010. }
  2011. #endif /* TOPOLOGY_GENERATE */
  2012. }
  2013. isis_mpls_te_config_write_router(vty);
  2014. }
  2015. return write;
  2016. }
  2017. struct cmd_node isis_node = {
  2018. ISIS_NODE,
  2019. "%s(config-router)# ",
  2020. 1
  2021. };
  2022. void
  2023. isis_init ()
  2024. {
  2025. /* Install IS-IS top node */
  2026. install_node (&isis_node, isis_config_write);
  2027. install_element (VIEW_NODE, &show_isis_summary_cmd);
  2028. install_element (VIEW_NODE, &show_isis_interface_cmd);
  2029. install_element (VIEW_NODE, &show_isis_interface_detail_cmd);
  2030. install_element (VIEW_NODE, &show_isis_interface_arg_cmd);
  2031. install_element (VIEW_NODE, &show_isis_neighbor_cmd);
  2032. install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd);
  2033. install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd);
  2034. install_element (VIEW_NODE, &clear_isis_neighbor_cmd);
  2035. install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd);
  2036. install_element (VIEW_NODE, &show_hostname_cmd);
  2037. install_element (VIEW_NODE, &show_database_cmd);
  2038. install_element (VIEW_NODE, &show_database_arg_cmd);
  2039. install_element (VIEW_NODE, &show_database_arg_detail_cmd);
  2040. install_element (VIEW_NODE, &show_database_detail_cmd);
  2041. install_element (VIEW_NODE, &show_database_detail_arg_cmd);
  2042. install_element (ENABLE_NODE, &show_debugging_isis_cmd);
  2043. install_node (&debug_node, config_write_debug);
  2044. install_element (ENABLE_NODE, &debug_isis_adj_cmd);
  2045. install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
  2046. install_element (ENABLE_NODE, &debug_isis_csum_cmd);
  2047. install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
  2048. install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
  2049. install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
  2050. install_element (ENABLE_NODE, &debug_isis_err_cmd);
  2051. install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
  2052. install_element (ENABLE_NODE, &debug_isis_snp_cmd);
  2053. install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
  2054. install_element (ENABLE_NODE, &debug_isis_upd_cmd);
  2055. install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
  2056. install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
  2057. install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
  2058. install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
  2059. install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
  2060. install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
  2061. install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
  2062. install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
  2063. install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
  2064. install_element (ENABLE_NODE, &debug_isis_events_cmd);
  2065. install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
  2066. install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd);
  2067. install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
  2068. install_element (ENABLE_NODE, &debug_isis_lsp_gen_cmd);
  2069. install_element (ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
  2070. install_element (ENABLE_NODE, &debug_isis_lsp_sched_cmd);
  2071. install_element (ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
  2072. install_element (CONFIG_NODE, &debug_isis_adj_cmd);
  2073. install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
  2074. install_element (CONFIG_NODE, &debug_isis_csum_cmd);
  2075. install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
  2076. install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
  2077. install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
  2078. install_element (CONFIG_NODE, &debug_isis_err_cmd);
  2079. install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
  2080. install_element (CONFIG_NODE, &debug_isis_snp_cmd);
  2081. install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
  2082. install_element (CONFIG_NODE, &debug_isis_upd_cmd);
  2083. install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
  2084. install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
  2085. install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
  2086. install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
  2087. install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
  2088. install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
  2089. install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
  2090. install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
  2091. install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
  2092. install_element (CONFIG_NODE, &debug_isis_events_cmd);
  2093. install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
  2094. install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd);
  2095. install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
  2096. install_element (CONFIG_NODE, &debug_isis_lsp_gen_cmd);
  2097. install_element (CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
  2098. install_element (CONFIG_NODE, &debug_isis_lsp_sched_cmd);
  2099. install_element (CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
  2100. install_element (CONFIG_NODE, &router_isis_cmd);
  2101. install_element (CONFIG_NODE, &no_router_isis_cmd);
  2102. install_default (ISIS_NODE);
  2103. install_element (ISIS_NODE, &net_cmd);
  2104. install_element (ISIS_NODE, &no_net_cmd);
  2105. install_element (ISIS_NODE, &log_adj_changes_cmd);
  2106. install_element (ISIS_NODE, &no_log_adj_changes_cmd);
  2107. #ifdef TOPOLOGY_GENERATE
  2108. install_element (ISIS_NODE, &topology_generate_grid_cmd);
  2109. install_element (ISIS_NODE, &topology_baseis_cmd);
  2110. install_element (ISIS_NODE, &topology_basedynh_cmd);
  2111. install_element (ISIS_NODE, &no_topology_baseis_cmd);
  2112. install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
  2113. install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
  2114. #endif /* TOPOLOGY_GENERATE */
  2115. }