diff options
author | Michael Brown | 2011-03-22 17:56:35 +0100 |
---|---|---|
committer | Michael Brown | 2011-03-22 20:54:58 +0100 |
commit | f5fd4dec3bab362a2ff7844859914e1f191fb905 (patch) | |
tree | 607eacef2f79c016a0c3c3031de2bb7d8aa7e331 /src/net/dhcpopts.c | |
parent | [forcedeth] Clear the MII link status register on link status changes (diff) | |
download | ipxe-f5fd4dec3bab362a2ff7844859914e1f191fb905.tar.gz ipxe-f5fd4dec3bab362a2ff7844859914e1f191fb905.tar.xz ipxe-f5fd4dec3bab362a2ff7844859914e1f191fb905.zip |
[settings] Formalise notion of setting applicability
Expose a function setting_applies() to allow a caller to determine
whether or not a particular setting is applicable to a particular
settings block.
Restrict DHCP-backed settings blocks to accepting only DHCP-based
settings.
Restrict network device settings blocks to accepting only DHCP-based
settings and network device-specific settings such as "mac".
Inspired-by: Glenn Brown <glenn@myri.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/dhcpopts.c')
-rw-r--r-- | src/net/dhcpopts.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/net/dhcpopts.c b/src/net/dhcpopts.c index f04b8e71..249fde15 100644 --- a/src/net/dhcpopts.c +++ b/src/net/dhcpopts.c @@ -348,6 +348,18 @@ static int set_dhcp_option ( struct dhcp_options *options, unsigned int tag, } /** + * Check applicability of DHCP option setting + * + * @v tag Setting tag number + * @ret applies Setting applies to this option block + */ +int dhcpopt_applies ( unsigned int tag ) { + + return ( tag && ( tag <= DHCP_ENCAP_OPT ( DHCP_MAX_OPTION, + DHCP_MAX_OPTION ) ) ); +} + +/** * Store value of DHCP option setting * * @v options DHCP option block |