Browse Source

[iscsi] Include both DNS addresses in iBFT, if available

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
94cdad9c0e
1 changed files with 17 additions and 9 deletions
  1. 17
    9
      src/drivers/block/ibft.c

+ 17
- 9
src/drivers/block/ibft.c View File

103
  *
103
  *
104
  * @v ipaddr		IP address field
104
  * @v ipaddr		IP address field
105
  * @v setting		Configuration setting
105
  * @v setting		Configuration setting
106
- * @v tag		DHCP option tag
106
+ * @v count		Maximum number of IP addresses
107
  */
107
  */
108
 static void ibft_set_ipaddr_setting ( struct ibft_ipaddr *ipaddr,
108
 static void ibft_set_ipaddr_setting ( struct ibft_ipaddr *ipaddr,
109
-				      struct setting *setting ) {
110
-	struct in_addr in;
111
-	fetch_ipv4_setting ( NULL, setting, &in );
112
-	ibft_set_ipaddr ( ipaddr, in );
109
+				      struct setting *setting,
110
+				      unsigned int count ) {
111
+	struct in_addr in[count];
112
+	unsigned int i;
113
+
114
+	fetch_ipv4_array_setting ( NULL, setting, in, count );
115
+	for ( i = 0 ; i < count ; i++ ) {
116
+		ibft_set_ipaddr ( &ipaddr[i], in[i] );
117
+	}
113
 }
118
 }
114
 
119
 
115
 /**
120
 /**
233
 			      IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED );
238
 			      IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED );
234
 
239
 
235
 	/* Extract values from configuration settings */
240
 	/* Extract values from configuration settings */
236
-	ibft_set_ipaddr_setting ( &nic->ip_address, &ip_setting );
241
+	ibft_set_ipaddr_setting ( &nic->ip_address, &ip_setting, 1 );
237
 	DBG ( "iBFT NIC IP = %s\n", ibft_ipaddr ( &nic->ip_address ) );
242
 	DBG ( "iBFT NIC IP = %s\n", ibft_ipaddr ( &nic->ip_address ) );
238
-	ibft_set_ipaddr_setting ( &nic->gateway, &gateway_setting );
243
+	ibft_set_ipaddr_setting ( &nic->gateway, &gateway_setting, 1 );
239
 	DBG ( "iBFT NIC gateway = %s\n", ibft_ipaddr ( &nic->gateway ) );
244
 	DBG ( "iBFT NIC gateway = %s\n", ibft_ipaddr ( &nic->gateway ) );
240
-	ibft_set_ipaddr_setting ( &nic->dns[0], &dns_setting );
241
-	DBG ( "iBFT NIC DNS = %s\n", ibft_ipaddr ( &nic->dns[0] ) );
245
+	ibft_set_ipaddr_setting ( &nic->dns[0], &dns_setting,
246
+				  ( sizeof ( nic->dns ) /
247
+				    sizeof ( nic->dns[0] ) ) );
248
+	DBG ( "iBFT NIC DNS = %s", ibft_ipaddr ( &nic->dns[0] ) );
249
+	DBG ( ", %s\n", ibft_ipaddr ( &nic->dns[1] ) );
242
 	if ( ( rc = ibft_set_string_setting ( strings, &nic->hostname,
250
 	if ( ( rc = ibft_set_string_setting ( strings, &nic->hostname,
243
 					      &hostname_setting ) ) != 0 )
251
 					      &hostname_setting ) ) != 0 )
244
 		return rc;
252
 		return rc;

Loading…
Cancel
Save