Diff for /embedaddon/quagga/isisd/isisd.c between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2012/02/21 17:26:11 version 1.1.1.3, 2013/07/21 23:54:39
Line 27 Line 27
 #include "command.h"  #include "command.h"
 #include "log.h"  #include "log.h"
 #include "memory.h"  #include "memory.h"
   #include "time.h"
 #include "linklist.h"  #include "linklist.h"
 #include "if.h"  #include "if.h"
 #include "hash.h"  #include "hash.h"
Line 38 Line 39
 #include "isisd/include-netbsd/iso.h"  #include "isisd/include-netbsd/iso.h"
 #include "isisd/isis_constants.h"  #include "isisd/isis_constants.h"
 #include "isisd/isis_common.h"  #include "isisd/isis_common.h"
 #include "isisd/isis_circuit.h"  
 #include "isisd/isis_flags.h"  #include "isisd/isis_flags.h"
   #include "isisd/isis_circuit.h"
   #include "isisd/isis_csm.h"
 #include "isisd/isisd.h"  #include "isisd/isisd.h"
 #include "isisd/isis_dynhn.h"  #include "isisd/isis_dynhn.h"
 #include "isisd/isis_adjacency.h"  #include "isisd/isis_adjacency.h"
Line 52 Line 54
 #include "isisd/isis_route.h"  #include "isisd/isis_route.h"
 #include "isisd/isis_zebra.h"  #include "isisd/isis_zebra.h"
 #include "isisd/isis_events.h"  #include "isisd/isis_events.h"
 #include "isisd/isis_csm.h"  
   
 #ifdef TOPOLOGY_GENERATE  #ifdef TOPOLOGY_GENERATE
 #include "spgrid.h"  #include "spgrid.h"
Line 60  u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE Line 61  u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE
 #endif /* TOPOLOGY_GENERATE */  #endif /* TOPOLOGY_GENERATE */
   
 struct isis *isis = NULL;  struct isis *isis = NULL;
 extern struct thread_master *master;  
   
 /*  /*
  * Prototypes.   * Prototypes.
  */   */
 void isis_new(unsigned long);  
 struct isis_area *isis_area_create(void);  
 int isis_area_get(struct vty *, const char *);  int isis_area_get(struct vty *, const char *);
 int isis_area_destroy(struct vty *, const char *);  int isis_area_destroy(struct vty *, const char *);
int area_net_title(struct vty *, const u_char *);int area_net_title(struct vty *, const char *);
int area_clear_net_title(struct vty *, const u_char *);int area_clear_net_title(struct vty *, const char *);
int show_clns_neigh(struct vty *, char);int show_isis_interface_common(struct vty *, const char *ifname, char);
void print_debug(struct vty *, int, int);int show_isis_neighbor_common(struct vty *, const char *id, char);
 int clear_isis_neighbor_common(struct vty *, const char *id);
 int isis_config_write(struct vty *);  int isis_config_write(struct vty *);
   
   
Line 85  isis_new (unsigned long process_id) Line 84  isis_new (unsigned long process_id)
    * Default values     * Default values
    */     */
   isis->max_area_addrs = 3;    isis->max_area_addrs = 3;
   
   isis->process_id = process_id;    isis->process_id = process_id;
     isis->router_id = 0;
   isis->area_list = list_new ();    isis->area_list = list_new ();
   isis->init_circ_list = list_new ();    isis->init_circ_list = list_new ();
   isis->uptime = time (NULL);    isis->uptime = time (NULL);
Line 94  isis_new (unsigned long process_id) Line 93  isis_new (unsigned long process_id)
 #ifdef HAVE_IPV6  #ifdef HAVE_IPV6
   isis->nexthops6 = list_new ();    isis->nexthops6 = list_new ();
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
     dyn_cache_init ();
   /*    /*
    * uncomment the next line for full debugs     * uncomment the next line for full debugs
    */     */
Line 101  isis_new (unsigned long process_id) Line 101  isis_new (unsigned long process_id)
 }  }
   
 struct isis_area *  struct isis_area *
isis_area_create ()isis_area_create (const char *area_tag)
 {  {
   struct isis_area *area;    struct isis_area *area;
   
Line 115  isis_area_create () Line 115  isis_area_create ()
     area->is_type = IS_LEVEL_1;      area->is_type = IS_LEVEL_1;
   else    else
     area->is_type = IS_LEVEL_1_AND_2;      area->is_type = IS_LEVEL_1_AND_2;
   
   /*    /*
    * intialize the databases     * intialize the databases
    */     */
  area->lspdb[0] = lsp_db_init ();  if (area->is_type & IS_LEVEL_1)
  area->lspdb[1] = lsp_db_init ();    {
      area->lspdb[0] = lsp_db_init ();
  spftree_area_init (area);      area->route_table[0] = route_table_init ();
  area->route_table[0] = route_table_init (); 
  area->route_table[1] = route_table_init (); 
 #ifdef HAVE_IPV6  #ifdef HAVE_IPV6
  area->route_table6[0] = route_table_init ();      area->route_table6[0] = route_table_init ();
  area->route_table6[1] = route_table_init (); 
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
       }
     if (area->is_type & IS_LEVEL_2)
       {
         area->lspdb[1] = lsp_db_init ();
         area->route_table[1] = route_table_init ();
   #ifdef HAVE_IPV6
         area->route_table6[1] = route_table_init ();
   #endif /* HAVE_IPV6 */
       }
   
     spftree_area_init (area);
   
   area->circuit_list = list_new ();    area->circuit_list = list_new ();
   area->area_addrs = list_new ();    area->area_addrs = list_new ();
   THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);    THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
   flags_initialize (&area->flags);    flags_initialize (&area->flags);
   
   /*    /*
    * Default values     * Default values
    */     */
  area->max_lsp_lifetime[0] = MAX_AGE;      /* 1200 */  area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME;      /* 1200 */
  area->max_lsp_lifetime[1] = MAX_AGE;      /* 1200 */  area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME;      /* 1200 */
  area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;  area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL;   /* 900 */
  area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;  area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL;   /* 900 */
  area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL;   /* 900 */  area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
  area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL;   /* 900 */  area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
   area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;    area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
   area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;    area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
   area->dynhostname = 1;    area->dynhostname = 1;
  area->oldmetric = 1;  area->oldmetric = 0;
   area->newmetric = 1;
   area->lsp_frag_threshold = 90;    area->lsp_frag_threshold = 90;
 #ifdef TOPOLOGY_GENERATE  #ifdef TOPOLOGY_GENERATE
   memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);    memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
Line 153  isis_area_create () Line 165  isis_area_create ()
   /* FIXME: Think of a better way... */    /* FIXME: Think of a better way... */
   area->min_bcast_mtu = 1497;    area->min_bcast_mtu = 1497;
   
     area->area_tag = strdup (area_tag);
     listnode_add (isis->area_list, area);
     area->isis = isis;
   
   return area;    return area;
 }  }
   
Line 185  isis_area_get (struct vty *vty, const char *area_tag) Line 201  isis_area_get (struct vty *vty, const char *area_tag)
       return CMD_SUCCESS;        return CMD_SUCCESS;
     }      }
   
  area = isis_area_create ();  area = isis_area_create (area_tag);
  area->area_tag = strdup (area_tag); 
  listnode_add (isis->area_list, area); 
   
   if (isis->debugs & DEBUG_EVENTS)    if (isis->debugs & DEBUG_EVENTS)
     zlog_debug ("New IS-IS area instance %s", area->area_tag);      zlog_debug ("New IS-IS area instance %s", area->area_tag);
Line 204  isis_area_destroy (struct vty *vty, const char *area_t Line 218  isis_area_destroy (struct vty *vty, const char *area_t
   struct isis_area *area;    struct isis_area *area;
   struct listnode *node, *nnode;    struct listnode *node, *nnode;
   struct isis_circuit *circuit;    struct isis_circuit *circuit;
     struct area_addr *addr;
   
   area = isis_area_lookup (area_tag);    area = isis_area_lookup (area_tag);
   
   if (area == NULL)    if (area == NULL)
     {      {
       vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);        vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   if (area->circuit_list)    if (area->circuit_list)
     {      {
       for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))        for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
        {        {
          /* The fact that it's in circuit_list means that it was configured */          circuit->ip_router = 0;
          isis_csm_state_change (ISIS_DISABLE, circuit, area);#ifdef HAVE_IPV6
          isis_circuit_down (circuit);          circuit->ipv6_router = 0;
          isis_circuit_deconfigure (circuit, area);#endif
        }          isis_csm_state_change (ISIS_DISABLE, circuit, area);
              }
       list_delete (area->circuit_list);        list_delete (area->circuit_list);
         area->circuit_list = NULL;
     }      }
   listnode_delete (isis->area_list, area);  
   
     if (area->lspdb[0] != NULL)
       {
         lsp_db_destroy (area->lspdb[0]);
         area->lspdb[0] = NULL;
       }
     if (area->lspdb[1] != NULL)
       {
         lsp_db_destroy (area->lspdb[1]);
         area->lspdb[1] = NULL;
       }
   
     spftree_area_del (area);
   
     /* invalidate and validate would delete all routes from zebra */
     isis_route_invalidate (area);
     isis_route_validate (area);
   
     if (area->route_table[0])
       {
         route_table_finish (area->route_table[0]);
         area->route_table[0] = NULL;
       }
     if (area->route_table[1])
       {
         route_table_finish (area->route_table[1]);
         area->route_table[1] = NULL;
       }
   #ifdef HAVE_IPV6
     if (area->route_table6[0])
       {
         route_table_finish (area->route_table6[0]);
         area->route_table6[0] = NULL;
       }
     if (area->route_table6[1])
       {
         route_table_finish (area->route_table6[1]);
         area->route_table6[1] = NULL;
       }
   #endif /* HAVE_IPV6 */
   
     for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addr))
       {
         list_delete_node (area->area_addrs, node);
         XFREE (MTYPE_ISIS_AREA_ADDR, addr);
       }
     area->area_addrs = NULL;
   
   THREAD_TIMER_OFF (area->t_tick);    THREAD_TIMER_OFF (area->t_tick);
   if (area->t_remove_aged)  
     thread_cancel (area->t_remove_aged);  
   THREAD_TIMER_OFF (area->t_lsp_refresh[0]);    THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
   THREAD_TIMER_OFF (area->t_lsp_refresh[1]);    THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
   
  THREAD_TIMER_OFF (area->spftree[0]->t_spf);  thread_cancel_event (master, area);
  THREAD_TIMER_OFF (area->spftree[1]->t_spf); 
   
  THREAD_TIMER_OFF (area->t_lsp_l1_regenerate);  listnode_delete (isis->area_list, area);
  THREAD_TIMER_OFF (area->t_lsp_l2_regenerate); 
   
     free (area->area_tag);
   
   XFREE (MTYPE_ISIS_AREA, area);    XFREE (MTYPE_ISIS_AREA, area);
   
  isis->sysid_set=0;  if (listcount (isis->area_list) == 0)
     {
       memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
       isis->sysid_set = 0;
     }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 int  int
area_net_title (struct vty *vty, const u_char *net_title)area_net_title (struct vty *vty, const char *net_title)
 {  {
   struct isis_area *area;    struct isis_area *area;
   struct area_addr *addr;    struct area_addr *addr;
Line 260  area_net_title (struct vty *vty, const u_char *net_tit Line 324  area_net_title (struct vty *vty, const u_char *net_tit
   if (!area)    if (!area)
     {      {
       vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);        vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   /* We check that we are not over the maximal number of addresses */    /* We check that we are not over the maximal number of addresses */
Line 268  area_net_title (struct vty *vty, const u_char *net_tit Line 332  area_net_title (struct vty *vty, const u_char *net_tit
     {      {
       vty_out (vty, "Maximum of area addresses (%d) already reached %s",        vty_out (vty, "Maximum of area addresses (%d) already reached %s",
                isis->max_area_addrs, VTY_NEWLINE);                 isis->max_area_addrs, VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NOTHING_TODO;
     }      }
   
   addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));    addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
Line 280  area_net_title (struct vty *vty, const u_char *net_tit Line 344  area_net_title (struct vty *vty, const u_char *net_tit
 #endif /* EXTREME_DEBUG */  #endif /* EXTREME_DEBUG */
   if (addr->addr_len < 8 || addr->addr_len > 20)    if (addr->addr_len < 8 || addr->addr_len > 20)
     {      {
      zlog_warn ("area address must be at least 8..20 octets long (%d)",      vty_out (vty, "area address must be at least 8..20 octets long (%d)%s",
                 addr->addr_len);               addr->addr_len, VTY_NEWLINE);
       XFREE (MTYPE_ISIS_AREA_ADDR, addr);        XFREE (MTYPE_ISIS_AREA_ADDR, addr);
      return CMD_WARNING;      return CMD_ERR_AMBIGUOUS;
     }      }
   
     if (addr->area_addr[addr->addr_len-1] != 0)
       {
         vty_out (vty, "nsel byte (last byte) in area address must be 0%s",
                  VTY_NEWLINE);
         XFREE (MTYPE_ISIS_AREA_ADDR, addr);
         return CMD_ERR_AMBIGUOUS;
       }
   
   if (isis->sysid_set == 0)    if (isis->sysid_set == 0)
     {      {
       /*        /*
        * First area address - get the SystemID for this router         * First area address - get the SystemID for this router
        */         */
      memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN);      memcpy (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN);
       isis->sysid_set = 1;        isis->sysid_set = 1;
       if (isis->debugs & DEBUG_EVENTS)        if (isis->debugs & DEBUG_EVENTS)
         zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));          zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
Line 301  area_net_title (struct vty *vty, const u_char *net_tit Line 373  area_net_title (struct vty *vty, const u_char *net_tit
       /*        /*
        * Check that the SystemID portions match         * Check that the SystemID portions match
        */         */
      if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN),      if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN))
                  ISIS_SYS_ID_LEN)) 
         {          {
           vty_out (vty,            vty_out (vty,
                    "System ID must not change when defining additional area"                     "System ID must not change when defining additional area"
                    " addresses%s", VTY_NEWLINE);                     " addresses%s", VTY_NEWLINE);
           XFREE (MTYPE_ISIS_AREA_ADDR, addr);            XFREE (MTYPE_ISIS_AREA_ADDR, addr);
          return CMD_WARNING;          return CMD_ERR_AMBIGUOUS;
         }          }
   
       /* now we see that we don't already have this address */        /* now we see that we don't already have this address */
       for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))        for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
         {          {
          if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) != (addr->addr_len))          if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) != (addr->addr_len))
             continue;              continue;
           if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))            if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
             {              {
Line 322  area_net_title (struct vty *vty, const u_char *net_tit Line 393  area_net_title (struct vty *vty, const u_char *net_tit
               return CMD_SUCCESS;       /* silent fail */                return CMD_SUCCESS;       /* silent fail */
             }              }
         }          }
   
     }      }
   
   /*    /*
    * Forget the systemID part of the address     * Forget the systemID part of the address
    */     */
  addr->addr_len -= (ISIS_SYS_ID_LEN + 1);  addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
   listnode_add (area->area_addrs, addr);    listnode_add (area->area_addrs, addr);
   
   /* only now we can safely generate our LSPs for this area */    /* only now we can safely generate our LSPs for this area */
   if (listcount (area->area_addrs) > 0)    if (listcount (area->area_addrs) > 0)
     {      {
      lsp_l1_generate (area);      if (area->is_type & IS_LEVEL_1)
      lsp_l2_generate (area);        lsp_generate (area, IS_LEVEL_1);
       if (area->is_type & IS_LEVEL_2)
         lsp_generate (area, IS_LEVEL_2);
     }      }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 int  int
area_clear_net_title (struct vty *vty, const u_char *net_title)area_clear_net_title (struct vty *vty, const char *net_title)
 {  {
   struct isis_area *area;    struct isis_area *area;
   struct area_addr addr, *addrp = NULL;    struct area_addr addr, *addrp = NULL;
Line 352  area_clear_net_title (struct vty *vty, const u_char *n Line 425  area_clear_net_title (struct vty *vty, const u_char *n
   if (!area)    if (!area)
     {      {
       vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);        vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   addr.addr_len = dotformat2buff (buff, net_title);    addr.addr_len = dotformat2buff (buff, net_title);
Line 360  area_clear_net_title (struct vty *vty, const u_char *n Line 433  area_clear_net_title (struct vty *vty, const u_char *n
     {      {
       vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",        vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
                addr.addr_len, VTY_NEWLINE);                 addr.addr_len, VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_AMBIGUOUS;
     }      }
   
   memcpy (addr.area_addr, buff, (int) addr.addr_len);    memcpy (addr.area_addr, buff, (int) addr.addr_len);
   
   for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))    for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
    if (addrp->addr_len == addr.addr_len &&    if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len &&
         !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))          !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
     break;      break;
   
Line 374  area_clear_net_title (struct vty *vty, const u_char *n Line 447  area_clear_net_title (struct vty *vty, const u_char *n
     {      {
       vty_out (vty, "No area address %s for area %s %s", net_title,        vty_out (vty, "No area address %s for area %s %s", net_title,
                area->area_tag, VTY_NEWLINE);                 area->area_tag, VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   listnode_delete (area->area_addrs, addrp);    listnode_delete (area->area_addrs, addrp);
     XFREE (MTYPE_ISIS_AREA_ADDR, addrp);
   
     /*
      * Last area address - reset the SystemID for this router
      */
     if (listcount (area->area_addrs) == 0)
       {
         memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
         isis->sysid_set = 0;
         if (isis->debugs & DEBUG_EVENTS)
           zlog_debug ("Router has no SystemID");
       }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 /*  /*
 * 'show clns neighbors' command * 'show isis interface' command
  */   */
   
 int  int
show_clns_neigh (struct vty *vty, char detail)show_isis_interface_common (struct vty *vty, const char *ifname, char detail)
 {  {
   struct listnode *anode, *cnode;    struct listnode *anode, *cnode;
   struct isis_area *area;    struct isis_area *area;
   struct isis_circuit *circuit;    struct isis_circuit *circuit;
   struct list *db;  
   int i;  
   
   if (!isis)    if (!isis)
     {      {
Line 406  show_clns_neigh (struct vty *vty, char detail) Line 489  show_clns_neigh (struct vty *vty, char detail)
       vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);        vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
   
       if (detail == ISIS_UI_LEVEL_BRIEF)        if (detail == ISIS_UI_LEVEL_BRIEF)
        vty_out (vty, "  System Id           Interface   L  State        "        vty_out (vty, "  Interface   CircId   State    Type     Level%s",
                 "Holdtime SNPA%s", VTY_NEWLINE);                 VTY_NEWLINE);
   
       for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))        for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
        {        if (!ifname)
          if (circuit->circ_type == CIRCUIT_T_BROADCAST)          isis_circuit_print_vty (circuit, vty, detail);
            {        else if (strcmp(circuit->interface->name, ifname) == 0)
              for (i = 0; i < 2; i++)          isis_circuit_print_vty (circuit, vty, detail);
                { 
                  db = circuit->u.bc.adjdb[i]; 
                  if (db && db->count) 
                    { 
                      if (detail == ISIS_UI_LEVEL_BRIEF) 
                        isis_adjdb_iterate (db, 
                                            (void (*) 
                                             (struct isis_adjacency *, 
                                              void *)) isis_adj_print_vty, 
                                            vty); 
                      if (detail == ISIS_UI_LEVEL_DETAIL) 
                        isis_adjdb_iterate (db, 
                                            (void (*) 
                                             (struct isis_adjacency *, 
                                              void *)) 
                                            isis_adj_print_vty_detail, vty); 
                      if (detail == ISIS_UI_LEVEL_EXTENSIVE) 
                        isis_adjdb_iterate (db, 
                                            (void (*) 
                                             (struct isis_adjacency *, 
                                              void *)) 
                                            isis_adj_print_vty_extensive, 
                                            vty); 
                    } 
                } 
            } 
          else if (circuit->circ_type == CIRCUIT_T_P2P && 
                   circuit->u.p2p.neighbor) 
            { 
              if (detail == ISIS_UI_LEVEL_BRIEF) 
                isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty); 
              if (detail == ISIS_UI_LEVEL_DETAIL) 
                isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty); 
              if (detail == ISIS_UI_LEVEL_EXTENSIVE) 
                isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor, 
                                                  vty); 
            } 
        } 
     }      }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
DEFUN (show_clns_neighbors,DEFUN (show_isis_interface,
       show_clns_neighbors_cmd,       show_isis_interface_cmd,
       "show clns neighbors",       "show isis interface",
        SHOW_STR         SHOW_STR
       "clns network information\n"       "ISIS network information\n"
       "CLNS neighbor adjacencies\n")       "ISIS interface\n")
 {  {
  return show_clns_neigh (vty, ISIS_UI_LEVEL_BRIEF);  return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
 }  }
   
ALIAS (show_clns_neighbors,DEFUN (show_isis_interface_detail,
       show_isis_neighbors_cmd,       show_isis_interface_detail_cmd,
       "show isis neighbors",       "show isis interface detail",
        SHOW_STR         SHOW_STR
       "IS-IS network information\n"       "ISIS network information\n"
       "IS-IS neighbor adjacencies\n")       "ISIS interface\n"
        "show detailed information\n")
 {
   return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
 }
   
DEFUN (show_clns_neighbors_detail,DEFUN (show_isis_interface_arg,
       show_clns_neighbors_detail_cmd,       show_isis_interface_arg_cmd,
       "show clns neighbors detail",       "show isis interface WORD",
        SHOW_STR         SHOW_STR
       "clns network information\n"       "ISIS network information\n"
       "CLNS neighbor adjacencies\n"       "ISIS interface\n"
       "show detailed information\n")       "ISIS interface name\n")
 {  {
  return show_clns_neigh (vty, ISIS_UI_LEVEL_DETAIL);  return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
 }  }
   
ALIAS (show_clns_neighbors_detail,/*
       show_isis_neighbors_detail_cmd, * 'show isis neighbor' command
       "show isis neighbors detail", */
 
 int
 show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
 {
   struct listnode *anode, *cnode, *node;
   struct isis_area *area;
   struct isis_circuit *circuit;
   struct list *adjdb;
   struct isis_adjacency *adj;
   struct isis_dynhn *dynhn;
   u_char sysid[ISIS_SYS_ID_LEN];
   int i;
 
   if (!isis)
     {
       vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
       return CMD_SUCCESS;
     }
 
   memset (sysid, 0, ISIS_SYS_ID_LEN);
   if (id)
     {
       if (sysid2buff (sysid, id) == 0)
         {
           dynhn = dynhn_find_by_name (id);
           if (dynhn == NULL)
             {
               vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
               return CMD_SUCCESS;
             }
           memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
         }
     }
 
   for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
     {
       vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
 
       if (detail == ISIS_UI_LEVEL_BRIEF)
         vty_out (vty, "  System Id           Interface   L  State"
                       "        Holdtime SNPA%s", VTY_NEWLINE);
 
       for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
         {
           if (circuit->circ_type == CIRCUIT_T_BROADCAST)
             {
               for (i = 0; i < 2; i++)
                 {
                   adjdb = circuit->u.bc.adjdb[i];
                   if (adjdb && adjdb->count)
                     {
                       for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj))
                         if (!id || !memcmp (adj->sysid, sysid,
                                             ISIS_SYS_ID_LEN))
                           isis_adj_print_vty (adj, vty, detail);
                     }
                 }
             }
           else if (circuit->circ_type == CIRCUIT_T_P2P &&
                    circuit->u.p2p.neighbor)
             {
               adj = circuit->u.p2p.neighbor;
               if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
                 isis_adj_print_vty (adj, vty, detail);
             }
         }
     }
 
   return CMD_SUCCESS;
 }
 
 /*
  * 'clear isis neighbor' command
  */
 int
 clear_isis_neighbor_common (struct vty *vty, const char *id)
 {
   struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
   struct isis_area *area;
   struct isis_circuit *circuit;
   struct list *adjdb;
   struct isis_adjacency *adj;
   struct isis_dynhn *dynhn;
   u_char sysid[ISIS_SYS_ID_LEN];
   int i;
 
   if (!isis)
     {
       vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
       return CMD_SUCCESS;
     }
 
   memset (sysid, 0, ISIS_SYS_ID_LEN);
   if (id)
     {
       if (sysid2buff (sysid, id) == 0)
         {
           dynhn = dynhn_find_by_name (id);
           if (dynhn == NULL)
             {
               vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
               return CMD_SUCCESS;
             }
           memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
         }
     }
 
   for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
     {
       for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnextnode, circuit))
         {
           if (circuit->circ_type == CIRCUIT_T_BROADCAST)
             {
               for (i = 0; i < 2; i++)
                 {
                   adjdb = circuit->u.bc.adjdb[i];
                   if (adjdb && adjdb->count)
                     {
                       for (ALL_LIST_ELEMENTS (adjdb, node, nnode, adj))
                         if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
                           isis_adj_state_change (adj, ISIS_ADJ_DOWN,
                                                  "clear user request");
                     }
                 }
             }
           else if (circuit->circ_type == CIRCUIT_T_P2P &&
                    circuit->u.p2p.neighbor)
             {
               adj = circuit->u.p2p.neighbor;
               if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
                 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
                                        "clear user request");
             }
         }
     }
 
   return CMD_SUCCESS;
 }
 
 DEFUN (show_isis_neighbor,
        show_isis_neighbor_cmd,
        "show isis neighbor",
        SHOW_STR         SHOW_STR
       "IS-IS network information\n"       "ISIS network information\n"
       "IS-IS neighbor adjacencies\n"       "ISIS neighbor adjacencies\n")
 {
   return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
 }
 
 DEFUN (show_isis_neighbor_detail,
        show_isis_neighbor_detail_cmd,
        "show isis neighbor detail",
        SHOW_STR
        "ISIS network information\n"
        "ISIS neighbor adjacencies\n"
        "show detailed information\n")         "show detailed information\n")
   {
     return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
   }
   
   DEFUN (show_isis_neighbor_arg,
          show_isis_neighbor_arg_cmd,
          "show isis neighbor WORD",
          SHOW_STR
          "ISIS network information\n"
          "ISIS neighbor adjacencies\n"
          "System id\n")
   {
     return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
   }
   
   DEFUN (clear_isis_neighbor,
          clear_isis_neighbor_cmd,
          "clear isis neighbor",
          CLEAR_STR
          "Reset ISIS network information\n"
          "Reset ISIS neighbor adjacencies\n")
   {
     return clear_isis_neighbor_common (vty, NULL);
   }
   
   DEFUN (clear_isis_neighbor_arg,
          clear_isis_neighbor_arg_cmd,
          "clear isis neighbor WORD",
          CLEAR_STR
          "ISIS network information\n"
          "ISIS neighbor adjacencies\n"
          "System id\n")
   {
     return clear_isis_neighbor_common (vty, argv[0]);
   }
   
 /*  /*
  * 'isis debug', 'show debugging'   * 'isis debug', 'show debugging'
  */   */
Line 535  print_debug (struct vty *vty, int flags, int onoff) Line 772  print_debug (struct vty *vty, int flags, int onoff)
              VTY_NEWLINE);               VTY_NEWLINE);
   if (flags & DEBUG_EVENTS)    if (flags & DEBUG_EVENTS)
     vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);      vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
  if (flags & DEBUG_PACKET_DUMP)
     vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE);
 }  }
   
 DEFUN (show_debugging,  DEFUN (show_debugging,
Line 617  config_write_debug (struct vty *vty) Line 855  config_write_debug (struct vty *vty)
       vty_out (vty, "debug isis events%s", VTY_NEWLINE);        vty_out (vty, "debug isis events%s", VTY_NEWLINE);
       write++;        write++;
     }      }
     if (flags & DEBUG_PACKET_DUMP)
       {
         vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE);
         write++;
       }
   
   return write;    return write;
 }  }
Line 803  DEFUN (no_debug_isis_spfevents, Line 1046  DEFUN (no_debug_isis_spfevents,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   
 DEFUN (debug_isis_spfstats,  DEFUN (debug_isis_spfstats,
        debug_isis_spfstats_cmd,         debug_isis_spfstats_cmd,
        "debug isis spf-statistics ",         "debug isis spf-statistics ",
Line 908  DEFUN (no_debug_isis_events, Line 1150  DEFUN (no_debug_isis_events,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   DEFUN (debug_isis_packet_dump,
          debug_isis_packet_dump_cmd,
          "debug isis packet-dump",
          DEBUG_STR
          "IS-IS information\n"
          "IS-IS packet dump\n")
   {
     isis->debugs |= DEBUG_PACKET_DUMP;
     print_debug (vty, DEBUG_PACKET_DUMP, 1);
   
     return CMD_SUCCESS;
   }
   
   DEFUN (no_debug_isis_packet_dump,
          no_debug_isis_packet_dump_cmd,
          "no debug isis packet-dump",
          UNDEBUG_STR
          "IS-IS information\n"
          "IS-IS packet dump\n")
   {
     isis->debugs &= ~DEBUG_PACKET_DUMP;
     print_debug (vty, DEBUG_PACKET_DUMP, 0);
   
     return CMD_SUCCESS;
   }
   
 DEFUN (show_hostname,  DEFUN (show_hostname,
        show_hostname_cmd,         show_hostname_cmd,
        "show isis hostname",         "show isis hostname",
Line 920  DEFUN (show_hostname, Line 1188  DEFUN (show_hostname,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
DEFUN (show_database,static void
       show_database_cmd,vty_out_timestr(struct vty *vty, time_t uptime)
       "show isis database", 
       SHOW_STR "IS-IS information\n" "IS-IS link state database\n") 
 {  {
  struct listnode *node;  struct tm *tm;
   time_t difftime = time (NULL);
   difftime -= uptime;
   tm = gmtime (&difftime);
 
 #define ONE_DAY_SECOND 60*60*24
 #define ONE_WEEK_SECOND 60*60*24*7
   if (difftime < ONE_DAY_SECOND)
     vty_out (vty,  "%02d:%02d:%02d", 
         tm->tm_hour, tm->tm_min, tm->tm_sec);
   else if (difftime < ONE_WEEK_SECOND)
     vty_out (vty, "%dd%02dh%02dm", 
         tm->tm_yday, tm->tm_hour, tm->tm_min);
   else
     vty_out (vty, "%02dw%dd%02dh", 
         tm->tm_yday/7,
         tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
   vty_out (vty, " ago");
 }
 
 DEFUN (show_isis_summary,
        show_isis_summary_cmd,
        "show isis summary",
        SHOW_STR "IS-IS information\n" "IS-IS summary\n")
 {
   struct listnode *node, *node2;
   struct isis_area *area;    struct isis_area *area;
  int level, lsp_count;  struct isis_spftree *spftree;
   int level;
   
  if (isis->area_list->count == 0)  if (isis == NULL)
   {
     vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
     return CMD_SUCCESS;      return CMD_SUCCESS;
     }
   
     vty_out (vty, "Process Id      : %ld%s", isis->process_id,
         VTY_NEWLINE);
     if (isis->sysid_set)
       vty_out (vty, "System Id       : %s%s", sysid_print (isis->sysid),
           VTY_NEWLINE);
   
     vty_out (vty, "Up time         : ");
     vty_out_timestr(vty, isis->uptime);
     vty_out (vty, "%s", VTY_NEWLINE);
   
     if (isis->area_list)
       vty_out (vty, "Number of areas : %d%s", isis->area_list->count,
           VTY_NEWLINE);
   
   for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))    for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
     {
       vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
           VTY_NEWLINE);
   
       if (listcount (area->area_addrs) > 0)
     {      {
      vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",      struct area_addr *area_addr;
               VTY_NEWLINE);      for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
      for (level = 0; level < ISIS_LEVELS; level++)      {
        {        vty_out (vty, "  Net: %s%s",
          if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)            isonet_print (area_addr->area_addr,
            {              area_addr->addr_len + ISIS_SYS_ID_LEN +
              vty_out (vty, "IS-IS Level-%d link-state database:%s",              1), VTY_NEWLINE);
                       level + 1, VTY_NEWLINE);      }
     }
   
              lsp_count = lsp_print_all (vty, area->lspdb[level],    for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
                                         ISIS_UI_LEVEL_BRIEF,    {
                                         area->dynhostname);      if ((area->is_type & level) == 0)
         continue;
   
              vty_out (vty, "%s    %u LSPs%s%s",      vty_out (vty, "  Level-%d:%s", level, VTY_NEWLINE);
                       VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);      spftree = area->spftree[level - 1];
            }      if (spftree->pending)
        }        vty_out (vty, "    IPv4 SPF: (pending)%s", VTY_NEWLINE);
       else
         vty_out (vty, "    IPv4 SPF:%s", VTY_NEWLINE);
 
       vty_out (vty, "      minimum interval  : %d%s",
           area->min_spf_interval[level - 1], VTY_NEWLINE);
 
       vty_out (vty, "      last run elapsed  : ");
       vty_out_timestr(vty, spftree->last_run_timestamp);
       vty_out (vty, "%s", VTY_NEWLINE);
 
       vty_out (vty, "      last run duration : %u usec%s",
                (u_int32_t)spftree->last_run_duration, VTY_NEWLINE);
 
       vty_out (vty, "      run count         : %d%s",
           spftree->runcount, VTY_NEWLINE);
 
 #ifdef HAVE_IPV6
       spftree = area->spftree6[level - 1];
       if (spftree->pending)
         vty_out (vty, "    IPv6 SPF: (pending)%s", VTY_NEWLINE);
       else
         vty_out (vty, "    IPv6 SPF:%s", VTY_NEWLINE);
 
       vty_out (vty, "      minimum interval  : %d%s",
           area->min_spf_interval[level - 1], VTY_NEWLINE);
 
       vty_out (vty, "      last run elapsed  : ");
       vty_out_timestr(vty, spftree->last_run_timestamp);
       vty_out (vty, "%s", VTY_NEWLINE);
 
       vty_out (vty, "      last run duration : %u msec%s",
                spftree->last_run_duration, VTY_NEWLINE);
 
       vty_out (vty, "      run count         : %d%s",
           spftree->runcount, VTY_NEWLINE);
 #endif
     }      }
     }
     vty_out (vty, "%s", VTY_NEWLINE);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
DEFUN (show_database_detail,/*
       show_database_detail_cmd, * This function supports following display options:
       "show isis database detail", * [ show isis database [detail] ]
       SHOW_STR * [ show isis database <sysid> [detail] ]
       "IS-IS information\n" * [ show isis database <hostname> [detail] ]
       "IS-IS link state database\n") * [ show isis database <sysid>.<pseudo-id> [detail] ]
  * [ show isis database <hostname>.<pseudo-id> [detail] ]
  * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
  * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
  * [ show isis database detail <sysid> ]
  * [ show isis database detail <hostname> ]
  * [ show isis database detail <sysid>.<pseudo-id> ]
  * [ show isis database detail <hostname>.<pseudo-id> ]
  * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
  * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
  */
 static int
 show_isis_database (struct vty *vty, const char *argv, int ui_level)
 {  {
   struct listnode *node;    struct listnode *node;
   struct isis_area *area;    struct isis_area *area;
     struct isis_lsp *lsp;
     struct isis_dynhn *dynhn;
     const char *pos = argv;
     u_char lspid[ISIS_SYS_ID_LEN+2];
     char sysid[255];
     u_char number[3];
   int level, lsp_count;    int level, lsp_count;
   
   if (isis->area_list->count == 0)    if (isis->area_list->count == 0)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
     memset (&lspid, 0, ISIS_SYS_ID_LEN);
     memset (&sysid, 0, 255);
   
     /*
      * extract fragment and pseudo id from the string argv
      * in the forms:
      * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
      * (b) <systemid/hostname>.<pseudo-id> or
      * (c) <systemid/hostname> or
      * Where systemid is in the form:
      * xxxx.xxxx.xxxx
      */
     if (argv)
        strncpy (sysid, argv, 254);
     if (argv && strlen (argv) > 3)
       {
         pos = argv + strlen (argv) - 3;
         if (strncmp (pos, "-", 1) == 0)
         {
           memcpy (number, ++pos, 2);
           lspid[ISIS_SYS_ID_LEN+1] = (u_char) strtol ((char *)number, NULL, 16);
           pos -= 4;
           if (strncmp (pos, ".", 1) != 0)
             return CMD_ERR_AMBIGUOUS;
         }
         if (strncmp (pos, ".", 1) == 0)
         {
           memcpy (number, ++pos, 2);
           lspid[ISIS_SYS_ID_LEN] = (u_char) strtol ((char *)number, NULL, 16);
           sysid[pos - argv - 1] = '\0';
         }
       }
   
   for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))    for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
     {      {
       vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",        vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
               VTY_NEWLINE);               VTY_NEWLINE);
 
       for (level = 0; level < ISIS_LEVELS; level++)        for (level = 0; level < ISIS_LEVELS; level++)
        {        {
          if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)          if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
            {            {
              vty_out (vty, "IS-IS Level-%d Link State Database:%s",              lsp = NULL;
                       level + 1, VTY_NEWLINE);              if (argv != NULL)
                 {
                   /*
                    * Try to find the lsp-id if the argv string is in
                    * the form hostname.<pseudo-id>-<fragment>
                    */
                   if (sysid2buff (lspid, sysid))
                     {
                       lsp = lsp_search (lspid, area->lspdb[level]);
                     }
                   else if ((dynhn = dynhn_find_by_name (sysid)))
                     {
                       memcpy (lspid, dynhn->id, ISIS_SYS_ID_LEN);
                       lsp = lsp_search (lspid, area->lspdb[level]);
                     }
                   else if (strncmp(unix_hostname (), sysid, 15) == 0)
                     {
                       memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
                       lsp = lsp_search (lspid, area->lspdb[level]);
                     }
                 }
   
              lsp_count = lsp_print_all (vty, area->lspdb[level],              if (lsp != NULL || argv == NULL)
                                         ISIS_UI_LEVEL_DETAIL,                {
                                         area->dynhostname);                  vty_out (vty, "IS-IS Level-%d link-state database:%s",
                            level + 1, VTY_NEWLINE);
   
              vty_out (vty, "%s    %u LSPs%s%s",                  /* print the title in all cases */
                       VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);                  vty_out (vty, "LSP ID                  PduLen  "
            }                           "SeqNumber   Chksum  Holdtime  ATT/P/OL%s",
        }                           VTY_NEWLINE);
                 }
 
               if (lsp)
                 {
                   if (ui_level == ISIS_UI_LEVEL_DETAIL)
                     lsp_print_detail (lsp, vty, area->dynhostname);
                   else
                     lsp_print (lsp, vty, area->dynhostname);
                 }
               else if (argv == NULL)
                 {
                   lsp_count = lsp_print_all (vty, area->lspdb[level],
                                              ui_level,
                                              area->dynhostname);
 
                   vty_out (vty, "    %u LSPs%s%s",
                            lsp_count, VTY_NEWLINE, VTY_NEWLINE);
                 }
             }
         }
     }      }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   DEFUN (show_database_brief,
          show_database_cmd,
          "show isis database",
          SHOW_STR
          "IS-IS information\n"
          "IS-IS link state database\n")
   {
     return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF);
   }
   
   DEFUN (show_database_lsp_brief,
          show_database_arg_cmd,
          "show isis database WORD",
          SHOW_STR
          "IS-IS information\n"
          "IS-IS link state database\n"
          "LSP ID\n")
   {
     return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF);
   }
   
   DEFUN (show_database_lsp_detail,
          show_database_arg_detail_cmd,
          "show isis database WORD detail",
          SHOW_STR
          "IS-IS information\n"
          "IS-IS link state database\n"
          "LSP ID\n"
          "Detailed information\n")
   {
     return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
   }
   
   DEFUN (show_database_detail,
          show_database_detail_cmd,
          "show isis database detail",
          SHOW_STR
          "IS-IS information\n"
          "IS-IS link state database\n")
   {
     return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL);
   }
   
   DEFUN (show_database_detail_lsp,
          show_database_detail_arg_cmd,
          "show isis database detail WORD",
          SHOW_STR
          "IS-IS information\n"
          "IS-IS link state database\n"
          "Detailed information\n"
          "LSP ID\n")
   {
     return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
   }
   
 /*   /* 
  * 'router isis' command    * 'router isis' command 
  */   */
Line 1043  DEFUN (no_net, Line 1545  DEFUN (no_net,
   return area_clear_net_title (vty, argv[0]);    return area_clear_net_title (vty, argv[0]);
 }  }
   
DEFUN (area_passwd,DEFUN (area_passwd_md5,
       area_passwd_cmd,       area_passwd_md5_cmd,
       "area-password WORD",       "area-password md5 WORD",
        "Configure the authentication password for an area\n"         "Configure the authentication password for an area\n"
          "Authentication type\n"
        "Area password\n")         "Area password\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
Line 1056  DEFUN (area_passwd, Line 1559  DEFUN (area_passwd,
   
   if (!area)    if (!area)
     {      {
      vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);      vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   len = strlen (argv[0]);    len = strlen (argv[0]);
   if (len > 254)    if (len > 254)
     {      {
       vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);        vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_AMBIGUOUS;
     }      }
   
   area->area_passwd.len = (u_char) len;    area->area_passwd.len = (u_char) len;
     area->area_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
     strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
   
     if (argc > 1)
       {
         SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
         if (strncmp(argv[1], "v", 1) == 0)
           SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
         else
           UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
       }
     else
       {
         UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
         UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
       }
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
     return CMD_SUCCESS;
   }
   
   ALIAS (area_passwd_md5,
          area_passwd_md5_snpauth_cmd,
          "area-password md5 WORD authenticate snp (send-only|validate)",
          "Configure the authentication password for an area\n"
          "Authentication type\n"
          "Area password\n"
          "Authentication\n"
          "SNP PDUs\n"
          "Send but do not check PDUs on receiving\n"
          "Send and check PDUs on receiving\n");
   
   DEFUN (area_passwd_clear,
          area_passwd_clear_cmd,
          "area-password clear WORD",
          "Configure the authentication password for an area\n"
          "Authentication type\n"
          "Area password\n")
   {
     struct isis_area *area;
     int len;
   
     area = vty->index;
   
     if (!area)
       {
         vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
         return CMD_ERR_NO_MATCH;
       }
   
     len = strlen (argv[0]);
     if (len > 254)
       {
         vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
         return CMD_ERR_AMBIGUOUS;
       }
   
     area->area_passwd.len = (u_char) len;
   area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;    area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
   strncpy ((char *)area->area_passwd.passwd, argv[0], 255);    strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
   
Line 1083  DEFUN (area_passwd, Line 1645  DEFUN (area_passwd,
       UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);        UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
       UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);        UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
     }      }
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
ALIAS (area_passwd,ALIAS (area_passwd_clear,
       area_passwd_snpauth_cmd,       area_passwd_clear_snpauth_cmd,
       "area-password WORD authenticate snp (send-only|validate)",       "area-password clear WORD authenticate snp (send-only|validate)",
        "Configure the authentication password for an area\n"         "Configure the authentication password for an area\n"
          "Authentication type\n"
        "Area password\n"         "Area password\n"
        "Authentication\n"         "Authentication\n"
        "SNP PDUs\n"         "SNP PDUs\n"
Line 1109  DEFUN (no_area_passwd, Line 1673  DEFUN (no_area_passwd,
   
   if (!area)    if (!area)
     {      {
      vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);      vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   memset (&area->area_passwd, 0, sizeof (struct isis_passwd));    memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
DEFUN (domain_passwd,DEFUN (domain_passwd_md5,
       domain_passwd_cmd,       domain_passwd_md5_cmd,
       "domain-password WORD",       "domain-password md5 WORD",
        "Set the authentication password for a routing domain\n"         "Set the authentication password for a routing domain\n"
          "Authentication type\n"
        "Routing domain password\n")         "Routing domain password\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
Line 1131  DEFUN (domain_passwd, Line 1697  DEFUN (domain_passwd,
   
   if (!area)    if (!area)
     {      {
      vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);      vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   len = strlen (argv[0]);    len = strlen (argv[0]);
   if (len > 254)    if (len > 254)
     {      {
       vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);        vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_AMBIGUOUS;
     }      }
   
   area->domain_passwd.len = (u_char) len;    area->domain_passwd.len = (u_char) len;
     area->domain_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
     strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
   
     if (argc > 1)
       {
         SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
         if (strncmp(argv[1], "v", 1) == 0)
           SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
         else
           UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
       }
     else
       {
         UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
         UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
       }
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
     return CMD_SUCCESS;
   }
   
   ALIAS (domain_passwd_md5,
          domain_passwd_md5_snpauth_cmd,
          "domain-password md5 WORD authenticate snp (send-only|validate)",
          "Set the authentication password for a routing domain\n"
          "Authentication type\n"
          "Routing domain password\n"
          "Authentication\n"
          "SNP PDUs\n"
          "Send but do not check PDUs on receiving\n"
          "Send and check PDUs on receiving\n");
   
   DEFUN (domain_passwd_clear,
          domain_passwd_clear_cmd,
          "domain-password clear WORD",
          "Set the authentication password for a routing domain\n"
          "Authentication type\n"
          "Routing domain password\n")
   {
     struct isis_area *area;
     int len;
   
     area = vty->index;
   
     if (!area)
       {
         vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
         return CMD_ERR_NO_MATCH;
       }
   
     len = strlen (argv[0]);
     if (len > 254)
       {
         vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
         return CMD_ERR_AMBIGUOUS;
       }
   
     area->domain_passwd.len = (u_char) len;
   area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;    area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
   strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);    strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
   
Line 1158  DEFUN (domain_passwd, Line 1783  DEFUN (domain_passwd,
       UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);        UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
       UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);        UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
     }      }
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
ALIAS (domain_passwd,ALIAS (domain_passwd_clear,
       domain_passwd_snpauth_cmd,       domain_passwd_clear_snpauth_cmd,
       "domain-password WORD authenticate snp (send-only|validate)",       "domain-password clear WORD authenticate snp (send-only|validate)",
        "Set the authentication password for a routing domain\n"         "Set the authentication password for a routing domain\n"
          "Authentication type\n"
        "Routing domain password\n"         "Routing domain password\n"
        "Authentication\n"         "Authentication\n"
        "SNP PDUs\n"         "SNP PDUs\n"
Line 1174  ALIAS (domain_passwd, Line 1801  ALIAS (domain_passwd,
   
 DEFUN (no_domain_passwd,  DEFUN (no_domain_passwd,
        no_domain_passwd_cmd,         no_domain_passwd_cmd,
       "no domain-password WORD",       "no domain-password",
        NO_STR         NO_STR
        "Set the authentication password for a routing domain\n")         "Set the authentication password for a routing domain\n")
 {  {
Line 1184  DEFUN (no_domain_passwd, Line 1811  DEFUN (no_domain_passwd,
   
   if (!area)    if (!area)
     {      {
      vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);      vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));    memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 1208  DEFUN (is_type, Line 1836  DEFUN (is_type,
   
   if (!area)    if (!area)
     {      {
      vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);      vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
      return CMD_WARNING;      return CMD_ERR_NO_MATCH;
     }      }
   
   type = string2circuit_t (argv[0]);    type = string2circuit_t (argv[0]);
Line 1240  DEFUN (no_is_type, Line 1868  DEFUN (no_is_type,
   assert (area);    assert (area);
   
   /*    /*
   * Put the is-type back to default. Which is level-1-2 on first   * Put the is-type back to defaults:
   * circuit for the area level-1 for the rest   * - level-1-2 on first area
    * - level-1 for the rest
    */     */
   if (listgetdata (listhead (isis->area_list)) == area)    if (listgetdata (listhead (isis->area_list)) == area)
     type = IS_LEVEL_1_AND_2;      type = IS_LEVEL_1_AND_2;
Line 1253  DEFUN (no_is_type, Line 1882  DEFUN (no_is_type,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   static int
   set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
                         uint16_t interval, int level)
   {
     int lvl;
   
     for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
       {
         if (!(lvl & level))
           continue;
   
         if (interval >= area->lsp_refresh[lvl-1])
           {
             vty_out (vty, "LSP gen interval %us must be less than "
                      "the LSP refresh interval %us%s",
                      interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
             return CMD_ERR_AMBIGUOUS;
           }
       }
   
     for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
       {
         if (!(lvl & level))
           continue;
         area->lsp_gen_interval[lvl-1] = interval;
       }
   
     return CMD_SUCCESS;
   }
   
 DEFUN (lsp_gen_interval,  DEFUN (lsp_gen_interval,
        lsp_gen_interval_cmd,         lsp_gen_interval_cmd,
        "lsp-gen-interval <1-120>",         "lsp-gen-interval <1-120>",
Line 1261  DEFUN (lsp_gen_interval, Line 1920  DEFUN (lsp_gen_interval,
 {  {
   struct isis_area *area;    struct isis_area *area;
   uint16_t interval;    uint16_t interval;
     int level;
   
   area = vty->index;    area = vty->index;
   assert (area);  
   
   interval = atoi (argv[0]);    interval = atoi (argv[0]);
  area->lsp_gen_interval[0] = interval;  level = IS_LEVEL_1 | IS_LEVEL_2;
  area->lsp_gen_interval[1] = interval;  return set_lsp_gen_interval (vty, area, interval, level);
 
  return CMD_SUCCESS; 
 }  }
   
 DEFUN (no_lsp_gen_interval,  DEFUN (no_lsp_gen_interval,
Line 1279  DEFUN (no_lsp_gen_interval, Line 1935  DEFUN (no_lsp_gen_interval,
        "Minimum interval between regenerating same LSP\n")         "Minimum interval between regenerating same LSP\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
     uint16_t interval;
     int level;
   
   area = vty->index;    area = vty->index;
  assert (area);  interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
  level = IS_LEVEL_1 | IS_LEVEL_2;
  area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;  return set_lsp_gen_interval (vty, area, interval, level);
  area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; 
 
  return CMD_SUCCESS; 
 }  }
   
 ALIAS (no_lsp_gen_interval,  ALIAS (no_lsp_gen_interval,
Line 1305  DEFUN (lsp_gen_interval_l1, Line 1960  DEFUN (lsp_gen_interval_l1,
 {  {
   struct isis_area *area;    struct isis_area *area;
   uint16_t interval;    uint16_t interval;
     int level;
   
   area = vty->index;    area = vty->index;
   assert (area);  
   
   interval = atoi (argv[0]);    interval = atoi (argv[0]);
  area->lsp_gen_interval[0] = interval;  level = IS_LEVEL_1;
  return set_lsp_gen_interval (vty, area, interval, level);
  return CMD_SUCCESS; 
 }  }
   
 DEFUN (no_lsp_gen_interval_l1,  DEFUN (no_lsp_gen_interval_l1,
Line 1323  DEFUN (no_lsp_gen_interval_l1, Line 1976  DEFUN (no_lsp_gen_interval_l1,
        "Set interval for level 1 only\n")         "Set interval for level 1 only\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
     uint16_t interval;
     int level;
   
   area = vty->index;    area = vty->index;
  assert (area);  interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
  level = IS_LEVEL_1;
  area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;  return set_lsp_gen_interval (vty, area, interval, level);
 
  return CMD_SUCCESS; 
 }  }
   
 ALIAS (no_lsp_gen_interval_l1,  ALIAS (no_lsp_gen_interval_l1,
Line 1348  DEFUN (lsp_gen_interval_l2, Line 2001  DEFUN (lsp_gen_interval_l2,
        "Minimum interval in seconds\n")         "Minimum interval in seconds\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
  int interval;  uint16_t interval;
   int level;
   
   area = vty->index;    area = vty->index;
   assert (area);  
   
   interval = atoi (argv[0]);    interval = atoi (argv[0]);
  area->lsp_gen_interval[1] = interval;  level = IS_LEVEL_2;
  return set_lsp_gen_interval (vty, area, interval, level);
  return CMD_SUCCESS; 
 }  }
   
 DEFUN (no_lsp_gen_interval_l2,  DEFUN (no_lsp_gen_interval_l2,
Line 1367  DEFUN (no_lsp_gen_interval_l2, Line 2018  DEFUN (no_lsp_gen_interval_l2,
        "Set interval for level 2 only\n")         "Set interval for level 2 only\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
  int interval;  uint16_t interval;
   int level;
   
   area = vty->index;    area = vty->index;
  assert (area);  interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
  level = IS_LEVEL_2;
  interval = atoi (argv[0]);  return set_lsp_gen_interval (vty, area, interval, level);
  area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; 
 
  return CMD_SUCCESS; 
 }  }
   
 ALIAS (no_lsp_gen_interval_l2,  ALIAS (no_lsp_gen_interval_l2,
Line 1386  ALIAS (no_lsp_gen_interval_l2, Line 2035  ALIAS (no_lsp_gen_interval_l2,
        "Set interval for level 2 only\n"         "Set interval for level 2 only\n"
        "Minimum interval in seconds\n")         "Minimum interval in seconds\n")
   
   static int
   validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
   {
     struct isis_circuit *circuit;
     struct listnode *node;
     
     if (! vty)
       return CMD_ERR_AMBIGUOUS;
   
     if (! area)
       {
         vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
         return CMD_ERR_AMBIGUOUS;
       }
   
     for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
       {
         if ((area->is_type & IS_LEVEL_1) &&
             (circuit->is_type & IS_LEVEL_1) &&
             (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
           {
             vty_out (vty, "ISIS circuit %s metric is invalid%s",
                      circuit->interface->name, VTY_NEWLINE);
             return CMD_ERR_AMBIGUOUS;
           }
         if ((area->is_type & IS_LEVEL_2) &&
             (circuit->is_type & IS_LEVEL_2) &&
             (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
           {
             vty_out (vty, "ISIS circuit %s metric is invalid%s",
                      circuit->interface->name, VTY_NEWLINE);
             return CMD_ERR_AMBIGUOUS;
           }
       }
   
     return CMD_SUCCESS;
   }
   
 DEFUN (metric_style,  DEFUN (metric_style,
        metric_style_cmd,         metric_style_cmd,
        "metric-style (narrow|transition|wide)",         "metric-style (narrow|transition|wide)",
Line 1395  DEFUN (metric_style, Line 2082  DEFUN (metric_style,
        "Use new style of TLVs to carry wider metric\n")         "Use new style of TLVs to carry wider metric\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
     int ret;
   
   area = vty->index;    area = vty->index;
   assert (area);    assert (area);
Line 1404  DEFUN (metric_style, Line 2092  DEFUN (metric_style,
       area->newmetric = 1;        area->newmetric = 1;
       area->oldmetric = 0;        area->oldmetric = 0;
     }      }
  else if (strncmp (argv[0], "t", 1) == 0)  else
     {      {
      area->newmetric = 1;      ret = validate_metric_style_narrow (vty, area);
      area->oldmetric = 1;      if (ret != CMD_SUCCESS)
         return ret;
 
       if (strncmp (argv[0], "t", 1) == 0)
         {
           area->newmetric = 1;
           area->oldmetric = 1;
         }
       else if (strncmp (argv[0], "n", 1) == 0)
         {
           area->newmetric = 0;
           area->oldmetric = 1;
         }
     }      }
   else if (strncmp (argv[0], "n", 1) == 0)  
     {  
       area->newmetric = 0;  
       area->oldmetric = 1;  
     }  
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 1425  DEFUN (no_metric_style, Line 2120  DEFUN (no_metric_style,
        "Use old-style (ISO 10589) or new-style packet formats\n")         "Use old-style (ISO 10589) or new-style packet formats\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
     int ret;
   
   area = vty->index;    area = vty->index;
   assert (area);    assert (area);
   
     ret = validate_metric_style_narrow (vty, area);
     if (ret != CMD_SUCCESS)
       return ret;
   
   /* Default is narrow metric. */    /* Default is narrow metric. */
   area->newmetric = 0;    area->newmetric = 0;
   area->oldmetric = 1;    area->oldmetric = 1;
Line 1436  DEFUN (no_metric_style, Line 2136  DEFUN (no_metric_style,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   DEFUN (set_overload_bit,
          set_overload_bit_cmd,
          "set-overload-bit",
          "Set overload bit to avoid any transit traffic\n"
          "Set overload bit\n")
   {
     struct isis_area *area;
   
     area = vty->index;
     assert (area);
   
     area->overload_bit = LSPBIT_OL;
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
     return CMD_SUCCESS;
   }
   
   DEFUN (no_set_overload_bit,
          no_set_overload_bit_cmd,
          "no set-overload-bit",
          "Reset overload bit to accept transit traffic\n"
          "Reset overload bit\n")
   {
     struct isis_area *area;
   
     area = vty->index;
     assert (area);
   
     area->overload_bit = 0;
     lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
   
     return CMD_SUCCESS;
   }
   
 DEFUN (dynamic_hostname,  DEFUN (dynamic_hostname,
        dynamic_hostname_cmd,         dynamic_hostname_cmd,
        "hostname dynamic",         "hostname dynamic",
Line 1447  DEFUN (dynamic_hostname, Line 2181  DEFUN (dynamic_hostname,
   area = vty->index;    area = vty->index;
   assert (area);    assert (area);
   
  area->dynhostname = 1;  if (!area->dynhostname)
    {
      area->dynhostname = 1;
      lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
    }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 1464  DEFUN (no_dynamic_hostname, Line 2202  DEFUN (no_dynamic_hostname,
   area = vty->index;    area = vty->index;
   assert (area);    assert (area);
   
  area->dynhostname = 0;  if (area->dynhostname)
     {
       area->dynhostname = 0;
       lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
     }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 1591  ALIAS (no_spf_interval, Line 2333  ALIAS (no_spf_interval,
        "Set interval for level 2 only\n"         "Set interval for level 2 only\n"
        "Minimum interval between consecutive SPFs in seconds\n")         "Minimum interval between consecutive SPFs in seconds\n")
   
   static int
   set_lsp_max_lifetime (struct vty *vty, struct isis_area *area,
                         uint16_t interval, int level)
   {
     int lvl;
     int set_refresh_interval[ISIS_LEVELS] = {0, 0};
     uint16_t refresh_interval;
   
     refresh_interval = interval - 300;
   
     for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
       {
         if (!(lvl & level))
           continue;
         if (refresh_interval < area->lsp_refresh[lvl-1])
           {
             vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
                      "the configured LSP refresh interval %us%s",
                      lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
             vty_out (vty, "Automatically reducing level %d LSP refresh interval "
                      "to %us%s", lvl, refresh_interval, VTY_NEWLINE);
             set_refresh_interval[lvl-1] = 1;
   
             if (refresh_interval <= area->lsp_gen_interval[lvl-1])
               {
                 vty_out (vty, "LSP refresh interval %us must be greater than "
                          "the configured LSP gen interval %us%s",
                          refresh_interval, area->lsp_gen_interval[lvl-1],
                          VTY_NEWLINE);
                 return CMD_ERR_AMBIGUOUS;
               }
           }
       }
   
     for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
       {
         if (!(lvl & level))
           continue;
         area->max_lsp_lifetime[lvl-1] = interval;
         /* Automatically reducing lsp_refresh_interval to interval - 300 */
         if (set_refresh_interval[lvl-1])
           area->lsp_refresh[lvl-1] = refresh_interval;
       }
   
     lsp_regenerate_schedule (area, level, 1);
   
     return CMD_SUCCESS;
   }
   
   DEFUN (max_lsp_lifetime,
          max_lsp_lifetime_cmd,
          "max-lsp-lifetime <350-65535>",
          "Maximum LSP lifetime\n"
          "LSP lifetime in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = atoi (argv[0]);
     level = IS_LEVEL_1 | IS_LEVEL_2;
     return set_lsp_max_lifetime (vty, area, interval, level);
   }
   
   DEFUN (no_max_lsp_lifetime,
          no_max_lsp_lifetime_cmd,
          "no max-lsp-lifetime",
          NO_STR
          "LSP lifetime in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = DEFAULT_LSP_LIFETIME;
     level = IS_LEVEL_1 | IS_LEVEL_2;
     return set_lsp_max_lifetime (vty, area, interval, level);
   }
   
   ALIAS (no_max_lsp_lifetime,
          no_max_lsp_lifetime_arg_cmd,
          "no max-lsp-lifetime <350-65535>",
          NO_STR
          "Maximum LSP lifetime\n"
          "LSP lifetime in seconds\n")
   
   DEFUN (max_lsp_lifetime_l1,
          max_lsp_lifetime_l1_cmd,
          "max-lsp-lifetime level-1 <350-65535>",
          "Maximum LSP lifetime for Level 1 only\n"
          "LSP lifetime for Level 1 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = atoi (argv[0]);
     level = IS_LEVEL_1;
     return set_lsp_max_lifetime (vty, area, interval, level);
   }
   
   DEFUN (no_max_lsp_lifetime_l1,
          no_max_lsp_lifetime_l1_cmd,
          "no max-lsp-lifetime level-1",
          NO_STR
          "LSP lifetime for Level 1 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = DEFAULT_LSP_LIFETIME;
     level = IS_LEVEL_1;
     return set_lsp_max_lifetime (vty, area, interval, level);
   }
   
   ALIAS (no_max_lsp_lifetime_l1,
          no_max_lsp_lifetime_l1_arg_cmd,
          "no max-lsp-lifetime level-1 <350-65535>",
          NO_STR
          "Maximum LSP lifetime for Level 1 only\n"
          "LSP lifetime for Level 1 only in seconds\n")
   
   DEFUN (max_lsp_lifetime_l2,
          max_lsp_lifetime_l2_cmd,
          "max-lsp-lifetime level-2 <350-65535>",
          "Maximum LSP lifetime for Level 2 only\n"
          "LSP lifetime for Level 2 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = atoi (argv[0]);
     level = IS_LEVEL_2;
     return set_lsp_max_lifetime (vty, area, interval, level);
   }
   
   DEFUN (no_max_lsp_lifetime_l2,
          no_max_lsp_lifetime_l2_cmd,
          "no max-lsp-lifetime level-2",
          NO_STR
          "LSP lifetime for Level 2 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = DEFAULT_LSP_LIFETIME;
     level = IS_LEVEL_2;
     return set_lsp_max_lifetime (vty, area, interval, level);
   }
   
   ALIAS (no_max_lsp_lifetime_l2,
          no_max_lsp_lifetime_l2_arg_cmd,
          "no max-lsp-lifetime level-2 <350-65535>",
          NO_STR
          "Maximum LSP lifetime for Level 2 only\n"
          "LSP lifetime for Level 2 only in seconds\n")
   
   static int
   set_lsp_refresh_interval (struct vty *vty, struct isis_area *area,
                             uint16_t interval, int level)
   {
     int lvl;
   
     for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
       {
         if (!(lvl & level))
           continue;
         if (interval <= area->lsp_gen_interval[lvl-1])
           {
             vty_out (vty, "LSP refresh interval %us must be greater than "
                      "the configured LSP gen interval %us%s",
                      interval, area->lsp_gen_interval[lvl-1],
                      VTY_NEWLINE);
             return CMD_ERR_AMBIGUOUS;
           }
         if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
           {
             vty_out (vty, "LSP refresh interval %us must be less than "
                      "the configured LSP lifetime %us less 300%s",
                      interval, area->max_lsp_lifetime[lvl-1],
                      VTY_NEWLINE);
             return CMD_ERR_AMBIGUOUS;
           }
       }
   
     for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
       {
         if (!(lvl & level))
           continue;
         area->lsp_refresh[lvl-1] = interval;
       }
     lsp_regenerate_schedule (area, level, 1);
   
     return CMD_SUCCESS;
   }
   
   DEFUN (lsp_refresh_interval,
          lsp_refresh_interval_cmd,
          "lsp-refresh-interval <1-65235>",
          "LSP refresh interval\n"
          "LSP refresh interval in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = atoi (argv[0]);
     level = IS_LEVEL_1 | IS_LEVEL_2;
     return set_lsp_refresh_interval (vty, area, interval, level);
   }
   
   DEFUN (no_lsp_refresh_interval,
          no_lsp_refresh_interval_cmd,
          "no lsp-refresh-interval",
          NO_STR
          "LSP refresh interval in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
     level = IS_LEVEL_1 | IS_LEVEL_2;
     return set_lsp_refresh_interval (vty, area, interval, level);
   }
   
   ALIAS (no_lsp_refresh_interval,
          no_lsp_refresh_interval_arg_cmd,
          "no lsp-refresh-interval <1-65235>",
          NO_STR
          "LSP refresh interval\n"
          "LSP refresh interval in seconds\n")
   
   DEFUN (lsp_refresh_interval_l1,
          lsp_refresh_interval_l1_cmd,
          "lsp-refresh-interval level-1 <1-65235>",
          "LSP refresh interval for Level 1 only\n"
          "LSP refresh interval for Level 1 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = atoi (argv[0]);
     level = IS_LEVEL_1;
     return set_lsp_refresh_interval (vty, area, interval, level);
   }
   
   DEFUN (no_lsp_refresh_interval_l1,
          no_lsp_refresh_interval_l1_cmd,
          "no lsp-refresh-interval level-1",
          NO_STR
          "LSP refresh interval for Level 1 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
     level = IS_LEVEL_1;
     return set_lsp_refresh_interval (vty, area, interval, level);
   }
   
   ALIAS (no_lsp_refresh_interval_l1,
          no_lsp_refresh_interval_l1_arg_cmd,
          "no lsp-refresh-interval level-1 <1-65235>",
          NO_STR
          "LSP refresh interval for Level 1 only\n"
          "LSP refresh interval for Level 1 only in seconds\n")
   
   DEFUN (lsp_refresh_interval_l2,
          lsp_refresh_interval_l2_cmd,
          "lsp-refresh-interval level-2 <1-65235>",
          "LSP refresh interval for Level 2 only\n"
          "LSP refresh interval for Level 2 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = atoi (argv[0]);
     level = IS_LEVEL_2;
     return set_lsp_refresh_interval (vty, area, interval, level);
   }
   
   DEFUN (no_lsp_refresh_interval_l2,
          no_lsp_refresh_interval_l2_cmd,
          "no lsp-refresh-interval level-2",
          NO_STR
          "LSP refresh interval for Level 2 only in seconds\n")
   {
     struct isis_area *area;
     uint16_t interval;
     int level;
   
     area = vty->index;
     interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
     level = IS_LEVEL_2;
     return set_lsp_refresh_interval (vty, area, interval, level);
   }
   
   ALIAS (no_lsp_refresh_interval_l2,
          no_lsp_refresh_interval_l2_arg_cmd,
          "no lsp-refresh-interval level-2 <1-65235>",
          NO_STR
          "LSP refresh interval for Level 2 only\n"
          "LSP refresh interval for Level 2 only in seconds\n")
   
   DEFUN (log_adj_changes,
          log_adj_changes_cmd,
          "log-adjacency-changes",
          "Log changes in adjacency state\n")
   {
     struct isis_area *area;
   
     area = vty->index;
     assert (area);
   
     area->log_adj_changes = 1;
   
     return CMD_SUCCESS;
   }
   
   DEFUN (no_log_adj_changes,
          no_log_adj_changes_cmd,
          "no log-adjacency-changes",
          "Stop logging changes in adjacency state\n")
   {
     struct isis_area *area;
   
     area = vty->index;
     assert (area);
   
     area->log_adj_changes = 0;
   
     return CMD_SUCCESS;
   }
   
 #ifdef TOPOLOGY_GENERATE  #ifdef TOPOLOGY_GENERATE
   
 DEFUN (topology_generate_grid,  DEFUN (topology_generate_grid,
        topology_generate_grid_cmd,         topology_generate_grid_cmd,
        "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "         "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
Line 1623  DEFUN (topology_generate_grid, Line 2718  DEFUN (topology_generate_grid,
       generate_topology_lsps (area);        generate_topology_lsps (area);
       /* Regenerate L1 LSP to get two way connection to the generated        /* Regenerate L1 LSP to get two way connection to the generated
        * topology. */         * topology. */
      lsp_regenerate_schedule (area);      lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
     }      }
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
Line 1633  DEFUN (show_isis_generated_topology, Line 2728  DEFUN (show_isis_generated_topology,
        show_isis_generated_topology_cmd,         show_isis_generated_topology_cmd,
        "show isis generated-topologies",         "show isis generated-topologies",
        SHOW_STR         SHOW_STR
       "CLNS network information\n"       "ISIS network information\n"
        "Show generated topologies\n")         "Show generated topologies\n")
 {  {
   struct isis_area *area;    struct isis_area *area;
Line 1717  DEFUN (topology_basedynh, Line 2812  DEFUN (topology_basedynh,
   area->topology_basedynh = strndup (argv[0], 16);     area->topology_basedynh = strndup (argv[0], 16); 
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 #endif /* TOPOLOGY_GENERATE */  #endif /* TOPOLOGY_GENERATE */
   
 DEFUN (lsp_lifetime,  
        lsp_lifetime_cmd,  
        "lsp-lifetime <380-65535>",  
        "Maximum LSP lifetime\n"  
        "LSP lifetime in seconds\n")  
 {  
   struct isis_area *area;  
   uint16_t interval;  
   
   area = vty->index;  
   assert (area);  
   
   interval = atoi (argv[0]);  
   
   if (interval < ISIS_MIN_LSP_LIFETIME)  
     {  
       vty_out (vty, "LSP lifetime (%us) below %us%s",  
                interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);  
   
       return CMD_WARNING;  
     }  
   
   
   area->max_lsp_lifetime[0] = interval;  
   area->max_lsp_lifetime[1] = interval;  
   area->lsp_refresh[0] = interval - 300;  
   area->lsp_refresh[1] = interval - 300;  
   
   if (area->t_lsp_refresh[0])  
     {  
       thread_cancel (area->t_lsp_refresh[0]);  
       thread_execute (master, lsp_refresh_l1, area, 0);  
     }  
   
   if (area->t_lsp_refresh[1])  
     {  
       thread_cancel (area->t_lsp_refresh[1]);  
       thread_execute (master, lsp_refresh_l2, area, 0);  
     }  
   
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (no_lsp_lifetime,  
        no_lsp_lifetime_cmd,  
        "no lsp-lifetime",  
        NO_STR  
        "LSP lifetime in seconds\n")  
 {  
   struct isis_area *area;  
   
   area = vty->index;  
   assert (area);  
   
   area->max_lsp_lifetime[0] = MAX_AGE;  /* 1200s */  
   area->max_lsp_lifetime[1] = MAX_AGE;  /* 1200s */  
   area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL;  /*  900s */  
   area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL;  /*  900s */  
   
   return CMD_SUCCESS;  
 }  
   
 ALIAS (no_lsp_lifetime,  
        no_lsp_lifetime_arg_cmd,  
        "no lsp-lifetime <380-65535>",  
        NO_STR  
        "Maximum LSP lifetime\n"  
        "LSP lifetime in seconds\n")  
   
 DEFUN (lsp_lifetime_l1,  
        lsp_lifetime_l1_cmd,  
        "lsp-lifetime level-1 <380-65535>",  
        "Maximum LSP lifetime for Level 1 only\n"  
        "LSP lifetime for Level 1 only in seconds\n")  
 {  
   struct isis_area *area;  
   uint16_t interval;  
   
   area = vty->index;  
   assert (area);  
   
   interval = atoi (argv[0]);  
   
   if (interval < ISIS_MIN_LSP_LIFETIME)  
     {  
       vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s",  
                interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);  
   
       return CMD_WARNING;  
     }  
   
   
   area->max_lsp_lifetime[0] = interval;  
   area->lsp_refresh[0] = interval - 300;  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (no_lsp_lifetime_l1,  
        no_lsp_lifetime_l1_cmd,  
        "no lsp-lifetime level-1",  
        NO_STR  
        "LSP lifetime for Level 1 only in seconds\n")  
 {  
   struct isis_area *area;  
   
   area = vty->index;  
   assert (area);  
   
   area->max_lsp_lifetime[0] = MAX_AGE;  /* 1200s */  
   area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL;  /*  900s */  
   
   return CMD_SUCCESS;  
 }  
   
 ALIAS (no_lsp_lifetime_l1,  
        no_lsp_lifetime_l1_arg_cmd,  
        "no lsp-lifetime level-1 <380-65535>",  
        NO_STR  
        "Maximum LSP lifetime for Level 1 only\n"  
        "LSP lifetime for Level 1 only in seconds\n")  
   
 DEFUN (lsp_lifetime_l2,  
        lsp_lifetime_l2_cmd,  
        "lsp-lifetime level-2 <380-65535>",  
        "Maximum LSP lifetime for Level 2 only\n"  
        "LSP lifetime for Level 2 only in seconds\n")  
 {  
   struct isis_area *area;  
   uint16_t interval;  
   
   area = vty->index;  
   assert (area);  
   
   interval = atoi (argv[0]);  
   
   if (interval < ISIS_MIN_LSP_LIFETIME)  
     {  
       vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s",  
                interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);  
   
       return CMD_WARNING;  
     }  
   
   area->max_lsp_lifetime[1] = interval;  
   area->lsp_refresh[1] = interval - 300;  
   
   return CMD_SUCCESS;  
 }  
   
 DEFUN (no_lsp_lifetime_l2,  
        no_lsp_lifetime_l2_cmd,  
        "no lsp-lifetime level-2",  
        NO_STR  
        "LSP lifetime for Level 2 only in seconds\n")  
 {  
   struct isis_area *area;  
   
   area = vty->index;  
   assert (area);  
   
   area->max_lsp_lifetime[1] = MAX_AGE;  /* 1200s */  
   area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL;  /*  900s */  
   
   return CMD_SUCCESS;  
 }  
   
 ALIAS (no_lsp_lifetime_l2,  
        no_lsp_lifetime_l2_arg_cmd,  
        "no lsp-lifetime level-2 <380-65535>",  
        NO_STR  
        "Maximum LSP lifetime for Level 2 only\n"  
        "LSP lifetime for Level 2 only in seconds\n")  
   
 /* IS-IS configuration write function */  /* IS-IS configuration write function */
 int  int
 isis_config_write (struct vty *vty)  isis_config_write (struct vty *vty)
Line 1939  isis_config_write (struct vty *vty) Line 2860  isis_config_write (struct vty *vty)
               vty_out (vty, " metric-style transition%s", VTY_NEWLINE);                vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
             write++;              write++;
           }            }
        else
           {
             vty_out (vty, " metric-style narrow%s", VTY_NEWLINE);
             write++;
           }
         /* ISIS - overload-bit */
         if (area->overload_bit)
           {
             vty_out (vty, " set-overload-bit%s", VTY_NEWLINE);
             write++;
           }
         /* ISIS - Area is-type (level-1-2 is default) */          /* ISIS - Area is-type (level-1-2 is default) */
         if (area->is_type == IS_LEVEL_1)          if (area->is_type == IS_LEVEL_1)
           {            {
             vty_out (vty, " is-type level-1%s", VTY_NEWLINE);              vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
             write++;              write++;
           }            }
        else        else if (area->is_type == IS_LEVEL_2)
           {            {
            if (area->is_type == IS_LEVEL_2)            vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
              {            write++;
                vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE); 
                write++; 
              } 
           }            }
         /* ISIS - Lsp generation interval */          /* ISIS - Lsp generation interval */
         if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])          if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
           {            {
            if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)            if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
               {                {
                 vty_out (vty, " lsp-gen-interval %d%s",                  vty_out (vty, " lsp-gen-interval %d%s",
                          area->lsp_gen_interval[0], VTY_NEWLINE);                           area->lsp_gen_interval[0], VTY_NEWLINE);
Line 1966  isis_config_write (struct vty *vty) Line 2894  isis_config_write (struct vty *vty)
           }            }
         else          else
           {            {
            if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)            if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
               {                {
                 vty_out (vty, " lsp-gen-interval level-1 %d%s",                  vty_out (vty, " lsp-gen-interval level-1 %d%s",
                          area->lsp_gen_interval[0], VTY_NEWLINE);                           area->lsp_gen_interval[0], VTY_NEWLINE);
                 write++;                  write++;
               }                }
            if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT)            if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL)
               {                {
                 vty_out (vty, " lsp-gen-interval level-2 %d%s",                  vty_out (vty, " lsp-gen-interval level-2 %d%s",
                          area->lsp_gen_interval[1], VTY_NEWLINE);                           area->lsp_gen_interval[1], VTY_NEWLINE);
Line 1982  isis_config_write (struct vty *vty) Line 2910  isis_config_write (struct vty *vty)
         /* ISIS - LSP lifetime */          /* ISIS - LSP lifetime */
         if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])          if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
           {            {
            if (area->max_lsp_lifetime[0] != MAX_AGE)            if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
               {                {
                vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0],                vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0],
                          VTY_NEWLINE);                           VTY_NEWLINE);
                 write++;                  write++;
               }                }
           }            }
         else          else
           {            {
            if (area->max_lsp_lifetime[0] != MAX_AGE)            if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
               {                {
                vty_out (vty, " lsp-lifetime level-1 %u%s",                vty_out (vty, " max-lsp-lifetime level-1 %u%s",
                          area->max_lsp_lifetime[0], VTY_NEWLINE);                           area->max_lsp_lifetime[0], VTY_NEWLINE);
                 write++;                  write++;
               }                }
            if (area->max_lsp_lifetime[1] != MAX_AGE)            if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME)
               {                {
                vty_out (vty, " lsp-lifetime level-2 %u%s",                vty_out (vty, " max-lsp-lifetime level-2 %u%s",
                          area->max_lsp_lifetime[1], VTY_NEWLINE);                           area->max_lsp_lifetime[1], VTY_NEWLINE);
                 write++;                  write++;
               }                }
           }            }
           /* ISIS - LSP refresh interval */
           if (area->lsp_refresh[0] == area->lsp_refresh[1])
             {
               if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
                 {
                   vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0],
                            VTY_NEWLINE);
                   write++;
                 }
             }
           else
             {
               if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
                 {
                   vty_out (vty, " lsp-refresh-interval level-1 %u%s",
                            area->lsp_refresh[0], VTY_NEWLINE);
                   write++;
                 }
               if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL)
                 {
                   vty_out (vty, " lsp-refresh-interval level-2 %u%s",
                            area->lsp_refresh[1], VTY_NEWLINE);
                   write++;
                 }
             }
         /* Minimum SPF interval. */          /* Minimum SPF interval. */
         if (area->min_spf_interval[0] == area->min_spf_interval[1])          if (area->min_spf_interval[0] == area->min_spf_interval[1])
           {            {
Line 2030  isis_config_write (struct vty *vty) Line 2983  isis_config_write (struct vty *vty)
               }                }
           }            }
         /* Authentication passwords. */          /* Authentication passwords. */
        if (area->area_passwd.len > 0)        if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
           {            {
            vty_out(vty, " area-password %s", area->area_passwd.passwd);            vty_out(vty, " area-password md5 %s", area->area_passwd.passwd);
             if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))              if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
               {                {
                 vty_out(vty, " authenticate snp ");                  vty_out(vty, " authenticate snp ");
Line 2043  isis_config_write (struct vty *vty) Line 2996  isis_config_write (struct vty *vty)
               }                }
             vty_out(vty, "%s", VTY_NEWLINE);              vty_out(vty, "%s", VTY_NEWLINE);
             write++;               write++; 
          }            }
        if (area->domain_passwd.len > 0)        else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
           {
             vty_out(vty, " area-password clear %s", area->area_passwd.passwd);
             if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
               {
                 vty_out(vty, " authenticate snp ");
                 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
                   vty_out(vty, "validate");
                 else
                   vty_out(vty, "send-only");
               }
             vty_out(vty, "%s", VTY_NEWLINE);
             write++; 
           }
         if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
           {            {
            vty_out(vty, " domain-password %s", area->domain_passwd.passwd);            vty_out(vty, " domain-password md5 %s",
                     area->domain_passwd.passwd);
             if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))              if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
               {                {
                 vty_out(vty, " authenticate snp ");                  vty_out(vty, " authenticate snp ");
Line 2058  isis_config_write (struct vty *vty) Line 3026  isis_config_write (struct vty *vty)
             vty_out(vty, "%s", VTY_NEWLINE);              vty_out(vty, "%s", VTY_NEWLINE);
             write++;              write++;
           }            }
           else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
             {
               vty_out(vty, " domain-password clear %s",
                       area->domain_passwd.passwd); 
               if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
                 {
                   vty_out(vty, " authenticate snp ");
                   if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
                     vty_out(vty, "validate");
                   else
                     vty_out(vty, "send-only");
                 }
               vty_out(vty, "%s", VTY_NEWLINE);
               write++;
             }
   
           if (area->log_adj_changes)
             {
               vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE);
               write++;
             }
   
 #ifdef TOPOLOGY_GENERATE  #ifdef TOPOLOGY_GENERATE
         if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,          if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
                     ISIS_SYS_ID_LEN))                      ISIS_SYS_ID_LEN))
           {            {
             vty_out (vty, " topology base-is %s%s",              vty_out (vty, " topology base-is %s%s",
                     sysid_print (area->topology_baseis), VTY_NEWLINE);                     sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE);
             write++;              write++;
           }            }
         if (area->topology_basedynh)          if (area->topology_basedynh)
Line 2087  isis_config_write (struct vty *vty) Line 3076  isis_config_write (struct vty *vty)
   return write;    return write;
 }  }
   
static struct cmd_node isis_node = {struct cmd_node isis_node = {
   ISIS_NODE,    ISIS_NODE,
   "%s(config-router)# ",    "%s(config-router)# ",
   1    1
Line 2099  isis_init () Line 3088  isis_init ()
   /* Install IS-IS top node */    /* Install IS-IS top node */
   install_node (&isis_node, isis_config_write);    install_node (&isis_node, isis_config_write);
   
  install_element (VIEW_NODE, &show_clns_neighbors_cmd);  install_element (VIEW_NODE, &show_isis_summary_cmd);
  install_element (VIEW_NODE, &show_isis_neighbors_cmd); 
  install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd); 
  install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd); 
   
     install_element (VIEW_NODE, &show_isis_interface_cmd);
     install_element (VIEW_NODE, &show_isis_interface_detail_cmd);
     install_element (VIEW_NODE, &show_isis_interface_arg_cmd);
   
     install_element (VIEW_NODE, &show_isis_neighbor_cmd);
     install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd);
     install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd);
     install_element (VIEW_NODE, &clear_isis_neighbor_cmd);
     install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd);
   
   install_element (VIEW_NODE, &show_hostname_cmd);    install_element (VIEW_NODE, &show_hostname_cmd);
   install_element (VIEW_NODE, &show_database_cmd);    install_element (VIEW_NODE, &show_database_cmd);
     install_element (VIEW_NODE, &show_database_arg_cmd);
     install_element (VIEW_NODE, &show_database_arg_detail_cmd);
   install_element (VIEW_NODE, &show_database_detail_cmd);    install_element (VIEW_NODE, &show_database_detail_cmd);
     install_element (VIEW_NODE, &show_database_detail_arg_cmd);
   
  install_element (ENABLE_NODE, &show_clns_neighbors_cmd);  install_element (ENABLE_NODE, &show_isis_summary_cmd);
  install_element (ENABLE_NODE, &show_isis_neighbors_cmd); 
  install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd); 
  install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd); 
   
     install_element (ENABLE_NODE, &show_isis_interface_cmd);
     install_element (ENABLE_NODE, &show_isis_interface_detail_cmd);
     install_element (ENABLE_NODE, &show_isis_interface_arg_cmd);
   
     install_element (ENABLE_NODE, &show_isis_neighbor_cmd);
     install_element (ENABLE_NODE, &show_isis_neighbor_detail_cmd);
     install_element (ENABLE_NODE, &show_isis_neighbor_arg_cmd);
     install_element (ENABLE_NODE, &clear_isis_neighbor_cmd);
     install_element (ENABLE_NODE, &clear_isis_neighbor_arg_cmd);
   
   install_element (ENABLE_NODE, &show_hostname_cmd);    install_element (ENABLE_NODE, &show_hostname_cmd);
   install_element (ENABLE_NODE, &show_database_cmd);    install_element (ENABLE_NODE, &show_database_cmd);
     install_element (ENABLE_NODE, &show_database_arg_cmd);
     install_element (ENABLE_NODE, &show_database_arg_detail_cmd);
   install_element (ENABLE_NODE, &show_database_detail_cmd);    install_element (ENABLE_NODE, &show_database_detail_cmd);
     install_element (ENABLE_NODE, &show_database_detail_arg_cmd);
   install_element (ENABLE_NODE, &show_debugging_cmd);    install_element (ENABLE_NODE, &show_debugging_cmd);
   
   install_node (&debug_node, config_write_debug);    install_node (&debug_node, config_write_debug);
Line 2142  isis_init () Line 3151  isis_init ()
   install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);    install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
   install_element (ENABLE_NODE, &debug_isis_events_cmd);    install_element (ENABLE_NODE, &debug_isis_events_cmd);
   install_element (ENABLE_NODE, &no_debug_isis_events_cmd);    install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
     install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd);
     install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
   
   install_element (CONFIG_NODE, &debug_isis_adj_cmd);    install_element (CONFIG_NODE, &debug_isis_adj_cmd);
   install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);    install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
Line 2165  isis_init () Line 3176  isis_init ()
   install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);    install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
   install_element (CONFIG_NODE, &debug_isis_events_cmd);    install_element (CONFIG_NODE, &debug_isis_events_cmd);
   install_element (CONFIG_NODE, &no_debug_isis_events_cmd);    install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
     install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd);
     install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
   
   install_element (CONFIG_NODE, &router_isis_cmd);    install_element (CONFIG_NODE, &router_isis_cmd);
   install_element (CONFIG_NODE, &no_router_isis_cmd);    install_element (CONFIG_NODE, &no_router_isis_cmd);
Line 2177  isis_init () Line 3190  isis_init ()
   install_element (ISIS_NODE, &is_type_cmd);    install_element (ISIS_NODE, &is_type_cmd);
   install_element (ISIS_NODE, &no_is_type_cmd);    install_element (ISIS_NODE, &no_is_type_cmd);
   
  install_element (ISIS_NODE, &area_passwd_cmd);  install_element (ISIS_NODE, &area_passwd_md5_cmd);
  install_element (ISIS_NODE, &area_passwd_snpauth_cmd);  install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd);
   install_element (ISIS_NODE, &area_passwd_clear_cmd);
   install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd);
   install_element (ISIS_NODE, &no_area_passwd_cmd);    install_element (ISIS_NODE, &no_area_passwd_cmd);
   
  install_element (ISIS_NODE, &domain_passwd_cmd);  install_element (ISIS_NODE, &domain_passwd_md5_cmd);
  install_element (ISIS_NODE, &domain_passwd_snpauth_cmd);  install_element (ISIS_NODE, &domain_passwd_md5_snpauth_cmd);
   install_element (ISIS_NODE, &domain_passwd_clear_cmd);
   install_element (ISIS_NODE, &domain_passwd_clear_snpauth_cmd);
   install_element (ISIS_NODE, &no_domain_passwd_cmd);    install_element (ISIS_NODE, &no_domain_passwd_cmd);
   
   install_element (ISIS_NODE, &lsp_gen_interval_cmd);    install_element (ISIS_NODE, &lsp_gen_interval_cmd);
Line 2205  isis_init () Line 3222  isis_init ()
   install_element (ISIS_NODE, &no_spf_interval_l2_cmd);    install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
   install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);    install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
   
  install_element (ISIS_NODE, &lsp_lifetime_cmd);  install_element (ISIS_NODE, &max_lsp_lifetime_cmd);
  install_element (ISIS_NODE, &no_lsp_lifetime_cmd);  install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd);
  install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd);  install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd);
  install_element (ISIS_NODE, &lsp_lifetime_l1_cmd);  install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd);
  install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd);  install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd);
  install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd);  install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd);
  install_element (ISIS_NODE, &lsp_lifetime_l2_cmd);  install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd);
  install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd);  install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd);
  install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd);  install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd);
   
     install_element (ISIS_NODE, &lsp_refresh_interval_cmd);
     install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd);
     install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd);
     install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd);
     install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd);
     install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd);
     install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd);
     install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd);
     install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd);
   
     install_element (ISIS_NODE, &set_overload_bit_cmd);
     install_element (ISIS_NODE, &no_set_overload_bit_cmd);
   
   install_element (ISIS_NODE, &dynamic_hostname_cmd);    install_element (ISIS_NODE, &dynamic_hostname_cmd);
   install_element (ISIS_NODE, &no_dynamic_hostname_cmd);    install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
   
   install_element (ISIS_NODE, &metric_style_cmd);    install_element (ISIS_NODE, &metric_style_cmd);
   install_element (ISIS_NODE, &no_metric_style_cmd);    install_element (ISIS_NODE, &no_metric_style_cmd);
   
     install_element (ISIS_NODE, &log_adj_changes_cmd);
     install_element (ISIS_NODE, &no_log_adj_changes_cmd);
   
 #ifdef TOPOLOGY_GENERATE  #ifdef TOPOLOGY_GENERATE
   install_element (ISIS_NODE, &topology_generate_grid_cmd);    install_element (ISIS_NODE, &topology_generate_grid_cmd);
   install_element (ISIS_NODE, &topology_baseis_cmd);    install_element (ISIS_NODE, &topology_baseis_cmd);
Line 2229  isis_init () Line 3263  isis_init ()
   install_element (VIEW_NODE, &show_isis_generated_topology_cmd);    install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
   install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);    install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
 #endif /* TOPOLOGY_GENERATE */  #endif /* TOPOLOGY_GENERATE */
   
   isis_new (0);  
   isis_circuit_init ();  
   isis_zebra_init ();  
   isis_spf_cmds_init ();  
 }  }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


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