I had a bug in this patch that Donald pointed out in the set-overload-bit 
discussion. Looping through area list will set the bit for all the areas in the 
list. I am resubmitting this patch (v2) to remove the unwanted looping and 
setting the area as is being done in the current implementation of other 
commands such as 'set overload bit'. 

Thanks,
Amritha

From: Donald Sharp [mailto:[email protected]] 
Sent: Thursday, July 2, 2015 6:14 PM
To: Nambiar, Amritha
Cc: [email protected]
Subject: Re: [quagga-dev 12845] [PATCH] isisd: Attached-bit in LSP header

Looks like you implemented this exactly the same as the overload bit.

Acked-by: Donald Sharp <[email protected]

On Thu, Jul 2, 2015 at 9:06 PM, Amritha Nambiar <[email protected]> 
wrote:
Set/reset attached-bit in LSP header:
    This patch provides support for set/reset attached_bit in the LSP header.
    In IS-IS networks, routing inter-area traffic from L1 areas is
    accomplished by sending the traffic to the nearest L1/L2 router.
    A L1/L2 router identifies itself by setting an attach-bit (ATT-bit) in its 
(LSP).

    The ATT-bit in LSP can be changed using the set-attached-bit or
    no-set-attached-bit commands (similar to ‘set-overload-bit’ and
    'no set-overload-bit’) using telnet terminal in router configuration mode.

    Steps:
    enable
    configure terminal
    router isis isis
    set-overload-bit

Signed-off-by: Amritha Nambiar <[email protected]>
---
 isisd/isis_lsp.c |   33 ++++++++++++++++++++++-----------
 isisd/isisd.c    |   38 ++++++++++++++++++++++++++++++++++++++
 isisd/isisd.h    |    2 ++
 3 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 88593de..0b1dac1 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -442,7 +442,7 @@ lsp_seqnum_update (struct isis_lsp *lsp0)
 }

 static u_int8_t
-lsp_bits_generate (int level, int overload_bit)
+lsp_bits_generate (int level, int overload_bit, int attached_bit)
 {
   u_int8_t lsp_bits = 0;
   if (level == IS_LEVEL_1)
@@ -451,6 +451,8 @@ lsp_bits_generate (int level, int overload_bit)
     lsp_bits = IS_LEVEL_1_AND_2;
   if (overload_bit)
     lsp_bits |= overload_bit;
+  if (attached_bit)
+    lsp_bits |= attached_bit;
   return lsp_bits;
 }

@@ -1135,7 +1137,8 @@ lsp_next_frag (u_char frag_num, struct isis_lsp *lsp0, 
struct isis_area *area,
       return lsp;
     }
   lsp = lsp_new (frag_id, ntohs(lsp0->lsp_header->rem_lifetime), 0,
-                 lsp_bits_generate (level, area->overload_bit), 0, level);
+                 lsp_bits_generate (level, area->overload_bit,
+                 area->attached_bit), 0, level);
   lsp->area = area;
   lsp->own_lsp = 1;
   lsp_insert (lsp, area->lspdb[level - 1]);
@@ -1589,7 +1592,8 @@ lsp_generate (struct isis_area *area, int level)
     }
   rem_lifetime = lsp_rem_lifetime (area, level);
   newlsp = lsp_new (lspid, rem_lifetime, seq_num,
-                    area->is_type | area->overload_bit, 0, level);
+                    area->is_type | area->overload_bit | area->attached_bit,
+                    0, level);
   newlsp->area = area;
   newlsp->own_lsp = 1;

@@ -1656,7 +1660,8 @@ lsp_regenerate (struct isis_area *area, int level)

   lsp_clear_data (lsp);
   lsp_build (lsp, area);
-  lsp->lsp_header->lsp_bits = lsp_bits_generate (level, area->overload_bit);
+  lsp->lsp_header->lsp_bits = lsp_bits_generate (level, area->overload_bit,
+                                                 area->attached_bit);
   rem_lifetime = lsp_rem_lifetime (area, level);
   lsp->lsp_header->rem_lifetime = htons (rem_lifetime);
   lsp_seqnum_update (lsp);
@@ -1666,7 +1671,8 @@ lsp_regenerate (struct isis_area *area, int level)
   for (ALL_LIST_ELEMENTS_RO (lsp->lspu.frags, node, frag))
     {
       frag->lsp_header->lsp_bits = lsp_bits_generate (level,
-                                                      area->overload_bit);
+                                                      area->overload_bit,
+                                                      area->attached_bit);
       /* Set the lifetime values of all the fragments to the same value,
        * so that no fragment expires before the lsp is refreshed.
        */
@@ -1816,7 +1822,8 @@ lsp_build_pseudo (struct isis_lsp *lsp, struct 
isis_circuit *circuit,

   lsp->level = level;
   /* RFC3787  section 4 SHOULD not set overload bit in pseudo LSPs */
-  lsp->lsp_header->lsp_bits = lsp_bits_generate (level, 0);
+  lsp->lsp_header->lsp_bits = lsp_bits_generate (level, 0,
+                                                 circuit->area->attached_bit);

   /*
    * add self to IS neighbours
@@ -1946,7 +1953,9 @@ lsp_generate_pseudo (struct isis_circuit *circuit, int 
level)

   rem_lifetime = lsp_rem_lifetime (circuit->area, level);
   /* RFC3787  section 4 SHOULD not set overload bit in pseudo LSPs */
-  lsp = lsp_new (lsp_id, rem_lifetime, 1, circuit->area->is_type, 0, level);
+  lsp = lsp_new (lsp_id, rem_lifetime, 1,
+                 circuit->area->is_type | circuit->area->attached_bit,
+                 0, level);
   lsp->area = circuit->area;

   lsp_build_pseudo (lsp, circuit, level);
@@ -2012,7 +2021,8 @@ lsp_regenerate_pseudo (struct isis_circuit *circuit, int 
level)
   lsp_build_pseudo (lsp, circuit, level);

   /* RFC3787  section 4 SHOULD not set overload bit in pseudo LSPs */
-  lsp->lsp_header->lsp_bits = lsp_bits_generate (level, 0);
+  lsp->lsp_header->lsp_bits = lsp_bits_generate (level, 0,
+                                                 circuit->area->attached_bit);
   rem_lifetime = lsp_rem_lifetime (circuit->area, level);
   lsp->lsp_header->rem_lifetime = htons (rem_lifetime);
   lsp_inc_seqnum (lsp, 0);
@@ -2416,7 +2426,8 @@ top_lsp_refresh (struct thread *thread)
                     IS_LEVEL_1);

   lsp->lsp_header->lsp_bits = lsp_bits_generate (lsp->level,
-                                                 lsp->area->overload_bit);
+                                                 lsp->area->overload_bit,
+                                                 lsp->area->attached_bit);
   rem_lifetime = lsp_rem_lifetime (lsp->area, IS_LEVEL_1);
   lsp->lsp_header->rem_lifetime = htons (rem_lifetime);

@@ -2455,8 +2466,8 @@ generate_topology_lsps (struct isis_area *area)
       lspid[ISIS_SYS_ID_LEN - 2] = ((i >> 8) & 0xFF);

       rem_lifetime = lsp_rem_lifetime (area, IS_LEVEL_1);
-      lsp = lsp_new (lspid, rem_lifetime, 1, IS_LEVEL_1 | area->overload_bit,
-                     0, 1);
+      lsp = lsp_new (lspid, rem_lifetime, 1, IS_LEVEL_1 | area->overload_bit
+                     | area->attached_bit, 0, 1);
       if (!lsp)
        return;
       lsp->area = area;
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 898dfd2..9c9b918 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -2170,6 +2170,41 @@ DEFUN (no_set_overload_bit,
   return CMD_SUCCESS;
 }

+DEFUN (set_attached_bit,
+       set_attached_bit_cmd,
+       "set-attached-bit",
+       "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
+       "Set attached bit\n")
+{
+  struct isis_area *area;
+  struct listnode *anode;
+
+  for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
+    {
+      area->attached_bit = LSPBIT_ATT;
+      lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
+    }
+
+  return CMD_SUCCESS;
+}
+
+DEFUN (no_set_attached_bit,
+       no_set_attached_bit_cmd,
+       "no set-attached-bit",
+       "Reset attached bit\n")
+{
+  struct isis_area *area;
+  struct listnode *anode;
+
+  for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
+    {
+      area->attached_bit = 0;
+      lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
+    }
+
+  return CMD_SUCCESS;
+}
+
 DEFUN (dynamic_hostname,
        dynamic_hostname_cmd,
        "hostname dynamic",
@@ -3245,6 +3280,9 @@ isis_init ()
   install_element (ISIS_NODE, &set_overload_bit_cmd);
   install_element (ISIS_NODE, &no_set_overload_bit_cmd);

+  install_element (ISIS_NODE, &set_attached_bit_cmd);
+  install_element (ISIS_NODE, &no_set_attached_bit_cmd);
+
   install_element (ISIS_NODE, &dynamic_hostname_cmd);
   install_element (ISIS_NODE, &no_dynamic_hostname_cmd);

diff --git a/isisd/isisd.h b/isisd/isisd.h
index 5db485f..838a08b 100644
--- a/isisd/isisd.h
+++ b/isisd/isisd.h
@@ -116,6 +116,8 @@ struct isis_area
   char is_type;                        /* level-1 level-1-2 or level-2-only */
   /* are we overloaded? */
   char overload_bit;
+  /* L1/L2 router identifier for inter-area traffic */
+  char attached_bit;
   u_int16_t lsp_refresh[ISIS_LEVELS];
   /* minimum time allowed before lsp retransmission */
   u_int16_t lsp_gen_interval[ISIS_LEVELS];


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to