]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Allow dhcp/bootp server-provided values to be overriden from environment
authorIan Lepore <ian@FreeBSD.org>
Tue, 22 Dec 2015 03:02:52 +0000 (03:02 +0000)
committerIan Lepore <ian@FreeBSD.org>
Tue, 22 Dec 2015 03:02:52 +0000 (03:02 +0000)
commit703db8ccae9806ec66e526f23cb4457e0bb969e9
tree1c9021ab52fa8068e9fe6783fc46a35844edf977
parent8b302ecdb9cb2c7ae651a07406666686a51ff7ad
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
lib/libstand/bootp.c