freebsd-dev/lib/libstand
Ian Lepore 703db8ccae Allow dhcp/bootp server-provided values to be overriden from environment
variables in loader(8) and other libstand applications.

Sometimes a dhcp server provides incorrect information along with the IP
address. It would be useful to have a way to override this with
locally-supplied information, such as command line parameters passed from a
prior-stage bootloader. This change allows pre-existing env vars to take
precedence over values delivered by the dhcp or bootp server.

The bootp/dhcp code in libstand automatically creates environment variables
from the data provided by the server (dhcp.root-path, dhcp.domain-name,
etc). It also transcribes the values to some global variables such as
'rootpath' and 'hostname'.

This change does two things:

    When adding dhcp.* vars to the environment, don't replace existing
    vars/values.

    When setting the global vars rootpath and hostname, use the
    dhcp.root-path and dhcp.host-name env var values if they exist.

This allows the platform-specific part of loader(8) to obtain override
values in some platform-specific way and store them in the environment
before opening the network device. The set of values that can be overriden
is currently limited to just string options. The values that are delivered
as binary data are things that probably shouldn't be overridden (IP,
netmask, gateway, etc).

The original patch this evolved from was submitted by martymac@

PR:		202098
Differential Revision:	https://reviews.freebsd.org/D4559
2015-12-22 03:02:52 +00:00
..
amd64 Move the 64-bit _setjmp to lib/libstand. 2012-12-21 15:15:35 +00:00
i386
mips Merge @228176 from Perforce to fix a bug introduced in r249553: 2013-04-28 14:40:29 +00:00
powerpc Fix loader on PowerPC following r279784. It turns out that, due to .PATH 2015-03-09 02:19:44 +00:00
sparc64
__main.c
arp.c
assert.c
bcd.c
bootp.c Allow dhcp/bootp server-provided values to be overriden from environment 2015-12-22 03:02:52 +00:00
bootp.h
bootparam.c
bootparam.h
bswap.c
bzipfs.c
cd9660.c Fix loader's ability to read the 10.1 release PowerPC ISOs. There appears to 2014-12-30 16:55:53 +00:00
close.c Clear f_rabuf after freeing the memory it points to. This prevents a 2013-12-18 04:52:30 +00:00
closeall.c
dev.c
dosfs.c Spin the twiddle in dosfs to give visual feedback for disk I/O on 2015-03-12 17:10:04 +00:00
dosfs.h Fix readdir for the root directory on a FAT32 file system. The root 2013-12-19 05:23:10 +00:00
environment.c Fix an inappropriate free of a non-dynamic value. While here, make the 2013-12-18 17:03:43 +00:00
ether.c
ext2fs.c Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
fstat.c
getopt.c
gets.c
globals.c
gzipfs.c
in_cksum.c
inet_ntoa.c
ioctl.c
iodesc.h
libstand.3 Fix usage example in kvprintf(9) and its copy in libstand(3): trailing '\n' 2015-01-23 07:30:57 +00:00
lseek.c
Makefile Create libstand version of uuid_from_string and uuid_to_string. The 2015-12-19 19:13:38 +00:00
Makefile.depend META_MODE: Remove DEP_RELDIR from Makefile.depend files. 2015-09-25 19:26:08 +00:00
nandfs.c Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
net.c
net.h
netif.c
netif.h
nfs.c Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
nfsv2.h
nullfs.c
open.c If we can't open the file, skip devclose() for the exclusive_file_system 2015-10-08 17:59:05 +00:00
pager.c
pkgfs.c Add pkgfs, a file system implementation for reading files out of a 2014-07-31 23:25:13 +00:00
printf.c Fix usage example in kvprintf(9) and its copy in libstand(3): trailing '\n' 2015-01-23 07:30:57 +00:00
qdivrem.c libstand's qdivrem.c assumes that sizeof(int) == sizeof(long), this is not 2014-07-24 19:06:15 +00:00
quad.h libstand's qdivrem.c assumes that sizeof(int) == sizeof(long), this is not 2014-07-24 19:06:15 +00:00
random.c
rarp.c
read.c Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
readdir.c
rpc.c
rpc.h
rpcv2.h
saioctl.h
sbrk.c Set the malloc alignment to 64 bytes on platforms that use the U-Boot API 2014-02-05 22:53:58 +00:00
splitfs.c
stand.h Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
stat.c
strcasecmp.c
strdup.c
strerror.c
strtol.c
strtoul.c Fix includes for use in libstand. 2013-02-19 17:09:23 +00:00
tftp.c pxeboot: make the tftp loader use the option root-path directive 2015-12-16 17:13:09 +00:00
tftp.h
twiddle.c Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
udp.c
ufs.c Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
uuid_from_string.c Create libstand version of uuid_from_string and uuid_to_string. The 2015-12-19 19:13:38 +00:00
uuid_to_string.c Create libstand version of uuid_from_string and uuid_to_string. The 2015-12-19 19:13:38 +00:00
write.c Add a divisor parameter to twiddle() so that callers can request that output 2014-12-22 20:42:36 +00:00
zalloc_defs.h Set the malloc alignment to 64 bytes on platforms that use the U-Boot API 2014-02-05 22:53:58 +00:00
zalloc_malloc.c
zalloc_mem.h Set the malloc alignment to 64 bytes on platforms that use the U-Boot API 2014-02-05 22:53:58 +00:00
zalloc_protos.h
zalloc.c Set the malloc alignment to 64 bytes on platforms that use the U-Boot API 2014-02-05 22:53:58 +00:00