[infra-if] add missing otInstance parameter to otPlatInfraIf APIs (#12662)

This commit updates the following `otPlatInfraIf` platform APIs to
include an `otInstance *` as their first parameter:

- `otPlatInfraIfHasAddress()`
- `otPlatInfraIfSendIcmp6Nd()`
- `otPlatInfraIfDiscoverNat64Prefix()`

Other APIs under `otPlatInfraIf` already follow this pattern. Passing
the `otInstance` pointer is the required standard for all platform
and public APIs; however, it was missed during the initial design of
these specific APIs.

While missing this parameter is often not a blocker on platforms using
a single OpenThread instance, it has become a blocker for simulations,
especially when multiple Border Routers are emulated in the same
simulation setup.

This change introduces a compatibility break for existing platform
implementations, however, it is necessary to support new use cases
(simulation of BRs). It also helps ensure consistent API design
across the stack.
This commit is contained in:
Abtin Keshavarzian
2026-03-12 10:10:08 -05:00
committed by GitHub
parent a03011cf73
commit cf733a331e
11 changed files with 72 additions and 41 deletions
+5 -2
View File
@@ -287,14 +287,16 @@ uint32_t otPlatAlarmMilliGetNow(void) { return sNow; }
//---------------------------------------------------------------------------------------------------------------------
// otPlatInfraIf
bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddress)
bool otPlatInfraIfHasAddress(otInstance *aInstance, uint32_t aInfraIfIndex, const otIp6Address *aAddress)
{
VerifyOrQuit(aInstance == sInstance);
VerifyOrQuit(aInfraIfIndex == kInfraIfIndex);
return AsCoreType(aAddress) == sInfraIfAddress;
}
otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex,
otError otPlatInfraIfSendIcmp6Nd(otInstance *aInstance,
uint32_t aInfraIfIndex,
const otIp6Address *aDestAddress,
const uint8_t *aBuffer,
uint16_t aBufferLength)
@@ -305,6 +307,7 @@ otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex,
Log("otPlatInfraIfSendIcmp6Nd(aDestAddr: %s, aBufferLength:%u)", AsCoreType(aDestAddress).ToString().AsCString(),
aBufferLength);
VerifyOrQuit(aInstance == sInstance);
VerifyOrQuit(aInfraIfIndex == kInfraIfIndex);
packet.Init(aBuffer, aBufferLength);