diff options
author | Tom Cosgrove <tom@cvs.openbsd.org> | 2007-07-27 17:46:58 +0000 |
---|---|---|
committer | Tom Cosgrove <tom@cvs.openbsd.org> | 2007-07-27 17:46:58 +0000 |
commit | 30515f6f19fa739a4b0f706aa4baa76c87996f5d (patch) | |
tree | 80f9bd98286467e6c112b1579f3fbe005cdb1cac /sys/arch/i386 | |
parent | 618f49663432f1402262847be95ee45f6db23714 (diff) |
We don't want to pass the PXE MAC address to the kernel when booting
from a local disk, since the MAC address causes the kernel to look for
root on NFS. Do this by remembering (not adding to boot arguments) the
MAC address when opening the PXE device, and clearing this if we happen
to load a file off a non-network disk.
"works as advertised for me" todd@;
"stop sitting on this/no objections" deraadt@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/stand/libsa/exec_i386.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/pxe.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/stand/pxeboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/pxeboot/devopen.c | 14 |
4 files changed, 25 insertions, 6 deletions
diff --git a/sys/arch/i386/stand/libsa/exec_i386.c b/sys/arch/i386/stand/libsa/exec_i386.c index 54fae4f6789..cfcefbcbb80 100644 --- a/sys/arch/i386/stand/libsa/exec_i386.c +++ b/sys/arch/i386/stand/libsa/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.31 2006/03/27 20:34:21 mickey Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.32 2007/07/27 17:46:56 tom Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -40,6 +40,8 @@ typedef void (*startfuncp)(int, int, int, int, int, int, int, int) __attribute__ ((noreturn)); +char *bootmac = NULL; + void run_loadfile(u_long *marks, int howto) { @@ -58,6 +60,9 @@ run_loadfile(u_long *marks, int howto) cd.conspeed = com_speed; addbootarg(BOOTARG_CONSDEV, sizeof(cd), &cd); + if (bootmac != NULL) + addbootarg(BOOTARG_BOOTMAC, sizeof(bios_bootmac_t), bootmac); + /* Pass memory map to the kernel */ mem_pass(); diff --git a/sys/arch/i386/stand/libsa/pxe.c b/sys/arch/i386/stand/libsa/pxe.c index 554a82b3fcb..5c5fc8fe977 100644 --- a/sys/arch/i386/stand/libsa/pxe.c +++ b/sys/arch/i386/stand/libsa/pxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxe.c,v 1.4 2006/05/20 22:37:40 deraadt Exp $ */ +/* $OpenBSD: pxe.c,v 1.5 2007/07/27 17:46:56 tom Exp $ */ /* $NetBSD: pxe.c,v 1.5 2003/03/11 18:29:00 drochner Exp $ */ /* @@ -115,6 +115,8 @@ BOOTPLAYER bootplayer; struct in_addr servip; /* for tftp */ /* XXX init this */ +extern char *bootmac; /* To pass to kernel */ + /* static struct btinfo_netif bi_netif; */ /***************************************************************************** @@ -230,7 +232,7 @@ pxe_netif_open() } bcopy(bootplayer.CAddr, desc.myea, ETHER_ADDR_LEN); - addbootarg(BOOTARG_BOOTMAC, sizeof(bios_bootmac_t), bootplayer.CAddr); + bootmac = bootplayer.CAddr; /* * Since the PXE BIOS has already done DHCP, make sure we diff --git a/sys/arch/i386/stand/pxeboot/conf.c b/sys/arch/i386/stand/pxeboot/conf.c index 7222c6ad6f6..bd33bae866a 100644 --- a/sys/arch/i386/stand/pxeboot/conf.c +++ b/sys/arch/i386/stand/pxeboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.14 2007/05/31 21:43:58 tom Exp $ */ +/* $OpenBSD: conf.c,v 1.15 2007/07/27 17:46:57 tom Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -45,7 +45,7 @@ #include "pxeboot.h" #include "pxe_net.h" -const char version[] = "2.01"; +const char version[] = "2.02"; int debug = 1; #undef _TEST diff --git a/sys/arch/i386/stand/pxeboot/devopen.c b/sys/arch/i386/stand/pxeboot/devopen.c index cf1deffdd75..836329474f1 100644 --- a/sys/arch/i386/stand/pxeboot/devopen.c +++ b/sys/arch/i386/stand/pxeboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.3 2007/06/27 20:29:38 mk Exp $ */ +/* $OpenBSD: devopen.c,v 1.4 2007/07/27 17:46:57 tom Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -38,6 +38,8 @@ extern char *fs_name[]; extern int nfsname; extern struct devsw netsw[]; +extern char *bootmac; /* Gets passed to kernel for network boot */ + /* XXX use slot for 'rd' for 'hd' pseudo-device */ const char bdevs[][4] = { "wd", "", "fd", "", "sd", "st", "cd", "mcd", @@ -96,6 +98,16 @@ devopen(struct open_file *f, const char *fname, char **file) } } + /* + * Assume that any network filesystems would be caught by the + * code above, so that the next phase of devopen() is only for + * local devices. + * + * Clear bootmac, to signal that we loaded this file from a + * non-network device. + */ + bootmac = NULL; + for (i = 0; i < ndevs && rc != 0; dp++, i++) { #ifdef DEBUG if (debug) |