git: fcb6cac22397 - stable/13 - if_re: Generate an address if there is none in the EEPROM

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 19 Feb 2024 02:55:44 UTC
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=fcb6cac22397ecfc3fa9eaa9957a86a2fb639c8f

commit fcb6cac22397ecfc3fa9eaa9957a86a2fb639c8f
Author:     Evgeni Golov <evgeni@debian.org>
AuthorDate: 2023-02-27 22:50:56 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-19 02:52:41 +0000

    if_re: Generate an address if there is none in the EEPROM
    
    There exists hardware that has no ethernet address burned into
    the EEPROM. Loading if_re on such a HW brings the device up
    with '00:00:00:00:00:00' as the address, and that doesn't get
    you too far in a real network.
    
    PR: 262406
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/670
    Signed-off-by: Evgeni Golov <evgeni@debian.org>
    Differential Revision: https://reviews.freebsd.org/D34485
    (cherry picked from commit 55747938b5c4c913f742fd03189f0c660ced7bef)
---
 sys/dev/re/if_re.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index 0570f2574d37..95b43b5718cb 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -1678,6 +1678,11 @@ re_attach(device_t dev)
 		goto fail;
 	}
 
+	/* If address was not found, create one based on the hostid and name. */
+	if (ETHER_IS_ZERO(eaddr)) {
+		ether_gen_addr(ifp, (struct ether_addr *)eaddr);
+	}
+
 	/*
 	 * Call MI attach routine.
 	 */