ShellPkg: Fix issue about ping fail with IPv4

Fix issue about ping fail with IPv4, which is caused by the incorrect
checksum in request message.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18167 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jiaxin Wu 2015-08-06 05:45:32 +00:00 committed by jiaxinwu
parent 5630cdfe9f
commit 3fd56a2672
1 changed files with 3 additions and 2 deletions

View File

@ -598,8 +598,7 @@ PingGenerateToken (
//
Request->Type = (UINT8)(Private->IpChoice==PING_IP_CHOICE_IP6?ICMP_V6_ECHO_REQUEST:ICMP_V4_ECHO_REQUEST);
Request->Code = 0;
Request->SequenceNum = SequenceNum;
Request->TimeStamp = TimeStamp;
Request->SequenceNum = SequenceNum;
Request->Identifier = 0;
Request->Checksum = 0;
@ -607,6 +606,7 @@ PingGenerateToken (
// Assembly token for transmit.
//
if (Private->IpChoice==PING_IP_CHOICE_IP6) {
Request->TimeStamp = TimeStamp;
((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrsLength = 0;
((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrs = NULL;
((EFI_IP6_TRANSMIT_DATA*)TxData)->OverrideData = 0;
@ -628,6 +628,7 @@ PingGenerateToken (
((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[3] = Private->DstAddress[3];
HeadSum = NetChecksum ((UINT8 *) Request, Private->BufferSize);
Request->TimeStamp = TimeStamp;
TempChecksum = NetChecksum ((UINT8 *) &Request->TimeStamp, sizeof (UINT64));
Request->Checksum = (UINT16)(~NetAddChecksum (HeadSum, TempChecksum));
}