Skip to content

Commit b95d9ec

Browse files
committed
ospfd: fix summuary lsa update updating
Fix the issue where the OSPF Summary LSA's metric value fails to update properly and promptly when the LinkID changes. 1、Adjust Function set_metric and update the functions that call it. 2、Correct the metric setting in Function ospf_handle_summarylsa_lsId_chg, which was truncated due to data size issues. Configuration topology: Single routing device. Configuration content: Configure the OSPF protocol, add Area 0 and Area 1 respectively, and assign valid interfaces to the two areas. In Area 1, configure command A and set the metric value to 100. Check the OSPF database to confirm the generation of Summary LSAs correctly . Signed-off-by: “qlmeng” <[email protected]>
1 parent 5dbb7ff commit b95d9ec

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

ospfd/ospf_abr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ static void ospf_abr_update_aggregate(struct ospf_area_range *range,
564564
range->specifics++;
565565
}
566566

567-
static void set_metric(struct ospf_lsa *lsa, uint32_t metric)
567+
void ospf_abr_summary_lsa_set_metric(struct ospf_lsa *lsa, uint32_t metric)
568568
{
569569
struct summary_lsa *header;
570570
uint8_t *mp;
@@ -736,7 +736,7 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
736736
/* LSA is changed, refresh it */
737737
if (IS_DEBUG_OSPF_EVENT)
738738
zlog_debug("%s: refreshing summary", __func__);
739-
set_metric(old, full_cost);
739+
ospf_abr_summary_lsa_set_metric(old, full_cost);
740740
lsa = ospf_lsa_refresh(area->ospf, old);
741741

742742
if (!lsa) {
@@ -1107,7 +1107,7 @@ static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, uint32_t cost,
11071107
zlog_debug("%s: 2.2", __func__);
11081108

11091109
if (old) {
1110-
set_metric(old, cost);
1110+
ospf_abr_summary_lsa_set_metric(old, cost);
11111111
lsa = ospf_lsa_refresh(area->ospf, old);
11121112
} else
11131113
lsa = ospf_summary_asbr_lsa_originate(p, cost, area);

ospfd/ospf_abr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ extern void ospf_generate_indication_lsa(struct ospf *ospf,
8484
struct ospf_area *area);
8585
extern bool ospf_check_fr_enabled_all(struct ospf *ospf);
8686
extern void ospf_recv_indication_lsa_flush(struct ospf_lsa *lsa);
87+
extern void ospf_abr_summary_lsa_set_metric(struct ospf_lsa *lsa, uint32_t cost);
8788

8889
/** @brief Static inline functions.
8990
* @param Area pointer.

ospfd/ospf_lsa.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,9 +1360,7 @@ static struct ospf_lsa *ospf_handle_summarylsa_lsId_chg(struct ospf_area *area,
13601360
sl->mask.s_addr = mask.s_addr;
13611361

13621362
/* Copy the metric*/
1363-
metric_val = htonl(metric);
1364-
metric_buf = (char *)&metric_val;
1365-
memcpy(sl->metric, metric_buf, sizeof(metric_val));
1363+
ospf_abr_summary_lsa_set_metric(lsa, metric);
13661364

13671365
if (type == OSPF_SUMMARY_LSA) {
13681366
/*Refresh the LSA with new LSA*/

0 commit comments

Comments
 (0)