Przeglądaj źródła

Add UUID to DHCP request as option 97 (if available).

tags/v0.9.3
Michael Brown 17 lat temu
rodzic
commit
26f3a09ccf

+ 10
- 0
src/arch/i386/include/bits/uuid.h Wyświetl plik

@@ -0,0 +1,10 @@
1
+#ifndef _I386_UUID_H
2
+#define _I386_UUID_H
3
+
4
+#include <smbios.h>
5
+
6
+static inline int get_uuid ( union uuid *uuid ) {
7
+	return smbios_get_uuid ( uuid );
8
+}
9
+
10
+#endif /* _I386_UUID_H */

+ 1
- 0
src/arch/i386/include/smbios.h Wyświetl plik

@@ -46,5 +46,6 @@ extern int find_smbios_structure ( unsigned int type,
46 46
 extern int find_smbios_string ( struct smbios_strings *strings,
47 47
 				unsigned int index,
48 48
 				char *buffer, size_t length );
49
+extern int smbios_get_uuid ( union uuid *uuid );
49 50
 
50 51
 #endif /* _SMBIOS_H */

+ 3
- 0
src/include/gpxe/dhcp.h Wyświetl plik

@@ -135,6 +135,9 @@ struct job_interface;
135 135
  */
136 136
 #define DHCP_BOOTFILE_NAME 67
137 137
 
138
+/** UUID client identifier */
139
+#define DHCP_CLIENT_UUID 97
140
+
138 141
 /** Etherboot-specific encapsulated options
139 142
  *
140 143
  * This encapsulated options field is used to contain all options

+ 3
- 0
src/include/gpxe/uuid.h Wyświetl plik

@@ -8,6 +8,9 @@
8 8
 
9 9
 #include <stdint.h>
10 10
 
11
+union uuid;
12
+#include <bits/uuid.h>
13
+
11 14
 /** A universally unique ID */
12 15
 union uuid {
13 16
 	/** Canonical form (00000000-0000-0000-0000-000000000000) */

+ 13
- 0
src/net/udp/dhcp.c Wyświetl plik

@@ -31,6 +31,7 @@
31 31
 #include <gpxe/retry.h>
32 32
 #include <gpxe/tcpip.h>
33 33
 #include <gpxe/ip.h>
34
+#include <gpxe/uuid.h>
34 35
 #include <gpxe/dhcp.h>
35 36
 
36 37
 /** @file
@@ -529,6 +530,7 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
529 530
 	struct device_description *desc = &netdev->dev->desc;
530 531
 	struct dhcp_netdev_desc dhcp_desc;
531 532
 	struct dhcp_client_id client_id;
533
+	union uuid uuid;
532 534
 	size_t dhcp_features_len;
533 535
 	size_t ll_addr_len;
534 536
 	int rc;
@@ -604,6 +606,17 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
604 606
 		return rc;
605 607
 	}
606 608
 
609
+	/* Add client UUID, if we have one.  Required for PXE. */
610
+	if ( ( rc = get_uuid ( &uuid ) ) == 0 ) {
611
+		if ( ( rc = set_dhcp_packet_option ( dhcppkt,
612
+						     DHCP_CLIENT_UUID, &uuid,
613
+						     sizeof ( uuid ) ) ) !=0){
614
+			DBG ( "DHCP could not set client UUID: %s\n",
615
+			      strerror ( rc ) );
616
+			return rc;
617
+		}
618
+	}
619
+
607 620
 	return 0;
608 621
 }
609 622
 

Ładowanie…
Anuluj
Zapisz