]> git.proxmox.com Git - mirror_frr.git/commitdiff
Rationalize Link Parameters flags
authorOlivier Dugeon <olivier.dugeon@orange.com>
Tue, 20 Dec 2016 14:02:34 +0000 (15:02 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 5 Jan 2017 07:19:11 +0000 (08:19 +0100)
 * lib/if.h: Remove LP_TE as Link Parameters is set if different from 0
See IS_LINK_PARAMS_SET macro and use LP_TE_METRIC to determine if TE metric
is set or not
 * lib/if.c: replace LP_TE by LP_TE_METRIC in default LP status
 * zebra/interface.c: replace LP_TE by LP_TE_METRIC and check if TE metric
is equal to standard metric or not
 * ospfd/ospf_te.c: replace LP_TE by LP_TE_METRIC
 * isisd/isis_te.c: replace LP_TE by LP_TE_METRIC

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
isisd/isis_te.c
lib/if.c
lib/if.h
ospfd/ospf_te.c
zebra/interface.c

index 109f5e45742336f49d0004b2973ba1b6317ae3ba..34cd8397f43670a169e383a1e7bf9f24cca22629 100644 (file)
@@ -591,7 +591,7 @@ isis_link_params_update (struct isis_circuit *circuit, struct interface *ifp)
       else
         SUBTLV_TYPE(mtc->unrsv_bw) = 0;
 
-      if (IS_PARAM_SET(ifp->link_params, LP_TE))
+      if (IS_PARAM_SET(ifp->link_params, LP_TE_METRIC))
         set_circuitparams_te_metric(mtc, ifp->link_params->te_metric);
       else
         SUBTLV_TYPE(mtc->te_metric) = 0;
index fb12f201b2d5dc134b4f7b030f4020ac374aef63..0a1a8f6a26ae820e54da4689c2c927ffdfb249f9 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -1302,7 +1302,7 @@ if_link_params_get (struct interface *ifp)
                                       sizeof (struct if_link_params));
   if (iflp == NULL) return NULL;
 
-  /* Set TE metric == standard metric */
+  /* Set TE metric equal to standard metric */
   iflp->te_metric = ifp->metric;
 
   /* Compute default bandwidth based on interface */
@@ -1316,7 +1316,7 @@ if_link_params_get (struct interface *ifp)
     iflp->unrsv_bw[i] = iflp->default_bw;
 
   /* Update Link parameters status */
-  iflp->lp_status = LP_TE | LP_MAX_BW | LP_MAX_RSV_BW | LP_UNRSV_BW;
+  iflp->lp_status = LP_TE_METRIC | LP_MAX_BW | LP_MAX_RSV_BW | LP_UNRSV_BW;
 
   /* Finally attach newly created Link Parameters */
   ifp->link_params = iflp;
index e8a3b9d7b5b9749e67b66cc9bd3793fbe6bf0fde..cfa376d1ead696a2f63c4a068c1e96a1bdd0fdf0 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -146,9 +146,13 @@ struct if_stats
 #define MAX_CLASS_TYPE          8
 #define MAX_PKT_LOSS            50.331642
 
-/* Link Parameters Status: 0: unset, 1: set, */
+/*
+ * Link Parameters Status:
+ *  equal to 0: unset
+ *  different from 0: set
+ */
 #define LP_UNSET                0x0000
-#define LP_TE                   0x0001
+#define LP_TE_METRIC            0x0001
 #define LP_MAX_BW               0x0002
 #define LP_MAX_RSV_BW           0x0004
 #define LP_UNRSV_BW             0x0008
@@ -161,7 +165,6 @@ struct if_stats
 #define LP_RES_BW               0x0400
 #define LP_AVA_BW               0x0800
 #define LP_USE_BW               0x1000
-#define LP_TE_METRIC            0x2000
 
 #define IS_PARAM_UNSET(lp, st) !(lp->lp_status & st)
 #define IS_PARAM_SET(lp, st) (lp->lp_status & st)
index c691aac040ea01c6f48b5e44ba7b2943196b5ca4..4c5862e84a54bccb0b60d3591dad3b10be973907 100644 (file)
@@ -746,7 +746,7 @@ update_linkparams(struct mpls_te_link *lp)
   else
     TLV_TYPE(lp->unrsv_bw) = 0;
 
-  if (IS_PARAM_SET(ifp->link_params, LP_TE))
+  if (IS_PARAM_SET(ifp->link_params, LP_TE_METRIC))
     set_linkparams_te_metric(lp, ifp->link_params->te_metric);
   else
     TLV_TYPE(lp->te_metric) = 0;
index 8eddd3062a9e113c6be3ff24952a6beaba369616..4a0409702fb5af406a8e5b7767ef68674e571fda 100644 (file)
@@ -1107,7 +1107,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
       int i;
       struct if_link_params *iflp = ifp->link_params;
       vty_out(vty, "  Traffic Engineering Link Parameters:%s", VTY_NEWLINE);
-      if (IS_PARAM_SET(iflp, LP_TE))
+      if (IS_PARAM_SET(iflp, LP_TE_METRIC))
         vty_out(vty, "    TE metric %u%s",iflp->te_metric, VTY_NEWLINE);
       if (IS_PARAM_SET(iflp, LP_MAX_BW))
         vty_out(vty, "    Maximum Bandwidth %g (Byte/s)%s", iflp->max_bw, VTY_NEWLINE);
@@ -1785,7 +1785,7 @@ DEFUN (link_params_metric,
   VTY_GET_ULONG("metric", metric, argv[idx_number]->arg);
 
   /* Update TE metric if needed */
-  link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE | LP_TE_METRIC, metric);
+  link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE_METRIC, metric);
 
   return CMD_SUCCESS;
 }
@@ -1799,7 +1799,7 @@ DEFUN (no_link_params_metric,
   VTY_DECLVAR_CONTEXT (interface, ifp);
 
   /* Unset TE Metric */
-  link_param_cmd_unset(ifp, LP_TE | LP_TE_METRIC);
+  link_param_cmd_unset(ifp, LP_TE_METRIC);
 
   return CMD_SUCCESS;
 }
@@ -2737,7 +2737,7 @@ link_params_config_write (struct vty *vty, struct interface *ifp)
 
   vty_out (vty, " link-params%s", VTY_NEWLINE);
   vty_out(vty, "  enable%s", VTY_NEWLINE);
-  if (IS_PARAM_SET(iflp, LP_TE) && IS_PARAM_SET(iflp, LP_TE_METRIC))
+  if (IS_PARAM_SET(iflp, LP_TE_METRIC) && iflp->te_metric != ifp->metric)
     vty_out(vty, "  metric %u%s",iflp->te_metric, VTY_NEWLINE);
   if (IS_PARAM_SET(iflp, LP_MAX_BW) && iflp->max_bw != iflp->default_bw)
     vty_out(vty, "  max-bw %g%s", iflp->max_bw, VTY_NEWLINE);