[ipxe-devel] [PATCH 3/3] Set correct 'origin' field in iBFT structure

Hannes Reinecke hare at suse.de
Fri May 30 07:18:18 UTC 2014


The iBFT structure has an 'origin' field, which should specify
the IP address origin. As we can do dhcp we should be filling
in this structure to give the OS an indication here.

Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 src/drivers/block/ibft.c | 8 ++++++++
 src/include/ipxe/ibft.h  | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/drivers/block/ibft.c b/src/drivers/block/ibft.c
index 0700f8c..1b5130d 100644
--- a/src/drivers/block/ibft.c
+++ b/src/drivers/block/ibft.c
@@ -231,6 +231,7 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
 	struct ll_protocol *ll_protocol = netdev->ll_protocol;
 	struct in_addr netmask_addr = { 0 };
 	unsigned int netmask_count = 0;
+	struct settings *parent;
 	int rc;
 
 	/* Fill in common header */
@@ -240,6 +241,13 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
 	nic->header.flags = ( IBFT_FL_NIC_BLOCK_VALID |
 			      IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED );
 
+	/* Fill in origin */
+	parent = netdev_settings( netdev );
+	if (find_child_settings( parent, DHCP_SETTINGS_NAME ) != NULL)
+		nic->origin = IBFT_NIC_ORIGIN_DHCP;
+	else
+		nic->origin = IBFT_NIC_ORIGIN_MANUAL;
+
 	/* Extract values from configuration settings */
 	ibft_set_ipaddr_setting ( &nic->ip_address, &ip_setting, 1 );
 	DBG ( "iBFT NIC IP = %s\n", ibft_ipaddr ( &nic->ip_address ) );
diff --git a/src/include/ipxe/ibft.h b/src/include/ipxe/ibft.h
index 7337212..84b6533 100644
--- a/src/include/ipxe/ibft.h
+++ b/src/include/ipxe/ibft.h
@@ -197,6 +197,14 @@ struct ibft_nic {
 /** NIC global / link local */
 #define IBFT_FL_NIC_GLOBAL 0x04
 
+/** NIC IP Address origin */
+#define IBFT_NIC_ORIGIN_OTHER 0x00
+#define IBFT_NIC_ORIGIN_MANUAL 0x01
+#define IBFT_NIC_ORIGIN_WELLKNOWN 0x02
+#define IBFT_NIC_ORIGIN_DHCP 0x03
+#define IBFT_NIC_ORIGIN_RA 0x04
+#define IBFT_NIC_ORIGIN_UNCHANGED 0x0f
+
 /**
  * iBFT Target structure
  *
-- 
1.8.4.5




More information about the ipxe-devel mailing list