Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add UUID to DHCP request as option 97 (if available).
  • Loading branch information
Michael Brown committed Nov 21, 2007
1 parent 899f5b8 commit 26f3a09
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/arch/i386/include/bits/uuid.h
@@ -0,0 +1,10 @@
#ifndef _I386_UUID_H
#define _I386_UUID_H

#include <smbios.h>

static inline int get_uuid ( union uuid *uuid ) {
return smbios_get_uuid ( uuid );
}

#endif /* _I386_UUID_H */
1 change: 1 addition & 0 deletions src/arch/i386/include/smbios.h
Expand Up @@ -46,5 +46,6 @@ extern int find_smbios_structure ( unsigned int type,
extern int find_smbios_string ( struct smbios_strings *strings,
unsigned int index,
char *buffer, size_t length );
extern int smbios_get_uuid ( union uuid *uuid );

#endif /* _SMBIOS_H */
3 changes: 3 additions & 0 deletions src/include/gpxe/dhcp.h
Expand Up @@ -135,6 +135,9 @@ struct job_interface;
*/
#define DHCP_BOOTFILE_NAME 67

/** UUID client identifier */
#define DHCP_CLIENT_UUID 97

/** Etherboot-specific encapsulated options
*
* This encapsulated options field is used to contain all options
Expand Down
3 changes: 3 additions & 0 deletions src/include/gpxe/uuid.h
Expand Up @@ -8,6 +8,9 @@

#include <stdint.h>

union uuid;
#include <bits/uuid.h>

/** A universally unique ID */
union uuid {
/** Canonical form (00000000-0000-0000-0000-000000000000) */
Expand Down
13 changes: 13 additions & 0 deletions src/net/udp/dhcp.c
Expand Up @@ -31,6 +31,7 @@
#include <gpxe/retry.h>
#include <gpxe/tcpip.h>
#include <gpxe/ip.h>
#include <gpxe/uuid.h>
#include <gpxe/dhcp.h>

/** @file
Expand Down Expand Up @@ -529,6 +530,7 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
struct device_description *desc = &netdev->dev->desc;
struct dhcp_netdev_desc dhcp_desc;
struct dhcp_client_id client_id;
union uuid uuid;
size_t dhcp_features_len;
size_t ll_addr_len;
int rc;
Expand Down Expand Up @@ -604,6 +606,17 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
return rc;
}

/* Add client UUID, if we have one. Required for PXE. */
if ( ( rc = get_uuid ( &uuid ) ) == 0 ) {
if ( ( rc = set_dhcp_packet_option ( dhcppkt,
DHCP_CLIENT_UUID, &uuid,
sizeof ( uuid ) ) ) !=0){
DBG ( "DHCP could not set client UUID: %s\n",
strerror ( rc ) );
return rc;
}
}

return 0;
}

Expand Down

0 comments on commit 26f3a09

Please sign in to comment.