public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of: net: Add option for random mac address
@ 2024-10-10 19:05 Iulian Gilca
  2024-10-10 19:53 ` Andrew Lunn
  0 siblings, 1 reply; 7+ messages in thread
From: Iulian Gilca @ 2024-10-10 19:05 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: igilca, Iulian Gilca, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

Embedded devices that may not have fixed mac address
may want to use a randomly generated one.
DSA switch ports are some of these.

Signed-off-by: Iulian Gilca <igilca1980@gmail.com>
---
 net/core/of_net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/core/of_net.c b/net/core/of_net.c
index 93ea425b9248..aa4acdffc710 100644
--- a/net/core/of_net.c
+++ b/net/core/of_net.c
@@ -142,6 +142,10 @@ int of_get_mac_address(struct device_node *np, u8 *addr)
 	if (!ret)
 		return 0;
 
+	ret = of_get_mac_addr(np, "random-address", addr);
+	if (!ret)
+		return 0;
+
 	return of_get_mac_address_nvmem(np, addr);
 }
 EXPORT_SYMBOL(of_get_mac_address);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-10 23:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 19:05 [PATCH] of: net: Add option for random mac address Iulian Gilca
2024-10-10 19:53 ` Andrew Lunn
2024-10-10 20:29   ` [PATCH v2] User random address if dt sets so Iulian Gilca
2024-10-10 20:59     ` Andrew Lunn
2024-10-10 21:54       ` [PATCH] of: net: Add option for random mac address Iulian Gilca
2024-10-10 22:54         ` Russell King (Oracle)
2024-10-10 23:00         ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox