Browse Source

isisd: drop unused per-type metric values

Expense, Error and Delay metrics never quite made it into the real
world.  Either way isisd does nothing useful with them, so let's drop
them from the code.  If someone wants to implement them, this patch can
still be reverted.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter 2 years ago
parent
commit
f263413f76
3 changed files with 20 additions and 14 deletions
  1. 4 7
      isisd/isis_circuit.c
  2. 1 1
      isisd/isis_circuit.h
  3. 15 6
      isisd/isis_lsp.c

+ 4 - 7
isisd/isis_circuit.c

@@ -93,10 +93,7 @@ isis_circuit_new ()
       circuit->csnp_interval[i] = DEFAULT_CSNP_INTERVAL;
       circuit->psnp_interval[i] = DEFAULT_PSNP_INTERVAL;
       circuit->priority[i] = DEFAULT_PRIORITY;
-      circuit->metrics[i].metric_default = DEFAULT_CIRCUIT_METRIC;
-      circuit->metrics[i].metric_expense = METRICS_UNSUPPORTED;
-      circuit->metrics[i].metric_error = METRICS_UNSUPPORTED;
-      circuit->metrics[i].metric_delay = METRICS_UNSUPPORTED;
+      circuit->metric[i] = DEFAULT_CIRCUIT_METRIC;
       circuit->te_metric[i] = DEFAULT_CIRCUIT_METRIC;
     }
 
@@ -901,7 +898,7 @@ isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
             vty_out (vty, "      Metric: %d", circuit->te_metric[0]);
           else
             vty_out (vty, "      Metric: %d",
-                     circuit->metrics[0].metric_default);
+                     circuit->metric[0]);
           if (!circuit->is_passive)
             {
               vty_out (vty, ", Active neighbors: %u%s",
@@ -934,7 +931,7 @@ isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
             vty_out (vty, "      Metric: %d", circuit->te_metric[1]);
           else
             vty_out (vty, "      Metric: %d",
-                     circuit->metrics[1].metric_default);
+                     circuit->metric[1]);
           if (!circuit->is_passive)
             {
               vty_out (vty, ", Active neighbors: %u%s",
@@ -1302,7 +1299,7 @@ isis_circuit_metric_set (struct isis_circuit *circuit, int level, int metric)
     return -1;
 
   circuit->te_metric[level - 1] = metric;
-  circuit->metrics[level - 1].metric_default = metric;
+  circuit->metric[level - 1] = metric;
 
   if (circuit->area)
     lsp_regenerate_schedule (circuit->area, level, 0);

+ 1 - 1
isisd/isis_circuit.h

@@ -117,7 +117,7 @@ struct isis_circuit
   u_int16_t hello_multiplier[2];	/* l1HelloMultiplier */
   u_int16_t csnp_interval[2];	/* level-1 csnp-interval in seconds */
   u_int16_t psnp_interval[2];	/* level-1 psnp-interval in seconds */
-  struct metric metrics[2];	/* l1XxxMetric */
+  u_int8_t  metric[2];
   u_int32_t te_metric[2];
   struct mpls_te_circuit *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */
   int ip_router;		/* Route IP ? */

+ 15 - 6
isisd/isis_lsp.c

@@ -1544,7 +1544,10 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area)
 		{
 		  ipreach =
 		    XMALLOC (MTYPE_ISIS_TLV, sizeof (struct ipv4_reachability));
-		  ipreach->metrics = circuit->metrics[level - 1];
+		  ipreach->metrics.metric_default = circuit->metric[level - 1];
+		  ipreach->metrics.metric_expense = METRICS_UNSUPPORTED;
+		  ipreach->metrics.metric_error = METRICS_UNSUPPORTED;
+		  ipreach->metrics.metric_delay = METRICS_UNSUPPORTED;
 		  masklen2ip (ipv4->prefixlen, &ipreach->mask);
 		  ipreach->prefix.s_addr = ((ipreach->mask.s_addr) &
 					    (ipv4->prefix.s_addr));
@@ -1569,7 +1572,7 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area)
 					((ipv4->prefixlen + 7)/8) - 1);
 
 		  if (area->oldmetric)
-		    te_ipreach->te_metric = htonl (circuit->metrics[level - 1].metric_default);
+		    te_ipreach->te_metric = htonl (circuit->metric[level - 1]);
 		  else
 		    te_ipreach->te_metric = htonl (circuit->te_metric[level - 1]);
 
@@ -1604,7 +1607,7 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area)
 
 	      if (area->oldmetric)
 		ip6reach->metric =
-			  htonl (circuit->metrics[level - 1].metric_default);
+			  htonl (circuit->metric[level - 1]);
 	      else
 		  ip6reach->metric = htonl (circuit->te_metric[level - 1]);
 
@@ -1643,7 +1646,10 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area)
 		  else
 		    memcpy (is_neigh->neigh_id,
 			    circuit->u.bc.l2_desig_is, ISIS_SYS_ID_LEN + 1);
-		  is_neigh->metrics = circuit->metrics[level - 1];
+		  is_neigh->metrics.metric_default = circuit->metric[level - 1];
+		  is_neigh->metrics.metric_expense = METRICS_UNSUPPORTED;
+		  is_neigh->metrics.metric_error = METRICS_UNSUPPORTED;
+		  is_neigh->metrics.metric_delay = METRICS_UNSUPPORTED;
                   if (!memcmp (is_neigh->neigh_id, zero_id,
                                ISIS_SYS_ID_LEN + 1))
                     {
@@ -1675,7 +1681,7 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area)
 		    memcpy (te_is_neigh->neigh_id,
 			    circuit->u.bc.l2_desig_is, ISIS_SYS_ID_LEN + 1);
 		  if (area->oldmetric)
-		    metric = circuit->metrics[level - 1].metric_default;
+		    metric = circuit->metric[level - 1];
 		  else
 		    metric = circuit->te_metric[level - 1];
 		  SET_TE_METRIC(te_is_neigh, metric);
@@ -1722,7 +1728,10 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area)
 		    }
 		  is_neigh = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
 		  memcpy (is_neigh->neigh_id, nei->sysid, ISIS_SYS_ID_LEN);
-		  is_neigh->metrics = circuit->metrics[level - 1];
+		  is_neigh->metrics.metric_default = circuit->metric[level - 1];
+		  is_neigh->metrics.metric_expense = METRICS_UNSUPPORTED;
+		  is_neigh->metrics.metric_error = METRICS_UNSUPPORTED;
+		  is_neigh->metrics.metric_delay = METRICS_UNSUPPORTED;
 		  listnode_add (tlv_data.is_neighs, is_neigh);
 		  lsp_debug("ISIS (%s): Adding old-style is reach for %s", area->area_tag,
                             sysid_print(is_neigh->neigh_id));