mirror of https://github.com/ARMmbed/mbed-os.git
Update EMAC connect logic with MAC address change
Do not fail EMAC interface during connect if MAC address change is not supported in the selected interface.pull/13936/head
parent
2f610340ba
commit
f07030255f
|
@ -107,8 +107,9 @@ public:
|
|||
* be unique globally. The address must be set before calling the interface
|
||||
* connect() method.
|
||||
*
|
||||
* Not all interfaces are supporting MAC address set. A call to connect()
|
||||
* method will fail if MAC address is provided but not possible to use.
|
||||
* Not all interfaces are supporting MAC address set and an error is not returned
|
||||
* for this method call. Verify the changed MAC address by analysing packet
|
||||
* captures from the used network interface.
|
||||
*
|
||||
* 6-byte EUI-48 MAC addresses are used for Ethernet while Mesh interface is
|
||||
* using 8-byte EUI-64 address.
|
||||
|
|
|
@ -16,9 +16,12 @@
|
|||
*/
|
||||
|
||||
#include "netsocket/EMACInterface.h"
|
||||
#include "mbed_trace.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
#define TRACE_GROUP "EMACi"
|
||||
|
||||
/* Interface implementation */
|
||||
EMACInterface::EMACInterface(EMAC &emac, OnboardNetworkStack &stack) :
|
||||
_emac(emac),
|
||||
|
@ -49,10 +52,17 @@ nsapi_error_t EMACInterface::set_dhcp(bool dhcp)
|
|||
nsapi_error_t EMACInterface::connect()
|
||||
{
|
||||
if (!_interface) {
|
||||
nsapi_error_t err;
|
||||
nsapi_error_t err = NSAPI_ERROR_UNSUPPORTED;
|
||||
|
||||
if (_hw_mac_addr_set) {
|
||||
err = _stack.add_ethernet_interface(_emac, true, &_interface, _hw_mac_addr);
|
||||
} else {
|
||||
if (err == NSAPI_ERROR_UNSUPPORTED) {
|
||||
tr_error("Failed to set user MAC address");
|
||||
}
|
||||
}
|
||||
|
||||
if (err == NSAPI_ERROR_UNSUPPORTED)
|
||||
{
|
||||
err = _stack.add_ethernet_interface(_emac, true, &_interface);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue