diff options
| author | Olivier Dugeon <olivier.dugeon@orange.com> | 2022-01-24 17:09:29 +0100 |
|---|---|---|
| committer | Olivier Dugeon <olivier.dugeon@orange.com> | 2022-02-02 17:04:12 +0100 |
| commit | 538f34cb203f7a8f064df01084016ebe54af797b (patch) | |
| tree | 101aaa5ca2b7d6ad4ba8c37456dfa369e54fc34d /lib/if.c | |
| parent | 3d1ff4bfdb159583a62e72ccb359a8508c4cbb2e (diff) | |
lib: Correct bug for TE metric wrong assignement
When link-param is enabled for a given interface, TE metric is automatically
assigned to the metric of the interface. However, the metric of the interface
could be unassigned and keep the default value equal to 0. Thus, if the TE
metric is not explicitely modified within the `link-param metric` statement,
TE metric remains set to 0 which is not a valid value especially when
computing constrainted path.
This patch changes the assignement of the default value of the TE metric.
It is set to the metric of the interface only if the latter is not equal to 0.
TE topotests for OSPF and IS-IS have been adjusted accordingly.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1090,9 +1090,6 @@ struct if_link_params *if_link_params_get(struct interface *ifp) struct if_link_params *iflp = XCALLOC(MTYPE_IF_LINK_PARAMS, sizeof(struct if_link_params)); - /* Set TE metric equal to standard metric */ - iflp->te_metric = ifp->metric; - /* Compute default bandwidth based on interface */ iflp->default_bw = ((ifp->bandwidth ? ifp->bandwidth : DEFAULT_BANDWIDTH) @@ -1105,8 +1102,13 @@ struct if_link_params *if_link_params_get(struct interface *ifp) iflp->unrsv_bw[i] = iflp->default_bw; /* Update Link parameters status */ - iflp->lp_status = - LP_TE_METRIC | LP_MAX_BW | LP_MAX_RSV_BW | LP_UNRSV_BW; + iflp->lp_status = LP_MAX_BW | LP_MAX_RSV_BW | LP_UNRSV_BW; + + /* Set TE metric equal to standard metric only if it is set */ + if (ifp->metric != 0) { + iflp->te_metric = ifp->metric; + iflp->lp_status |= LP_TE_METRIC; + } /* Finally attach newly created Link Parameters */ ifp->link_params = iflp; |
