Kaynağa Gözat

[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>
tags/v1.20.1
Michael Brown 10 yıl önce
ebeveyn
işleme
d5cf058994
2 değiştirilmiş dosya ile 15 ekleme ve 0 silme
  1. 7
    0
      src/drivers/block/ibft.c
  2. 8
    0
      src/include/ipxe/ibft.h

+ 7
- 0
src/drivers/block/ibft.c Dosyayı Görüntüle

@@ -236,6 +236,7 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
236 236
 	struct in_addr netmask_addr = { 0 };
237 237
 	unsigned int netmask_count = 0;
238 238
 	struct settings *parent = netdev_settings ( netdev );
239
+	struct settings *origin;
239 240
 	int rc;
240 241
 
241 242
 	/* Fill in common header */
@@ -245,6 +246,12 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
245 246
 	nic->header.flags = ( IBFT_FL_NIC_BLOCK_VALID |
246 247
 			      IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED );
247 248
 
249
+	/* Determine origin of IP address */
250
+	fetch_setting ( parent, &ip_setting, &origin, NULL, NULL, 0 );
251
+	nic->origin = ( ( origin == parent ) ?
252
+			IBFT_NIC_ORIGIN_MANUAL : IBFT_NIC_ORIGIN_DHCP );
253
+	DBG ( "iBFT NIC origin = %d\n", nic->origin );
254
+
248 255
 	/* Extract values from configuration settings */
249 256
 	ibft_set_ipaddr_setting ( parent, &nic->ip_address, &ip_setting, 1 );
250 257
 	DBG ( "iBFT NIC IP = %s\n", ibft_ipaddr ( &nic->ip_address ) );

+ 8
- 0
src/include/ipxe/ibft.h Dosyayı Görüntüle

@@ -197,6 +197,14 @@ struct ibft_nic {
197 197
 /** NIC global / link local */
198 198
 #define IBFT_FL_NIC_GLOBAL 0x04
199 199
 
200
+/** NIC IP address origin */
201
+#define IBFT_NIC_ORIGIN_OTHER 0x00
202
+#define IBFT_NIC_ORIGIN_MANUAL 0x01
203
+#define IBFT_NIC_ORIGIN_WELLKNOWN 0x02
204
+#define IBFT_NIC_ORIGIN_DHCP 0x03
205
+#define IBFT_NIC_ORIGIN_RA 0x04
206
+#define IBFT_NIC_ORIGIN_UNCHANGED 0x0f
207
+
200 208
 /**
201 209
  * iBFT Target structure
202 210
  *

Loading…
İptal
Kaydet