Code clean up in NetLib:
1. Add GLOBAL_REMOVE_IF_UNREFERENCED to all globals 2. Update NTOHL and NTOHS to be BaseLib func SwapBytes32/SwapBytes16 3. Remove duplicate NET_SWAP_SHORT (to use NTOHS instead) git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9648 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -105,6 +105,8 @@ Ip4ProcessIcmpRedirect (
|
||||
IP4_ROUTE_CACHE_ENTRY *CacheEntry;
|
||||
IP4_INTERFACE *IpIf;
|
||||
IP4_ADDR Gateway;
|
||||
IP4_ADDR Src;
|
||||
IP4_ADDR Dst;
|
||||
|
||||
//
|
||||
// Find the interface whose IP address is the source of the
|
||||
@@ -133,11 +135,9 @@ Ip4ProcessIcmpRedirect (
|
||||
continue;
|
||||
}
|
||||
|
||||
CacheEntry = Ip4FindRouteCache (
|
||||
Ip4Instance->RouteTable,
|
||||
NTOHL (Icmp->IpHead.Dst),
|
||||
NTOHL (Icmp->IpHead.Src)
|
||||
);
|
||||
Dst = NTOHL (Icmp->IpHead.Dst);
|
||||
Src = NTOHL (Icmp->IpHead.Src);
|
||||
CacheEntry = Ip4FindRouteCache (Ip4Instance->RouteTable, Dst, Src);
|
||||
|
||||
//
|
||||
// Only update the route cache's gateway if the source of the
|
||||
|
@@ -561,6 +561,10 @@ Ip4AutoConfigCallBackDpc (
|
||||
EFI_STATUS Status;
|
||||
UINTN Len;
|
||||
UINT32 Index;
|
||||
IP4_ADDR StationAddress;
|
||||
IP4_ADDR SubnetMask;
|
||||
IP4_ADDR SubnetAddress;
|
||||
IP4_ADDR GatewayAddress;
|
||||
|
||||
IpSb = (IP4_SERVICE *) Context;
|
||||
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
|
||||
@@ -646,11 +650,9 @@ Ip4AutoConfigCallBackDpc (
|
||||
// Set the default interface's address, then add a directed
|
||||
// route for it, that is, the route whose nexthop is zero.
|
||||
//
|
||||
Status = Ip4SetAddress (
|
||||
IpIf,
|
||||
EFI_NTOHL (Data->StationAddress),
|
||||
EFI_NTOHL (Data->SubnetMask)
|
||||
);
|
||||
StationAddress = EFI_NTOHL (Data->StationAddress);
|
||||
SubnetMask = EFI_NTOHL (Data->SubnetMask);
|
||||
Status = Ip4SetAddress (IpIf, StationAddress, SubnetMask);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
@@ -658,8 +660,8 @@ Ip4AutoConfigCallBackDpc (
|
||||
|
||||
Ip4AddRoute (
|
||||
IpSb->DefaultRouteTable,
|
||||
EFI_NTOHL (Data->StationAddress),
|
||||
EFI_NTOHL (Data->SubnetMask),
|
||||
StationAddress,
|
||||
SubnetMask,
|
||||
IP4_ALLZERO_ADDRESS
|
||||
);
|
||||
|
||||
@@ -669,12 +671,10 @@ Ip4AutoConfigCallBackDpc (
|
||||
for (Index = 0; Index < Data->RouteTableSize; Index++) {
|
||||
RouteEntry = &Data->RouteTable[Index];
|
||||
|
||||
Ip4AddRoute (
|
||||
IpSb->DefaultRouteTable,
|
||||
EFI_NTOHL (RouteEntry->SubnetAddress),
|
||||
EFI_NTOHL (RouteEntry->SubnetMask),
|
||||
EFI_NTOHL (RouteEntry->GatewayAddress)
|
||||
);
|
||||
SubnetAddress = EFI_NTOHL (RouteEntry->SubnetAddress);
|
||||
SubnetMask = EFI_NTOHL (RouteEntry->SubnetMask);
|
||||
GatewayAddress = EFI_NTOHL (RouteEntry->GatewayAddress);
|
||||
Ip4AddRoute (IpSb->DefaultRouteTable, SubnetAddress, SubnetMask, GatewayAddress);
|
||||
}
|
||||
|
||||
IpSb->State = IP4_SERVICE_CONFIGED;
|
||||
|
@@ -73,7 +73,7 @@ Ip4PrependHead (
|
||||
PacketHead->Ver = 4;
|
||||
PacketHead->HeadLen = (UINT8) (HeadLen >> 2);
|
||||
PacketHead->Tos = Head->Tos;
|
||||
PacketHead->TotalLen = HTONS (Packet->TotalSize);
|
||||
PacketHead->TotalLen = HTONS ((UINT16) Packet->TotalSize);
|
||||
PacketHead->Id = HTONS (Head->Id);
|
||||
PacketHead->Fragment = HTONS (Head->Fragment);
|
||||
PacketHead->Checksum = 0;
|
||||
|
Reference in New Issue
Block a user