mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 10:02:42 +03:00
[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>
This commit is contained in:
@@ -347,6 +347,18 @@ static int set_dhcp_option ( struct dhcp_options *options, unsigned int tag,
|
||||
return offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user