From 6a8d4ea2a518305cfbde4a68e8f10bb0a83d3703 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 31 Jul 2024 08:32:55 -0700 Subject: [PATCH] [ip6] avoid re-reading IPv6 header when updating BR counters (#10558) This commit updates the code to avoid re-reading the IPv6 header when updating BR-related counters in `Ip6::PassToHost()`. --- src/core/net/ip6.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp index 0941a4abf..1ca4f4b0f 100644 --- a/src/core/net/ip6.cpp +++ b/src/core/net/ip6.cpp @@ -1032,12 +1032,7 @@ Error Ip6::PassToHost(OwnedPtr &aMessagePtr, #endif #if OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE - { - Header header; - - IgnoreError(header.ParseFrom(*messagePtr)); - UpdateBorderRoutingCounters(header, messagePtr->GetLength(), /* aIsInbound */ false); - } + UpdateBorderRoutingCounters(aHeader, messagePtr->GetLength(), /* aIsInbound */ false); #endif #if OPENTHREAD_CONFIG_IP6_RESTRICT_FORWARDING_LARGER_SCOPE_MCAST_WITH_LOCAL_SRC