Change the following kernel options to environment variables:
BOOTP -> bootp BOOTP_NFSROOT -> bootp.nfsroot BOOTP_NFSV3 -> bootp.nfsv3 BOOTP_COMPAT -> bootp.compat BOOTP_WIRED_TO -> bootp.wired_to This lets you PXE boot with a GENERIC kernel by putting this sort of thing in loader.conf: bootp="YES" bootp.nfsroot="YES" bootp.nfsv3="YES" bootp.wired_to="bge1" or even setting the variables manually from the OK prompt.
This commit is contained in:
parent
390f67839a
commit
59e1ebc9b5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131814
@ -27,7 +27,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_isa.h"
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_nfsroot.h"
|
||||
@ -203,11 +202,12 @@ void
|
||||
cpu_rootconf()
|
||||
{
|
||||
#if defined(NFSCLIENT) && defined(NFS_ROOT)
|
||||
int order = 0;
|
||||
#if !defined(BOOTP_NFSROOT)
|
||||
if (nfs_diskless_valid)
|
||||
#endif
|
||||
rootdevnames[order++] = "nfs:";
|
||||
char *cp = NULL;
|
||||
|
||||
if (nfs_diskless_valid || (cp = getenv("bootp.nfsroot")) != NULL)
|
||||
rootdevnames[0] = "nfs:";
|
||||
if (cp != NULL)
|
||||
freeenv(cp);
|
||||
#endif
|
||||
}
|
||||
SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)
|
||||
|
@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
|
||||
* devices are determined (from possibilities mentioned in ioconf.c),
|
||||
* and the drivers are initialized.
|
||||
*/
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_isa.h"
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_nfsroot.h"
|
||||
@ -143,15 +142,19 @@ configure_final(dummy)
|
||||
void
|
||||
cpu_rootconf()
|
||||
{
|
||||
#ifdef BOOTP
|
||||
bootpc_init();
|
||||
#endif
|
||||
char *cp;
|
||||
|
||||
if ((cp = getenv("bootp")) != NULL) {
|
||||
bootpc_init();
|
||||
freeenv(cp);
|
||||
}
|
||||
#if defined(NFSCLIENT) && defined(NFS_ROOT)
|
||||
#if !defined(BOOTP_NFSROOT)
|
||||
nfs_setup_diskless();
|
||||
if (nfs_diskless_valid)
|
||||
#endif
|
||||
if ((cp = getenv("bootp.nfsroot")) == NULL)
|
||||
nfs_setup_diskless();
|
||||
if (cp != NULL || nfs_diskless_valid)
|
||||
rootdevnames[0] = "nfs:";
|
||||
if (cp != NULL)
|
||||
freeenv(cp);
|
||||
#endif
|
||||
}
|
||||
SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)
|
||||
|
@ -273,7 +273,7 @@ net_getparams(sock)
|
||||
/*
|
||||
* If present, strip the server's address off of the rootpath
|
||||
* before passing it along. This allows us to be compatible with
|
||||
* the kernel's diskless (BOOTP_NFSROOT) booting conventions
|
||||
* the kernel's diskless (kenv bootp.nfsroot=1) booting conventions
|
||||
*/
|
||||
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
|
||||
if (rootpath[i] == ':')
|
||||
|
@ -352,6 +352,29 @@ by the kernel during the boot phase.
|
||||
List of semicolon-separated search path for bootable kernels.
|
||||
The default is
|
||||
.Dq Li kernel;kernel.old .
|
||||
.It Va bootp
|
||||
Setting this variable tells the kernel to use BOOTP to obtain an IP address
|
||||
and hostname at boot time.
|
||||
The kernel must be built with
|
||||
.Dv NFSCLIENT
|
||||
and
|
||||
.Dv NFS_ROOT
|
||||
defined.
|
||||
.It Va bootp.compat
|
||||
Setting this variable enables a workaround for broken BOOTP daemons.
|
||||
.It Va bootp.nfsroot
|
||||
Setting this variable tells the kernel to NFS mount the root filesystem using
|
||||
BOOTP information.
|
||||
.It Va bootp.nfsv3
|
||||
Setting this variable tells the kernel to use NFS version 3 to mount the root
|
||||
filesystem.
|
||||
.It Va bootp.wired_to
|
||||
This variable may be set to the name of the interface that is to be used to
|
||||
boot from when
|
||||
.Va bootp
|
||||
is set.
|
||||
If it is not set, the system will attempt to boot from all available
|
||||
interfaces, using the first one found.
|
||||
.It Va console
|
||||
Defines the current console.
|
||||
.It Va currdev
|
||||
|
@ -67,6 +67,11 @@ module_path="/boot/kernel;/boot/modules" # Set the module search path
|
||||
#boot_single="" # Start system in single-user mode
|
||||
#boot_userconfig="" # Run kernel's interactive device configuration program
|
||||
#boot_verbose="" # Causes extra debugging information to be printed
|
||||
#bootp="" # Use BOOTP to obtain an IP address at boot time
|
||||
#bootp.compat="" # Enable a workaround for broken bootp daemons
|
||||
#bootp.nfsroot="" # NFS mount the root filesystem using BOOTP info
|
||||
#bootp.nfsv3="" # Use NFS v3 to mount the root filesystem
|
||||
#bootp.wired_to="fxp0" # Use this interface only when bootp is enabled
|
||||
#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/stand/sysinstall"
|
||||
# Sets the list of init candidates
|
||||
#dumpdev="ad0s1b" # Set device for crash dumps
|
||||
|
@ -2124,14 +2124,7 @@ device pps
|
||||
device lpbb
|
||||
device pcfclock
|
||||
|
||||
# Kernel BOOTP support
|
||||
|
||||
options BOOTP # Use BOOTP to obtain IP address/hostname
|
||||
# Requires NFSCLIENT and NFS_ROOT
|
||||
options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info
|
||||
options BOOTP_NFSV3 # Use NFS v3 to NFS mount root
|
||||
options BOOTP_COMPAT # Workaround for broken bootp daemons.
|
||||
options BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP
|
||||
# Kernel BOOTP support - see loader(8)
|
||||
|
||||
#
|
||||
# Add tie-ins for a hardware watchdog. This only enables the hooks;
|
||||
|
@ -1573,8 +1573,8 @@ netsmb/smb_trantcp.c optional netsmb
|
||||
netsmb/smb_usr.c optional netsmb
|
||||
nfs/nfs_common.c optional nfsclient
|
||||
nfs/nfs_common.c optional nfsserver
|
||||
nfsclient/bootp_subr.c optional bootp nfsclient
|
||||
nfsclient/krpc_subr.c optional bootp nfsclient
|
||||
nfsclient/bootp_subr.c standard
|
||||
nfsclient/krpc_subr.c optional nfsclient
|
||||
nfsclient/nfs_bio.c optional nfsclient
|
||||
nfsclient/nfs_diskless.c optional nfsclient nfs_root
|
||||
nfsclient/nfs_node.c optional nfsclient
|
||||
|
@ -310,11 +310,6 @@ ALTQ_CDNR opt_altq.h
|
||||
ALTQ_PRIQ opt_altq.h
|
||||
ALTQ_NOPCC opt_altq.h
|
||||
ALTQ_DEBUG opt_altq.h
|
||||
BOOTP opt_bootp.h
|
||||
BOOTP_COMPAT opt_bootp.h
|
||||
BOOTP_NFSROOT opt_bootp.h
|
||||
BOOTP_NFSV3 opt_bootp.h
|
||||
BOOTP_WIRED_TO opt_bootp.h
|
||||
BRIDGE opt_bdg.h
|
||||
DEV_PF opt_pf.h
|
||||
DEV_PFLOG opt_pf.h
|
||||
|
@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
|
||||
* devices are determined (from possibilities mentioned in ioconf.c),
|
||||
* and the drivers are initialized.
|
||||
*/
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_isa.h"
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_nfsroot.h"
|
||||
@ -181,15 +180,19 @@ configure_final(dummy)
|
||||
void
|
||||
cpu_rootconf()
|
||||
{
|
||||
#ifdef BOOTP
|
||||
bootpc_init();
|
||||
#endif
|
||||
char *cp;
|
||||
|
||||
if ((cp = getenv("bootp")) != NULL) {
|
||||
bootpc_init();
|
||||
freeenv(cp);
|
||||
}
|
||||
#if defined(NFSCLIENT) && defined(NFS_ROOT)
|
||||
#if !defined(BOOTP_NFSROOT)
|
||||
nfs_setup_diskless();
|
||||
if (nfs_diskless_valid)
|
||||
#endif
|
||||
if ((cp = getenv("bootp.nfsroot")) == NULL)
|
||||
nfs_setup_diskless();
|
||||
if (cp != NULL || nfs_diskless_valid)
|
||||
rootdevnames[0] = "nfs:";
|
||||
if (cp != NULL)
|
||||
freeenv(cp);
|
||||
#endif
|
||||
}
|
||||
SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)
|
||||
|
@ -39,7 +39,6 @@
|
||||
* and many others.
|
||||
*/
|
||||
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_compat.h"
|
||||
#include "opt_nfsroot.h"
|
||||
#include "opt_pmap.h"
|
||||
@ -542,7 +541,6 @@ got_common_bi_size:
|
||||
movsb
|
||||
|
||||
#ifdef NFS_ROOT
|
||||
#ifndef BOOTP_NFSV3
|
||||
/*
|
||||
* If we have a nfs_diskless structure copy it in
|
||||
*/
|
||||
@ -556,7 +554,6 @@ got_common_bi_size:
|
||||
movsb
|
||||
movl $R(nfs_diskless_valid),%edi
|
||||
movl $1,(%edi)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_isa.h"
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_nfsroot.h"
|
||||
@ -54,9 +53,7 @@
|
||||
static void configure(void *);
|
||||
SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL)
|
||||
|
||||
#ifdef BOOTP
|
||||
void bootpc_init(void);
|
||||
#endif
|
||||
|
||||
#ifdef DEV_ISA
|
||||
#include <isa/isavar.h>
|
||||
@ -99,18 +96,18 @@ configure(void *dummy)
|
||||
void
|
||||
cpu_rootconf()
|
||||
{
|
||||
#if defined(NFSCLIENT) && defined(NFS_ROOT)
|
||||
int order = 0;
|
||||
#endif
|
||||
char *cp;
|
||||
|
||||
#ifdef BOOTP
|
||||
bootpc_init();
|
||||
#endif
|
||||
if ((cp = getenv("bootp")) != NULL) {
|
||||
bootpc_init();
|
||||
freeenv(cp);
|
||||
cp = NULL;
|
||||
}
|
||||
#if defined(NFSCLIENT) && defined(NFS_ROOT)
|
||||
#if !defined(BOOTP_NFSROOT)
|
||||
if (nfs_diskless_valid)
|
||||
#endif
|
||||
rootdevnames[order++] = "nfs:";
|
||||
if (nfs_diskless_valid || (cp = getenv("bootp.nfsroot")) != NULL)
|
||||
rootdevnames[0] = "nfs:";
|
||||
if (cp != NULL)
|
||||
freeenv(cp);
|
||||
#endif
|
||||
}
|
||||
SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)
|
||||
|
@ -6,7 +6,7 @@ KMOD= nfs4client
|
||||
SRCS= vnode_if.h \
|
||||
nfs_bio.c nfs_lock.c nfs_node.c nfs_nfsiod.c \
|
||||
nfs_common.c \
|
||||
opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h \
|
||||
opt_inet.h opt_nfs.h opt_nfsroot.h \
|
||||
nfs4_dev.c nfs4_idmap.c nfs4_socket.c nfs4_subs.c \
|
||||
nfs4_vfs_subs.c nfs4_vfsops.c nfs4_vn_subs.c nfs4_vnops.c
|
||||
SRCS+= opt_inet6.h
|
||||
|
@ -7,7 +7,7 @@ KMOD= nfsclient
|
||||
SRCS= vnode_if.h \
|
||||
nfs_bio.c nfs_lock.c nfs_node.c nfs_socket.c nfs_subs.c nfs_nfsiod.c \
|
||||
nfs_vfsops.c nfs_vnops.c nfs_common.c \
|
||||
opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h
|
||||
opt_inet.h opt_nfs.h opt_nfsroot.h
|
||||
SRCS+= nfs4_dev.c nfs4_idmap.c nfs4_socket.c nfs4_subs.c \
|
||||
nfs4_vfs_subs.c nfs4_vfsops.c nfs4_vn_subs.c nfs4_vnops.c
|
||||
SRCS+= opt_inet6.h
|
||||
|
@ -30,7 +30,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_ipfw.h"
|
||||
#include "opt_ipdn.h"
|
||||
#include "opt_ipdivert.h"
|
||||
@ -299,6 +298,7 @@ ip_input(struct mbuf *m)
|
||||
struct ipq *fp;
|
||||
struct in_ifaddr *ia = NULL;
|
||||
struct ifaddr *ifa;
|
||||
char *cp;
|
||||
int i, checkif, hlen = 0;
|
||||
u_short sum;
|
||||
struct in_addr pkt_dst;
|
||||
@ -598,10 +598,11 @@ ip_input(struct mbuf *m)
|
||||
goto ours;
|
||||
if (ia->ia_netbroadcast.s_addr == pkt_dst.s_addr)
|
||||
goto ours;
|
||||
#ifdef BOOTP_COMPAT
|
||||
if (IA_SIN(ia)->sin_addr.s_addr == INADDR_ANY)
|
||||
goto ours;
|
||||
#endif
|
||||
if ((cp = getenv("bootp.compat")) != NULL) {
|
||||
freeenv(cp);
|
||||
if (IA_SIN(ia)->sin_addr.s_addr == INADDR_ANY)
|
||||
goto ours;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_nfsroot.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_bootp.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -590,6 +588,7 @@ bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td)
|
||||
int gotrootpath;
|
||||
int retry;
|
||||
const char *s;
|
||||
char *cp;
|
||||
|
||||
NET_ASSERT_GIANT();
|
||||
|
||||
@ -954,14 +953,19 @@ bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td)
|
||||
error = 0;
|
||||
goto out;
|
||||
}
|
||||
#ifndef BOOTP_NFSROOT
|
||||
for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) {
|
||||
if (bootpc_ifctx_isresolved(ifctx) != 0) {
|
||||
error = 0;
|
||||
goto out;
|
||||
|
||||
if ((cp = getenv("bootp.nfsroot")) != NULL)
|
||||
freeenv(cp);
|
||||
else {
|
||||
for (ifctx = gctx->interfaces; ifctx != NULL;
|
||||
ifctx = ifctx->next) {
|
||||
if (bootpc_ifctx_isresolved(ifctx) != 0) {
|
||||
error = 0;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
error = ETIMEDOUT;
|
||||
goto out;
|
||||
|
||||
@ -1641,10 +1645,9 @@ bootpc_init(void)
|
||||
struct bootpc_ifcontext *ifctx, *nctx; /* Interface BOOTP contexts */
|
||||
struct bootpc_globalcontext *gctx; /* Global BOOTP context */
|
||||
struct ifnet *ifp;
|
||||
int error;
|
||||
#ifndef BOOTP_WIRED_TO
|
||||
char *cp, *bootp_wired_to;
|
||||
int bootp_nfsroot, error;
|
||||
int ifcnt;
|
||||
#endif
|
||||
struct nfsv3_diskless *nd;
|
||||
struct thread *td;
|
||||
|
||||
@ -1667,31 +1670,31 @@ bootpc_init(void)
|
||||
/*
|
||||
* Find a network interface.
|
||||
*/
|
||||
#ifdef BOOTP_WIRED_TO
|
||||
printf("bootpc_init: wired to interface '%s'\n",
|
||||
__XSTRING(BOOTP_WIRED_TO));
|
||||
allocifctx(gctx);
|
||||
#else
|
||||
/*
|
||||
* Preallocate interface context storage, if another interface
|
||||
* attaches and wins the race, it won't be eligible for bootp.
|
||||
*/
|
||||
IFNET_RLOCK();
|
||||
for (ifp = TAILQ_FIRST(&ifnet), ifcnt = 0;
|
||||
ifp != NULL;
|
||||
ifp = TAILQ_NEXT(ifp, if_link)) {
|
||||
if ((ifp->if_flags &
|
||||
(IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) !=
|
||||
IFF_BROADCAST)
|
||||
continue;
|
||||
ifcnt++;
|
||||
}
|
||||
IFNET_RUNLOCK();
|
||||
if (ifcnt == 0)
|
||||
panic("bootpc_init: no eligible interfaces");
|
||||
for (; ifcnt > 0; ifcnt--)
|
||||
if ((bootp_wired_to = getenv("bootp.wired_to")) != NULL) {
|
||||
printf("bootpc_init: wired to interface '%s'\n",
|
||||
bootp_wired_to);
|
||||
allocifctx(gctx);
|
||||
#endif
|
||||
} else {
|
||||
/*
|
||||
* Preallocate interface context storage, if another interface
|
||||
* attaches and wins the race, it won't be eligible for bootp.
|
||||
*/
|
||||
IFNET_RLOCK();
|
||||
for (ifp = TAILQ_FIRST(&ifnet), ifcnt = 0;
|
||||
ifp != NULL;
|
||||
ifp = TAILQ_NEXT(ifp, if_link)) {
|
||||
if ((ifp->if_flags &
|
||||
(IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) !=
|
||||
IFF_BROADCAST)
|
||||
continue;
|
||||
ifcnt++;
|
||||
}
|
||||
IFNET_RUNLOCK();
|
||||
if (ifcnt == 0)
|
||||
panic("bootpc_init: no eligible interfaces");
|
||||
for (; ifcnt > 0; ifcnt--)
|
||||
allocifctx(gctx);
|
||||
}
|
||||
|
||||
IFNET_RLOCK();
|
||||
for (ifp = TAILQ_FIRST(&ifnet), ifctx = gctx->interfaces;
|
||||
@ -1699,29 +1702,24 @@ bootpc_init(void)
|
||||
ifp = TAILQ_NEXT(ifp, if_link)) {
|
||||
strlcpy(ifctx->ireq.ifr_name, ifp->if_xname,
|
||||
sizeof(ifctx->ireq.ifr_name));
|
||||
#ifdef BOOTP_WIRED_TO
|
||||
if (strcmp(ifctx->ireq.ifr_name,
|
||||
__XSTRING(BOOTP_WIRED_TO)) != 0)
|
||||
continue;
|
||||
#else
|
||||
if ((ifp->if_flags &
|
||||
(IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) !=
|
||||
if (bootp_wired_to) {
|
||||
if (strcmp(ifctx->ireq.ifr_name, bootp_wired_to) != 0)
|
||||
continue;
|
||||
} else if ((ifp->if_flags &
|
||||
(IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) !=
|
||||
IFF_BROADCAST)
|
||||
continue;
|
||||
#endif
|
||||
ifctx->ifp = ifp;
|
||||
ifctx = ifctx->next;
|
||||
}
|
||||
IFNET_RUNLOCK();
|
||||
|
||||
if (gctx->interfaces == NULL || gctx->interfaces->ifp == NULL) {
|
||||
#ifdef BOOTP_WIRED_TO
|
||||
panic("bootpc_init: Could not find interface specified "
|
||||
"by BOOTP_WIRED_TO: "
|
||||
__XSTRING(BOOTP_WIRED_TO));
|
||||
#else
|
||||
panic("bootpc_init: no suitable interface");
|
||||
#endif
|
||||
if (bootp_wired_to)
|
||||
panic("bootpc_init: Could not find interface specified "
|
||||
"by bootp.wired_to: %s", bootp_wired_to);
|
||||
else
|
||||
panic("bootpc_init: no suitable interface");
|
||||
}
|
||||
|
||||
for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next)
|
||||
@ -1732,12 +1730,17 @@ bootpc_init(void)
|
||||
|
||||
error = bootpc_call(gctx, td);
|
||||
|
||||
if ((cp = getenv("bootp.nfsroot")) != NULL) {
|
||||
freeenv(cp);
|
||||
bootp_nfsroot = 1;
|
||||
} else
|
||||
bootp_nfsroot = 0;
|
||||
|
||||
if (error != 0) {
|
||||
#ifdef BOOTP_NFSROOT
|
||||
panic("BOOTP call failed");
|
||||
#else
|
||||
printf("BOOTP call failed\n");
|
||||
#endif
|
||||
if (bootp_nfsroot)
|
||||
panic("BOOTP call failed");
|
||||
else
|
||||
printf("BOOTP call failed\n");
|
||||
}
|
||||
|
||||
mountopts(&nd->root_args, NULL);
|
||||
@ -1746,10 +1749,8 @@ bootpc_init(void)
|
||||
if (bootpc_ifctx_isresolved(ifctx) != 0)
|
||||
bootpc_decode_reply(nd, ifctx, gctx);
|
||||
|
||||
#ifdef BOOTP_NFSROOT
|
||||
if (gctx->gotrootpath == 0)
|
||||
if (bootp_nfsroot && gctx->gotrootpath == 0)
|
||||
panic("bootpc: No root path offered");
|
||||
#endif
|
||||
|
||||
for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) {
|
||||
bootpc_adjust_interface(ifctx, gctx, td);
|
||||
@ -1795,6 +1796,8 @@ bootpc_init(void)
|
||||
free(ifctx, M_TEMP);
|
||||
}
|
||||
free(gctx, M_TEMP);
|
||||
if (bootp_wired_to)
|
||||
freeenv(bootp_wired_to);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1807,27 +1810,31 @@ md_mount(struct sockaddr_in *mdsin, char *path, u_char *fhp, int *fhsizep,
|
||||
struct nfs_args *args, struct thread *td)
|
||||
{
|
||||
struct mbuf *m;
|
||||
char *cp;
|
||||
int error;
|
||||
int authunixok;
|
||||
int authcount;
|
||||
int authver;
|
||||
|
||||
#ifdef BOOTP_NFSV3
|
||||
/* First try NFS v3 */
|
||||
/* Get port number for MOUNTD. */
|
||||
error = krpc_portmap(mdsin, RPCPROG_MNT, RPCMNT_VER3,
|
||||
&mdsin->sin_port, td);
|
||||
if (error == 0) {
|
||||
m = xdr_string_encode(path, strlen(path));
|
||||
if ((cp = getenv("bootp.nfsv3")) != NULL) {
|
||||
/* First try NFS v3 */
|
||||
/* Get port number for MOUNTD. */
|
||||
freeenv(cp);
|
||||
error = krpc_portmap(mdsin, RPCPROG_MNT, RPCMNT_VER3,
|
||||
&mdsin->sin_port, td);
|
||||
if (error == 0) {
|
||||
m = xdr_string_encode(path, strlen(path));
|
||||
|
||||
/* Do RPC to mountd. */
|
||||
error = krpc_call(mdsin, RPCPROG_MNT, RPCMNT_VER3,
|
||||
RPCMNT_MOUNT, &m, NULL, td);
|
||||
}
|
||||
if (error == 0) {
|
||||
args->flags |= NFSMNT_NFSV3;
|
||||
} else {
|
||||
#endif
|
||||
/* Do RPC to mountd. */
|
||||
error = krpc_call(mdsin, RPCPROG_MNT, RPCMNT_VER3,
|
||||
RPCMNT_MOUNT, &m, NULL, td);
|
||||
}
|
||||
if (error == 0)
|
||||
args->flags |= NFSMNT_NFSV3;
|
||||
} else
|
||||
error = 1; /* Need to try NFS v2 */
|
||||
|
||||
if (error) {
|
||||
/* Fallback to NFS v2 */
|
||||
|
||||
/* Get port number for MOUNTD. */
|
||||
@ -1843,10 +1850,7 @@ md_mount(struct sockaddr_in *mdsin, char *path, u_char *fhp, int *fhsizep,
|
||||
RPCMNT_MOUNT, &m, NULL, td);
|
||||
if (error != 0)
|
||||
return error; /* message already freed */
|
||||
|
||||
#ifdef BOOTP_NFSV3
|
||||
}
|
||||
#endif
|
||||
|
||||
if (xdr_int_decode(&m, &error) != 0 || error != 0)
|
||||
goto bad;
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_nfsroot.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -389,16 +388,23 @@ nfs_mountroot(struct mount *mp, struct thread *td)
|
||||
struct nfsv3_diskless *nd = &nfsv3_diskless;
|
||||
struct socket *so;
|
||||
struct vnode *vp;
|
||||
char *cp;
|
||||
int error, i;
|
||||
u_long l;
|
||||
char buf[128];
|
||||
|
||||
GIANT_REQUIRED; /* XXX until socket locking done */
|
||||
|
||||
#if defined(BOOTP_NFSROOT) && defined(BOOTP)
|
||||
bootpc_init(); /* use bootp to get nfs_diskless filled in */
|
||||
#elif defined(NFS_ROOT)
|
||||
nfs_setup_diskless();
|
||||
if ((cp = getenv("bootp")) != NULL) {
|
||||
freeenv(cp);
|
||||
if ((cp = getenv("bootp.nfsroot")) != NULL) {
|
||||
freeenv(cp);
|
||||
bootpc_init(); /* get nfs_diskless filled in */
|
||||
}
|
||||
}
|
||||
#if defined(NFS_ROOT)
|
||||
if (cp == NULL)
|
||||
nfs_setup_diskless();
|
||||
#endif
|
||||
|
||||
if (nfs_diskless_valid == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user