Commit cda417edbf for frr
commit cda417edbffb39f64c8367c4df02e0f92103f182
Author: dingqipeng <dingqipeng@hotmail.com>
Date: Sun Oct 11 04:39:20 2026 +0800
ospf6d: preserve network byte order of translated NSSA tags
The Type-7 body already stores the external route tag in network byte
order. Applying htonl again before writing the translated Type-5 body
reverses the tag bytes on little-endian hosts.
Copy the serialized bytes directly at the existing optional-field offset.
Keep the host-to-network conversion in the ordinary LSA originator, and
leave prefix, forwarding-address, metric and checksum handling unchanged.
Fixes #23622.
Signed-off-by: dingqipeng <dingqipeng@hotmail.com>
diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c
index 41770977ce..7318079a73 100644
--- a/ospf6d/ospf6_nssa.c
+++ b/ospf6d/ospf6_nssa.c
@@ -221,7 +221,6 @@ static struct ospf6_lsa *ospf6_lsa_translated_nssa_new(struct ospf6_area *area,
struct prefix prefix;
struct ospf6 *ospf6 = area->ospf6;
ptrdiff_t tag_offset = 0;
- route_tag_t network_order;
struct ospf6_route *range;
if (IS_OSPF6_DEBUG_NSSA)
@@ -281,11 +280,9 @@ static struct ospf6_lsa *ospf6_lsa_translated_nssa_new(struct ospf6_area *area,
}
/* External Route Tag */
if (CHECK_FLAG(ext->bits_metric, OSPF6_ASBR_BIT_T)) {
- memcpy(&network_order, (caddr_t)ext + tag_offset,
- sizeof(network_order));
- network_order = htonl(network_order);
- memcpy(new_ptr, &network_order, sizeof(network_order));
- new_ptr += sizeof(network_order);
+ /* The received tag is already in network byte order. */
+ memcpy(new_ptr, (caddr_t)ext + tag_offset, sizeof(route_tag_t));
+ new_ptr += sizeof(route_tag_t);
}
/* Fill LSA Header */