Set ifctx->gotrootpath=1 only when the root path came from the dhcp/bootp

server (and not when it came from a fallback method such as the ROOTDEVNAME
option).  This makes the code in bootpc_init() choose the first interface
that provided a rootpath name.  Previously it was choosing the first
interface that got an IP address, which could be on a different and
potentially unreachable subnet than the server providing the rootfs.

If the rootpath name actually does come from a fallback source, then the
code continues to use the first interface in the list that got configured.

Note that this wasn't directly reported in the PR cited below, but was
discovered while working on that PR.

PR:		187094
This commit is contained in:
Ian Lepore 2016-03-27 22:21:34 +00:00
parent faaf0c6eaa
commit eb2d4f022c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297323

View file

@ -1478,6 +1478,8 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
if (p == NULL) {
p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
TAG_ROOT);
if (p != NULL)
ifctx->gotrootpath = 1;
}
#ifdef ROOTDEVNAME
if ((p == NULL || (boothowto & RB_DFLTROOT) != 0) &&
@ -1497,7 +1499,6 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
}
printf("rootfs %s ", p);
gctx->gotrootpath = 1;
ifctx->gotrootpath = 1;
gctx->setrootfs = ifctx;
p = bootpc_tag(&gctx->tag, &ifctx->reply,