summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Ip4Dxe
diff options
context:
space:
mode:
authorxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-30 13:44:11 +0000
committerxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-30 13:44:11 +0000
commit1204fe8319e5e6f77df68c375ef403e9ffa9227e (patch)
tree0946ddf42875ba3243758f77097c06587727a6e1 /MdeModulePkg/Universal/Network/Ip4Dxe
parent9ae650ef6ca9372199adb31fb3432ed8cde353ad (diff)
downloadedk2-1204fe8319e5e6f77df68c375ef403e9ffa9227e.zip
edk2-1204fe8319e5e6f77df68c375ef403e9ffa9227e.tar.gz
edk2-1204fe8319e5e6f77df68c375ef403e9ffa9227e.tar.bz2
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
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c10
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c26
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c2
3 files changed, 19 insertions, 19 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c
index 76208e0..05609db 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c
@@ -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
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 0b570e2..05fd96d 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -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;
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
index a8a6261..dcbead5 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
@@ -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;