Zhang Lubo
2015-07-14 03:17:29 UTC
Patch Version 2 includes the following changes:
Use NetRandomInitSeed() instead of AsmReadTsc() to generate
a random seed.
Macro definition of EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE for EBC architecture.
Add some space to make codes more standard.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <***@intel.com>
Reviewed-by: Fu Siyuan <***@intel.com>
Reviewed-by: jiaxinwu <***@intel.com>
---
NetworkPkg/DnsDxe/DnsImpl.c | 16 ++++++++--------
NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 2 ++
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c
index b196d18..42d51f0 100644
--- a/NetworkPkg/DnsDxe/DnsImpl.c
+++ b/NetworkPkg/DnsDxe/DnsImpl.c
@@ -1572,27 +1572,27 @@ ConstructDNSQueryIp (
}
//
// Fill header
//
- DnsHeader = (DNS_HEADER *)Frag.Bulk;
- DnsHeader->Identification = (UINT16)AsmReadTsc ();
+ DnsHeader = (DNS_HEADER *) Frag.Bulk;
+ DnsHeader->Identification = (UINT16)NET_RANDOM (NetRandomInitSeed());
DnsHeader->Flags.Uint16 = 0x0000;
DnsHeader->Flags.Bits.RD = 1;
DnsHeader->Flags.Bits.OpCode = DNS_FLAGS_OPCODE_STANDARD;
DnsHeader->Flags.Bits.QR = DNS_FLAGS_QR_QUERY;
DnsHeader->QuestionsNum = 1;
DnsHeader->AnswersNum = 0;
DnsHeader->AuthorityNum = 0;
DnsHeader->AditionalNum = 0;
- DnsHeader->Identification = HTONS(DnsHeader->Identification);
- DnsHeader->Flags.Uint16 = HTONS(DnsHeader->Flags.Uint16);
- DnsHeader->QuestionsNum = HTONS(DnsHeader->QuestionsNum);
- DnsHeader->AnswersNum = HTONS(DnsHeader->AnswersNum);
- DnsHeader->AuthorityNum = HTONS(DnsHeader->AuthorityNum);
- DnsHeader->AditionalNum = HTONS(DnsHeader->AditionalNum);
+ DnsHeader->Identification = HTONS (DnsHeader->Identification);
+ DnsHeader->Flags.Uint16 = HTONS (DnsHeader->Flags.Uint16);
+ DnsHeader->QuestionsNum = HTONS (DnsHeader->QuestionsNum);
+ DnsHeader->AnswersNum = HTONS (DnsHeader->AnswersNum);
+ DnsHeader->AuthorityNum = HTONS (DnsHeader->AuthorityNum);
+ DnsHeader->AditionalNum = HTONS (DnsHeader->AditionalNum);
Frag.Len = sizeof (*DnsHeader);
//
// Fill Query name
diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
index 42a3874..47e07aa 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
@@ -80,10 +80,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0010
#elif defined (MDE_CPU_ARM)
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0012
#elif defined (MDE_CPU_AARCH64)
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0013
+#elif defined (MDE_CPU_EBC)
+#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0011
#endif
/// DHCP offer types among HTTP boot.
/// Dhcp4 and Dhcp6 share this definition, and corresponding
/// relatioinship is as follows:
Use NetRandomInitSeed() instead of AsmReadTsc() to generate
a random seed.
Macro definition of EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE for EBC architecture.
Add some space to make codes more standard.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <***@intel.com>
Reviewed-by: Fu Siyuan <***@intel.com>
Reviewed-by: jiaxinwu <***@intel.com>
---
NetworkPkg/DnsDxe/DnsImpl.c | 16 ++++++++--------
NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 2 ++
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c
index b196d18..42d51f0 100644
--- a/NetworkPkg/DnsDxe/DnsImpl.c
+++ b/NetworkPkg/DnsDxe/DnsImpl.c
@@ -1572,27 +1572,27 @@ ConstructDNSQueryIp (
}
//
// Fill header
//
- DnsHeader = (DNS_HEADER *)Frag.Bulk;
- DnsHeader->Identification = (UINT16)AsmReadTsc ();
+ DnsHeader = (DNS_HEADER *) Frag.Bulk;
+ DnsHeader->Identification = (UINT16)NET_RANDOM (NetRandomInitSeed());
DnsHeader->Flags.Uint16 = 0x0000;
DnsHeader->Flags.Bits.RD = 1;
DnsHeader->Flags.Bits.OpCode = DNS_FLAGS_OPCODE_STANDARD;
DnsHeader->Flags.Bits.QR = DNS_FLAGS_QR_QUERY;
DnsHeader->QuestionsNum = 1;
DnsHeader->AnswersNum = 0;
DnsHeader->AuthorityNum = 0;
DnsHeader->AditionalNum = 0;
- DnsHeader->Identification = HTONS(DnsHeader->Identification);
- DnsHeader->Flags.Uint16 = HTONS(DnsHeader->Flags.Uint16);
- DnsHeader->QuestionsNum = HTONS(DnsHeader->QuestionsNum);
- DnsHeader->AnswersNum = HTONS(DnsHeader->AnswersNum);
- DnsHeader->AuthorityNum = HTONS(DnsHeader->AuthorityNum);
- DnsHeader->AditionalNum = HTONS(DnsHeader->AditionalNum);
+ DnsHeader->Identification = HTONS (DnsHeader->Identification);
+ DnsHeader->Flags.Uint16 = HTONS (DnsHeader->Flags.Uint16);
+ DnsHeader->QuestionsNum = HTONS (DnsHeader->QuestionsNum);
+ DnsHeader->AnswersNum = HTONS (DnsHeader->AnswersNum);
+ DnsHeader->AuthorityNum = HTONS (DnsHeader->AuthorityNum);
+ DnsHeader->AditionalNum = HTONS (DnsHeader->AditionalNum);
Frag.Len = sizeof (*DnsHeader);
//
// Fill Query name
diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
index 42a3874..47e07aa 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
@@ -80,10 +80,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0010
#elif defined (MDE_CPU_ARM)
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0012
#elif defined (MDE_CPU_AARCH64)
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0013
+#elif defined (MDE_CPU_EBC)
+#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE 0x0011
#endif
/// DHCP offer types among HTTP boot.
/// Dhcp4 and Dhcp6 share this definition, and corresponding
/// relatioinship is as follows:
--
1.9.5.msysgit.1
1.9.5.msysgit.1