summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2014-11-14 11:19:10 -0800
committerMike Christie <michaelc@cs.wisc.edu>2014-11-14 14:12:05 -0600
commit4959a89f421fdebc521f48003a79c2161e59d192 (patch)
treebf42b9b79e32e3b63089ce5f04b2c32807c95188 /utils
parenta125761c7b306ebc3aa1df3539cd4052dcfd59ca (diff)
downloadopen-iscsi-4959a89f421fdebc521f48003a79c2161e59d192.tar.gz
Represent DHCP "origin" as an enum, not a string.
See IBFT standard for location of "origin" field in iBFT table, and see MS document: http://msdn.microsoft.com/en-us/library/aa366281.aspx for description of enums, duplicated here in part: typedef enum { IpPrefixOriginOther = 0, IpPrefixOriginManual, IpPrefixOriginWellKnown, IpPrefixOriginDhcp, IpPrefixOriginRouterAdvertisement, IpPrefixOriginUnchanged = 16 } IP_PREFIX_ORIGIN;
Diffstat (limited to 'utils')
-rw-r--r--utils/fwparam_ibft/fw_entry.c5
-rw-r--r--utils/fwparam_ibft/fwparam_sysfs.c3
2 files changed, 4 insertions, 4 deletions
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c
index 9f0797f..f94a035 100644
--- a/utils/fwparam_ibft/fw_entry.c
+++ b/utils/fwparam_ibft/fw_entry.c
@@ -192,11 +192,12 @@ static void dump_network(struct boot_context *context)
if (strlen(context->mac))
printf("%s = %s\n", IFACE_HWADDR, context->mac);
/*
- * If the 'origin' field is '3' then DHCP is used.
+ * If the 'origin' field is 3 (IBFT_IP_PREFIX_ORIGIN_DHCP),
+ * then DHCP is used.
* Otherwise evaluate the 'dhcp' field, if this has a valid
* address then DHCP was used (broadcom sends 0.0.0.0).
*/
- if ((strlen(context->origin) && !strcmp(context->origin, "3")) ||
+ if ((context->origin == IBFT_IP_PREFIX_ORIGIN_DHCP) ||
(strlen(context->dhcp) && strcmp(context->dhcp, "0.0.0.0")))
printf("%s = DHCP\n", IFACE_BOOT_PROTO);
else
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c
index b531906..cd87b68 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -217,8 +217,7 @@ static int fill_nic_context(char *subsys, char *id,
sizeof(context->secondary_dns));
sysfs_get_str(id, subsys, "dhcp", context->dhcp,
sizeof(context->dhcp));
- sysfs_get_str(id, subsys, "origin", context->origin,
- sizeof(context->origin));
+ sysfs_get_int(id, subsys, "origin", (int *)&context->origin);
return 0;
}