On amd64 and i386, when we recognize that we've been PXE-booted and
identified the interface, there is this:
...
if (ifp) {
#if defined(NFSCLIENT)
printf("PXE boot MAC address %s, interface %s\n",
ether_sprintf(bios_bootmac->mac), ifp->if_xname);
bootdv = parsedisk(ifp->if_xname, strlen(ifp->if_xname),
0, &tmpdev);
part = 0;
#endif
} else
printf("PXE boot MAC address %s, interface %s\n",
ether_sprintf(bios_bootmac->mac), "unknown");
...
Setting the boot device is protected by the NFSCLIENT ifdef, but I
don't see why this should affect the reporting of the identified
interface.
So, move the ifdef two lines down. And while I'm here, modernize the
preceding loop a bit; ok?
Index: arch/amd64/amd64/autoconf.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/autoconf.c,v
retrieving revision 1.50
diff -u -p -r1.50 autoconf.c
--- arch/amd64/amd64/autoconf.c 14 Oct 2017 04:44:43 -0000 1.50
+++ arch/amd64/amd64/autoconf.c 7 Feb 2018 00:10:24 -0000
@@ -196,18 +196,17 @@ diskconf(void)
if (bios_bootmac) {
struct ifnet *ifp;
- for (ifp = TAILQ_FIRST(&ifnet); ifp != NULL;
- ifp = TAILQ_NEXT(ifp, if_list)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
if (ifp->if_type == IFT_ETHER &&
- bcmp(bios_bootmac->mac,
+ memcmp(bios_bootmac->mac,
((struct arpcom *)ifp)->ac_enaddr,
ETHER_ADDR_LEN) == 0)
break;
}
if (ifp) {
-#if defined(NFSCLIENT)
printf("PXE boot MAC address %s, interface %s\n",
ether_sprintf(bios_bootmac->mac), ifp->if_xname);
+#if defined(NFSCLIENT)
bootdv = parsedisk(ifp->if_xname, strlen(ifp->if_xname),
0, &tmpdev);
part = 0;
Index: arch/i386/i386/autoconf.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/autoconf.c,v
retrieving revision 1.104
diff -u -p -r1.104 autoconf.c
--- arch/i386/i386/autoconf.c 27 Jan 2018 22:55:23 -0000 1.104
+++ arch/i386/i386/autoconf.c 7 Feb 2018 00:11:34 -0000
@@ -236,18 +236,17 @@ diskconf(void)
if (bios_bootmac) {
struct ifnet *ifp;
- for (ifp = TAILQ_FIRST(&ifnet); ifp != NULL;
- ifp = TAILQ_NEXT(ifp, if_list)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
if (ifp->if_type == IFT_ETHER &&
- bcmp(bios_bootmac->mac,
+ memcmp(bios_bootmac->mac,
((struct arpcom *)ifp)->ac_enaddr,
ETHER_ADDR_LEN) == 0)
break;
}
if (ifp) {
-#if defined(NFSCLIENT)
printf("PXE boot MAC address %s, interface %s\n",
ether_sprintf(bios_bootmac->mac), ifp->if_xname);
+#if defined(NFSCLIENT)
bootdv = parsedisk(ifp->if_xname, strlen(ifp->if_xname),
0, &tmpdev);
part = 0;
--
Christian "naddy" Weisgerber [email protected]