[spinel] add udp port to the epskc state property (#11975)

This commit adds a field UDP port in the property
SPINEL_PROP_BORDER_AGENT_EPHEMERAL_KEY_STATE.

Similar as `SPINEL_PROP_BORDER_AGENT_MESHCOP_SERVICE_STATE`, NCP needs
to sync the UDP port number to the host as well so that the UDP proxy
on the host can correctly map the port and forward the UDP packet to
the NCP.

I missed the field in the previous commit. But since the spinel
property was just added recently and it hasn't been put into usage, I
think it's fine to change the existing spinel protocol.
This commit is contained in:
Li Cao
2025-10-01 12:41:21 -07:00
committed by GitHub
parent ceb992bbdc
commit 430b47b62f
2 changed files with 10 additions and 2 deletions
+3 -1
View File
@@ -4913,9 +4913,11 @@ enum
/// Border Agent Ephemeral Key State.
/**
* Format: `C` - Get and Unsolicited notifications.
* Format: `CS` - Get and Unsolicited notifications.
*
* `C`: The Ephemeral Key state. The value corresponds to `otBorderAgentEphemeralKeyState`.
* `S`: The UDP port that is being used by the ephemeral key. If the state is 'Disabled' or 'Stopped' , the port
* MUST be 0.
*/
SPINEL_PROP_BORDER_AGENT_EPHEMERAL_KEY_STATE = SPINEL_PROP_BORDER_AGENT__BEGIN + 2,
+7 -1
View File
@@ -1748,7 +1748,13 @@ exit:
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_BORDER_AGENT_EPHEMERAL_KEY_STATE>(void)
{
return mEncoder.WriteUint8(static_cast<uint8_t>(otBorderAgentEphemeralKeyGetState(mInstance)));
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mEncoder.WriteUint8(static_cast<uint8_t>(otBorderAgentEphemeralKeyGetState(mInstance))));
SuccessOrExit(error = mEncoder.WriteUint16(otBorderAgentEphemeralKeyGetUdpPort(mInstance)));
exit:
return error;
}
#endif