summaryrefslogtreecommitdiffstats
path: root/lib/libstand/bootp.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r292583:ian2016-01-191-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Relnotes: Yes
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-3/+3
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* Fix minor issues in libstand.ed2009-05-311-1/+1
| | | | | | | - Don't call tftp_makereq() with too many arguments. - Don't forget to close one of the comments. Submitted by: Pawel Worach
* put a prefix on dhcp options to avoid clobbering, even by mistake,luigi2009-01-051-1/+1
| | | | | | existing environment variables. MFC after: 2 weeks
* Some libstand/bootp.c extension (written by Danny Braniss, slightlyluigi2008-12-051-0/+328
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | revised/modified by me) to store dhcp options into kenv variables, so the information is available to the boot loader and can be used to customize the boot process. The change is totally unintrusive, essentially made of a single function to be called while parsing a dhcp response, and a couple of tables to classify options. The values extracted from dhcp options are stored in the kenv environment in one of these forms: + options whose name and type is known are saved as dhcp.name = value (string, or number/ip addresses lists) + unknown options are assumed to be strings and saved as dhcp.option-NNN = "value" + options listed as '__INDIR' and sent on the wire as e.g. option unknown-252 "some.name=the actual value" are saved as some.name = "the actual value" + options listed as '__ILIST' and sent on the wire as e.g. option unknown-249 "a.b=foo bar; c.d= 123; e.f=done" are saved as multiple values a.b="foo bar" c.d="123" e.f="done" As you can see there is quite a bit of flexibility on what can be passed to the loader or the kernel. For the time being the vendor-specific table is mostly disabled, because there is no standard set of options for FreeBSD, and I don't know all the pxe-specific vendor options. Also, applications using libstand may live in memory-constrained environments, so it makes sense to keep these tables as small as possible, especially considering that one can generate arbitrary name=value pairs using site-specific options of type __INDIR or __ILIST (there are 4 __ILIST and 5 __INDIR in the table, numbered 246..249 and 250..254). Actually, considering that probably 75% of the standard dhcp options are totally useless, it might make sense to remove them as well. Submitted by: Danny Braniss MFC after: 4 weeks
* Remove California Regent's clause 3, per letterimp2007-01-091-4/+0
|
* Remove 'register' keyword.obrien2002-03-211-15/+15
|
* Add __FBSDID()s to libstanddillon2001-09-301-1/+3
|
* IN_CLASS*() macros assume host order and s_addr is network byteps2000-09-201-2/+2
| | | | order, so we must convert them to host order.
* Add support to send the string 'PXEClient' as the Vendor classps2000-08-111-3/+23
| | | | | | identifier to the DHCP server. Now you can check for this string in your dhcp configuration to decide whether you will hand out a lease to the client or not.
* This is libstand; a support library for standalone executables (eg. bootstrapmsmith1998-08-201-0/+396
modules). Obtained from: NetBSD, with some architectural changes and many additions.
OpenPOWER on IntegriCloud