mirror of
https://github.com/espressif/openthread.git
synced 2026-10-01 21:37:39 +00:00
[secure-transport] Add option to specify NetifIdentifier (#11338)
This commit aims to add the possibility to specify a netif identifier for SecureTransport::Open method. This method has now a default parameter, kNetifUnspecified, if no argument is explicitly passed by the user. Signed-off-by: Cristian Bulacu <[email protected]>
This commit is contained in:
@@ -137,7 +137,7 @@ Error Joiner::Start(const char *aPskd,
|
|||||||
Get<Mac::Mac>().SetExtAddress(randomAddress);
|
Get<Mac::Mac>().SetExtAddress(randomAddress);
|
||||||
Get<Mle::MleRouter>().UpdateLinkLocalAddress();
|
Get<Mle::MleRouter>().UpdateLinkLocalAddress();
|
||||||
|
|
||||||
SuccessOrExit(error = Get<Tmf::SecureAgent>().Open());
|
SuccessOrExit(error = Get<Tmf::SecureAgent>().Open(Ip6::NetifIdentifier::kNetifThreadInternal));
|
||||||
SuccessOrExit(error = Get<Tmf::SecureAgent>().Bind(kJoinerUdpPort));
|
SuccessOrExit(error = Get<Tmf::SecureAgent>().Bind(kJoinerUdpPort));
|
||||||
Get<Tmf::SecureAgent>().SetConnectCallback(HandleSecureCoapClientConnect, this);
|
Get<Tmf::SecureAgent>().SetConnectCallback(HandleSecureCoapClientConnect, this);
|
||||||
Get<Tmf::SecureAgent>().SetPsk(joinerPskd);
|
Get<Tmf::SecureAgent>().SetPsk(joinerPskd);
|
||||||
|
|||||||
@@ -676,13 +676,13 @@ SecureTransport::SecureTransport(Instance &aInstance, LinkSecurityMode aLayerTwo
|
|||||||
OT_UNUSED_VARIABLE(mVerifyPeerCertificate);
|
OT_UNUSED_VARIABLE(mVerifyPeerCertificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error SecureTransport::Open(void)
|
Error SecureTransport::Open(Ip6::NetifIdentifier aNetifIdentifier)
|
||||||
{
|
{
|
||||||
Error error;
|
Error error;
|
||||||
|
|
||||||
VerifyOrExit(!mIsOpen, error = kErrorAlready);
|
VerifyOrExit(!mIsOpen, error = kErrorAlready);
|
||||||
|
|
||||||
SuccessOrExit(error = mSocket.Open(Ip6::kNetifUnspecified));
|
SuccessOrExit(error = mSocket.Open(aNetifIdentifier));
|
||||||
mIsOpen = true;
|
mIsOpen = true;
|
||||||
mRemainingConnectionAttempts = mMaxConnectionAttempts;
|
mRemainingConnectionAttempts = mMaxConnectionAttempts;
|
||||||
|
|
||||||
|
|||||||
@@ -592,10 +592,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Opens the transport.
|
* Opens the transport.
|
||||||
*
|
*
|
||||||
|
* @param[in] aNetifIdentifier A network interface identifier. If not explicitly provided, kNetifUnspecified will
|
||||||
|
* be used by default.
|
||||||
|
*
|
||||||
* @retval kErrorNone Successfully opened the socket.
|
* @retval kErrorNone Successfully opened the socket.
|
||||||
* @retval kErrorAlready The connection is already open.
|
* @retval kErrorAlready The connection is already open.
|
||||||
*/
|
*/
|
||||||
Error Open(void);
|
Error Open(Ip6::NetifIdentifier aNetifIdentifier = Ip6::NetifIdentifier::kNetifUnspecified);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum number of allowed connection requests before socket is automatically closed.
|
* Sets the maximum number of allowed connection requests before socket is automatically closed.
|
||||||
|
|||||||
Reference in New Issue
Block a user