Skip to content

Commit fdeae95

Browse files
committed
drivers: ethernet: Allow changing the MAC address of the slip interface
This patch adds the necessary switch option to the slip configuration callback to enable the dynamic configuration of the MAC address of this interface. Signed-off-by: Marcelo Roberto Jimenez <[email protected]>
1 parent 24790c9 commit fdeae95

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/ethernet/eth_slip_tap.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ static enum ethernet_hw_caps eth_capabilities(const struct device *dev)
3333
static int eth_slip_tap_set_config(const struct device *dev, enum ethernet_config_type type,
3434
const struct ethernet_config *config)
3535
{
36+
struct slip_context *slip = dev->data;
37+
3638
switch (type) {
39+
case ETHERNET_CONFIG_TYPE_MAC_ADDRESS:
40+
memcpy(slip->mac_addr, config->mac_address.addr, 6);
41+
net_if_set_link_addr(slip->iface, slip->mac_addr, sizeof(slip->mac_addr),
42+
NET_LINK_ETHERNET);
43+
return 0;
3744
#if defined(CONFIG_NET_PROMISCUOUS_MODE)
3845
case ETHERNET_CONFIG_TYPE_PROMISC_MODE:
3946
return 0;

0 commit comments

Comments
 (0)