Browse Source

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

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
26f3a09ccf

+ 10
- 0
src/arch/i386/include/bits/uuid.h View File

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 View File

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

+ 3
- 0
src/include/gpxe/dhcp.h View File

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

+ 3
- 0
src/include/gpxe/uuid.h View File

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

+ 13
- 0
src/net/udp/dhcp.c View File

31
 #include <gpxe/retry.h>
31
 #include <gpxe/retry.h>
32
 #include <gpxe/tcpip.h>
32
 #include <gpxe/tcpip.h>
33
 #include <gpxe/ip.h>
33
 #include <gpxe/ip.h>
34
+#include <gpxe/uuid.h>
34
 #include <gpxe/dhcp.h>
35
 #include <gpxe/dhcp.h>
35
 
36
 
36
 /** @file
37
 /** @file
529
 	struct device_description *desc = &netdev->dev->desc;
530
 	struct device_description *desc = &netdev->dev->desc;
530
 	struct dhcp_netdev_desc dhcp_desc;
531
 	struct dhcp_netdev_desc dhcp_desc;
531
 	struct dhcp_client_id client_id;
532
 	struct dhcp_client_id client_id;
533
+	union uuid uuid;
532
 	size_t dhcp_features_len;
534
 	size_t dhcp_features_len;
533
 	size_t ll_addr_len;
535
 	size_t ll_addr_len;
534
 	int rc;
536
 	int rc;
604
 		return rc;
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
 	return 0;
620
 	return 0;
608
 }
621
 }
609
 
622
 

Loading…
Cancel
Save