summaryrefslogtreecommitdiffstats
path: root/src/net/netdev_settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/netdev_settings.c')
-rw-r--r--src/net/netdev_settings.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/net/netdev_settings.c b/src/net/netdev_settings.c
index f641d3b21..2ff4ad3e3 100644
--- a/src/net/netdev_settings.c
+++ b/src/net/netdev_settings.c
@@ -22,6 +22,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <errno.h>
#include <byteswap.h>
#include <ipxe/dhcp.h>
+#include <ipxe/dhcpopts.h>
#include <ipxe/settings.h>
#include <ipxe/device.h>
#include <ipxe/netdevice.h>
@@ -37,14 +38,30 @@ struct setting mac_setting __setting = {
.name = "mac",
.description = "MAC address",
.type = &setting_type_hex,
+ .tag = NETDEV_SETTING_TAG_MAC,
};
struct setting busid_setting __setting = {
.name = "busid",
.description = "Bus ID",
.type = &setting_type_hex,
+ .tag = NETDEV_SETTING_TAG_BUS_ID,
};
/**
+ * Check applicability of network device setting
+ *
+ * @v settings Settings block
+ * @v setting Setting
+ * @ret applies Setting applies within this settings block
+ */
+static int netdev_applies ( struct settings *settings __unused,
+ struct setting *setting ) {
+
+ return ( IS_NETDEV_SETTING_TAG ( setting->tag ) ||
+ dhcpopt_applies ( setting->tag ) );
+}
+
+/**
* Store value of network device setting
*
* @v settings Settings block
@@ -114,6 +131,7 @@ static void netdev_clear ( struct settings *settings ) {
/** Network device configuration settings operations */
struct settings_operations netdev_settings_operations = {
+ .applies = netdev_applies,
.store = netdev_store,
.fetch = netdev_fetch,
.clear = netdev_clear,