Commit 2c625d2244 for frr
commit 2c625d2244898f7317d1392f608b8e0e9b6f71c5
Author: Minghan Chan <mhchann082@gmail.com>
Date: Fri Oct 16 14:35:09 2026 +0800
ospfd: keep the whole OSPF cost in the TED
ospf_te_parse_router_lsa() reads the 16-bit Router-LSA link metric, but
ospf_te_update_link() and ospf_te_update_subnet() have taken it as
uint8_t since f173deb352 ("ospfd: Add Link-State support"). The TED
edge and subnet metrics are therefore the cost modulo 256 (1000 becomes
232), and so are the IGP Metric and Prefix Metric that BGP-LS exports
from them. A cost change that keeps the low octet (1000 to 1256) even
looks like a refresh, so nothing is updated or exported.
The ls_attributes and ls_prefix metric fields are uint32_t, so take the
metric as uint32_t too.
Fixes: https://github.com/FRRouting/frr/issues/23710
Signed-off-by: Minghan Chan <mhchann082@gmail.com>
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index d9fc953e23..5c3432cdf7 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -1770,7 +1770,7 @@ static int ospf_te_export(uint8_t type, void *link_state)
* @param metric Standard metric attached to this Edge
*/
static void ospf_te_update_link(struct ls_ted *ted, struct ls_vertex *vertex,
- struct in_addr link_data, uint8_t metric)
+ struct in_addr link_data, uint32_t metric)
{
struct ls_edge *edge;
struct ls_attributes *attr;
@@ -1822,8 +1822,8 @@ static void ospf_te_update_link(struct ls_ted *ted, struct ls_vertex *vertex,
* @param p Prefix associated to the Subnet
* @param metric Standard metric attached to this Edge
*/
-static void ospf_te_update_subnet(struct ls_ted *ted, struct ls_vertex *vertex,
- struct prefix *p, uint8_t metric)
+static void ospf_te_update_subnet(struct ls_ted *ted, struct ls_vertex *vertex, struct prefix *p,
+ uint32_t metric)
{
struct ls_subnet *subnet;
struct ls_prefix *ls_pref;