Blame SOURCES/0083-Parse-origin-value-from-iBFT.patch

d94dff
From 78e24f50ab754f35f4aa208ade7c9fd794d82036 Mon Sep 17 00:00:00 2001
d94dff
From: Hannes Reinecke <hare@suse.de>
d94dff
Date: Tue, 1 Jul 2014 11:14:57 +0200
d94dff
Subject: [PATCH] Parse 'origin' value from iBFT
d94dff
d94dff
iBFT has an 'origin' field which indicates the origin of the
d94dff
network address. If that is set to '3' it indicates that
d94dff
DHCP has been used; there is no need to evaluate the 'dhcp'
d94dff
field here.
d94dff
In fact. latest iPXE sets the 'origin' field, but not the
d94dff
'dhcp' field.
d94dff
d94dff
Signed-off-by: Hannes Reinecke <hare@suse.de>
d94dff
---
d94dff
 include/fw_context.h                    | 1 +
d94dff
 utils/fwparam_ibft/fw_entry.c           | 8 +++++---
d94dff
 utils/fwparam_ibft/fwparam_ibft_sysfs.c | 2 ++
d94dff
 utils/fwparam_ibft/fwparam_sysfs.c      | 2 ++
d94dff
 4 files changed, 10 insertions(+), 3 deletions(-)
d94dff
d94dff
diff --git a/include/fw_context.h b/include/fw_context.h
d94dff
index 6563d68..295b54d 100644
d94dff
--- a/include/fw_context.h
d94dff
+++ b/include/fw_context.h
d94dff
@@ -48,6 +48,7 @@ struct boot_context {
d94dff
 	char initiatorname[TARGET_NAME_MAXLEN + 1];
d94dff
 
d94dff
 	/* network settings */
d94dff
+	char origin[2];
d94dff
 	char dhcp[NI_MAXHOST];
d94dff
 	char iface[IF_NAMESIZE];
d94dff
 	char mac[18];
d94dff
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c
d94dff
index b6f05c1..295e905 100644
d94dff
--- a/utils/fwparam_ibft/fw_entry.c
d94dff
+++ b/utils/fwparam_ibft/fw_entry.c
d94dff
@@ -192,10 +192,12 @@ static void dump_network(struct boot_context *context)
d94dff
 	if (strlen(context->mac))
d94dff
 		printf("%s = %s\n", IFACE_HWADDR, context->mac);
d94dff
 	/*
d94dff
-	 * If this has a valid address then DHCP was used (broadcom sends
d94dff
-	 * 0.0.0.0).
d94dff
+	 * If the 'origin' field is '3' then DHCP is used.
d94dff
+	 * Otherwise evaluate the 'dhcp' field, if this has a valid
d94dff
+	 * address then DHCP was used (broadcom sends 0.0.0.0).
d94dff
 	 */
d94dff
-	if (strlen(context->dhcp) && strcmp(context->dhcp, "0.0.0.0"))
d94dff
+	if ((strlen(context->origin) && !strcmp(context->origin, "3")) ||
d94dff
+	    (strlen(context->dhcp) && strcmp(context->dhcp, "0.0.0.0")))
d94dff
 		printf("%s = DHCP\n", IFACE_BOOT_PROTO);
d94dff
 	else
d94dff
 		printf("%s = STATIC\n", IFACE_BOOT_PROTO);
d94dff
diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
d94dff
index 9185c85..2dc6f6d 100644
d94dff
--- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c
d94dff
+++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
d94dff
@@ -201,6 +201,8 @@ static int fill_nic_context(char *id, struct boot_context *context)
d94dff
 		      sizeof(context->secondary_dns));
d94dff
 	sysfs_get_str(id, IBFT_SUBSYS, "dhcp", context->dhcp,
d94dff
 		      sizeof(context->dhcp));
d94dff
+	sysfs_get_str(id, IBFT_SUBSYS, "origin", context->origin,
d94dff
+		      sizeof(context->origin));
d94dff
 	return 0;
d94dff
 }
d94dff
 
d94dff
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c
d94dff
index 2f37b59..09dd9fd 100644
d94dff
--- a/utils/fwparam_ibft/fwparam_sysfs.c
d94dff
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
d94dff
@@ -217,6 +217,8 @@ static int fill_nic_context(char *subsys, char *id,
d94dff
 		      sizeof(context->secondary_dns));
d94dff
 	sysfs_get_str(id, subsys, "dhcp", context->dhcp,
d94dff
 		      sizeof(context->dhcp));
d94dff
+	sysfs_get_str(id, subsys, "origin", context->origin,
d94dff
+		      sizeof(context->origin));
d94dff
 	return 0;
d94dff
 }
d94dff
 
d94dff
-- 
d94dff
1.9.3
d94dff