Networking_SetHardwareAddress Function
Header: #include <applibs/networking.h>
Sets the hardware address for a network interface. The hardware address is persisted across reboots, and can only be set on an Ethernet interface. The application manifest must include the HardwareAddressConfig
capability.
static int Networking_SetHardwareAddress(const char *networkInterfaceName, const uint8_t *hardwareAddress, size_t hardwareAddressLength);
Parameters
networkInterfaceName
The name of the network interface to update.hardwareAddress
A pointer to an array of bytes containing the hardware address.hardwareAddressLength
The length of the hardware address. This should always be equal toHARDWARE_ADDRESS_LENGTH
.
Errors
Returns -1 if an error is encountered and sets errno
to the error value.
ENOINT: the network interface does not exist.
EPERM: this function is not allowed on the interface.
EAGAIN: the networking stack isn't ready.
ERANGE: the
hardwareAddressLength
is greater thanHARDWARE_ADDRESS_LENGTH
.EINVAL: the
hardwareAddressLength
is invalid.Examples:
- An all-zeroes hardware address (00:00:00:00:00:00). -
- Group hardware addresses (a hardware address with its first octet's least significant bit set to 1).
Any other errno
may be specified; such errors aren't deterministic and there is no guarantee that the values will be consistent across releases of the OS.
Return value
Returns 0 for success, or -1 for failure, in which case errno
is set to the error value.