]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[iscsi] Include IP address origin in iBFT
authorMichael Brown <mcb30@ipxe.org>
Thu, 12 Jun 2014 15:05:48 +0000 (16:05 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 12 Jun 2014 16:09:16 +0000 (17:09 +0100)
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>
src/drivers/block/ibft.c
src/include/ipxe/ibft.h

index f61add321d9b16c25243266f1df74a2b7f9b939b..6aabd766af93f6a61e9501e7794d57b6267ed129 100644 (file)
@@ -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 ) );
index 73372122deb96101d853068c390d4b9157b4e938..35f15105c985113586b44e97290021b721317e0c 100644 (file)
@@ -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
  *