Set MAC address at runtime in application #39252
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Search |
Beta Was this translation helpful? Give feedback.
-
The I just realized you actually wanted something different, from the application you can do it like this
For example usage, see |
Beta Was this translation helpful? Give feedback.
-
Hi @jukkar, Thanks for your help. I explored and tried using net_mgmt(..), and found that it updates mac address only if ethernet link is down. |
Beta Was this translation helpful? Give feedback.
The
dev->data
is the device driver private data, the driver can store the mac address in its context if needed, this is not really relevant to your question. Only way to set the MAC address in the driver so that the rest of the system knows about it is to usenet_if_set_link_addr()
.I just realized you actually wanted something different, from the application you can do it like this
For example usage, see
tests/net/ethernet_mgmt/src/main.c
for details. Note that Ethernet driver needs to implementset_config
API function and handle the MAC address setting in it, like how it …