[Bug 262406] [re] if_re doesn't generate MAC address if hardware has none

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 07 Mar 2022 19:33:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262406

            Bug ID: 262406
           Summary: [re] if_re doesn't generate MAC address if hardware
                    has none
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: evgeni@debian.org

Ohai,

there exists hardware (like [1]) 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.

Other drivers use ether_gen_addr(9) in such cases, to generate an address, and
so should if_re, I think?

Probably something like this (untested yet):

diff --git sys/dev/re/if_re.c sys/dev/re/if_re.c
index 5d1446e51ab..7905740a930 100644
--- sys/dev/re/if_re.c
+++ sys/dev/re/if_re.c
@@ -1676,6 +1676,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, eaddr);
+       }
+
        /*
         * Call MI attach routine.
         */

Thanks!

[1] https://www.dfrobot.com/product-2242.html

-- 
You are receiving this mail because:
You are the assignee for the bug.