ソースを参照

[dhcp] Use PXE byte ordering for UUID in DHCP option 97

The PXE spec does not specify a byte ordering for UUIDs, but RFC4578
suggests that it follows the EFI spec, in which the first three fields
are little-endian.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11年前
コミット
a9b63ecda5
1個のファイルの変更8行の追加1行の削除
  1. 8
    1
      src/net/udp/dhcp.c

+ 8
- 1
src/net/udp/dhcp.c ファイルの表示

@@ -1041,10 +1041,17 @@ int dhcp_create_request ( struct dhcp_packet *dhcppkt,
1041 1041
 		return rc;
1042 1042
 	}
1043 1043
 
1044
-	/* Add client UUID, if we have one.  Required for PXE. */
1044
+	/* Add client UUID, if we have one.  Required for PXE.  The
1045
+	 * PXE spec does not specify a byte ordering for UUIDs, but
1046
+	 * RFC4578 suggests that it follows the EFI spec, in which the
1047
+	 * first three fields are little-endian.
1048
+	 */
1045 1049
 	client_uuid.type = DHCP_CLIENT_UUID_TYPE;
1046 1050
 	if ( ( len = fetch_uuid_setting ( NULL, &uuid_setting,
1047 1051
 					  &client_uuid.uuid ) ) >= 0 ) {
1052
+		__bswap_32s ( &client_uuid.uuid.canonical.a );
1053
+		__bswap_16s ( &client_uuid.uuid.canonical.b );
1054
+		__bswap_16s ( &client_uuid.uuid.canonical.c );
1048 1055
 		if ( ( rc = dhcppkt_store ( dhcppkt, DHCP_CLIENT_UUID,
1049 1056
 					    &client_uuid,
1050 1057
 					    sizeof ( client_uuid ) ) ) != 0 ) {

読み込み中…
キャンセル
保存