summaryrefslogtreecommitdiffstats
path: root/src/drivers/block
diff options
context:
space:
mode:
authorMichael Brown2014-06-12 17:05:48 +0200
committerMichael Brown2014-06-12 18:09:16 +0200
commitd5cf0589940c1cfd5907a2fd8183064ec2244617 (patch)
tree036fcca516b8cc6968b519a19446bcad4f67748d /src/drivers/block
parent[iscsi] Read IPv4 settings only from the relevant network device (diff)
downloadipxe-d5cf0589940c1cfd5907a2fd8183064ec2244617.tar.gz
ipxe-d5cf0589940c1cfd5907a2fd8183064ec2244617.tar.xz
ipxe-d5cf0589940c1cfd5907a2fd8183064ec2244617.zip
[iscsi] Include IP address origin in iBFT
The iBFT includes an "origin" field to indicate the source of the IP address. We use the heuristic of assuming that the source should be "manual" if the IP address originates directly from the network device settings block, and "DHCP" otherwise. This is an imperfect guess, but is likely to be correct in most common situations. Originally-implemented-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/block')
-rw-r--r--src/drivers/block/ibft.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/drivers/block/ibft.c b/src/drivers/block/ibft.c
index f61add32..6aabd766 100644
--- a/src/drivers/block/ibft.c
+++ b/src/drivers/block/ibft.c
@@ -236,6 +236,7 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
struct in_addr netmask_addr = { 0 };
unsigned int netmask_count = 0;
struct settings *parent = netdev_settings ( netdev );
+ struct settings *origin;
int rc;
/* Fill in common header */
@@ -245,6 +246,12 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
nic->header.flags = ( IBFT_FL_NIC_BLOCK_VALID |
IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED );
+ /* Determine origin of IP address */
+ fetch_setting ( parent, &ip_setting, &origin, NULL, NULL, 0 );
+ nic->origin = ( ( origin == parent ) ?
+ IBFT_NIC_ORIGIN_MANUAL : IBFT_NIC_ORIGIN_DHCP );
+ DBG ( "iBFT NIC origin = %d\n", nic->origin );
+
/* Extract values from configuration settings */
ibft_set_ipaddr_setting ( parent, &nic->ip_address, &ip_setting, 1 );
DBG ( "iBFT NIC IP = %s\n", ibft_ipaddr ( &nic->ip_address ) );