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 13 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,13 +103,18 @@ static void ibft_set_ipaddr ( struct ibft_ipaddr *ipaddr, struct in_addr in ) {
103 103
  *
104 104
  * @v ipaddr		IP address field
105 105
  * @v setting		Configuration setting
106
- * @v tag		DHCP option tag
106
+ * @v count		Maximum number of IP addresses
107 107
  */
108 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,12 +238,15 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
233 238
 			      IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED );
234 239
 
235 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 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 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 250
 	if ( ( rc = ibft_set_string_setting ( strings, &nic->hostname,
243 251
 					      &hostname_setting ) ) != 0 )
244 252
 		return rc;

Loading…
Cancel
Save