Annotation of embedaddon/quagga/isisd/isisd.c, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>