diff options
author | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-03-11 07:44:10 +0000 |
---|---|---|
committer | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-03-11 07:44:10 +0000 |
commit | 44a97ac647a6c996ec1479f518fe0ea0c7a1ce7f (patch) | |
tree | 3fa56cae9528ed426cba5b9c7fe9e7417ca5ce9f /MdeModulePkg | |
parent | a9b4ff8d01b36be72eae901e21de96e84493df5c (diff) | |
download | edk2-44a97ac647a6c996ec1479f518fe0ea0c7a1ce7f.tar.gz edk2-44a97ac647a6c996ec1479f518fe0ea0c7a1ce7f.tar.bz2 edk2-44a97ac647a6c996ec1479f518fe0ea0c7a1ce7f.zip |
Fix a bug in IP4 driver that the broadcast/multicast mac address is overrided by the gateway’s mac address.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14167 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c index 7ff17b6637..370eaa6a9f 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c @@ -1,7 +1,7 @@ /** @file
Transmit the IP4 packet.
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -286,46 +286,40 @@ Ip4Output ( if (EFI_ERROR(Status)) {
return Status;
}
+
+ Dest = Head->Dst;
+ if (IP4_IS_BROADCAST (Ip4GetNetCast (Dest, IpIf)) || (Dest == IP4_ALLONE_ADDRESS)) {
+ //
+ // Set the gateway to local broadcast if the Dest is
+ // the broadcast address for the connected network or
+ // it is local broadcast.
+ //
+ GateWay = IP4_ALLONE_ADDRESS;
- //
- // Route the packet unless overrided, that is, GateWay isn't zero.
- //
- if (GateWay == IP4_ALLZERO_ADDRESS) {
- Dest = Head->Dst;
-
- if (IP4_IS_BROADCAST (Ip4GetNetCast (Dest, IpIf)) || (Dest == IP4_ALLONE_ADDRESS)) {
- //
- // Set the gateway to local broadcast if the Dest is
- // the broadcast address for the connected network or
- // it is local broadcast.
- //
- GateWay = IP4_ALLONE_ADDRESS;
-
- } else if (IP4_IS_MULTICAST (Dest)) {
- //
- // Set the gateway to the destination if it is an multicast
- // address. The IP4_INTERFACE won't consult ARP to send local
- // broadcast and multicast.
- //
- GateWay = Head->Dst;
+ } else if (IP4_IS_MULTICAST (Dest)) {
+ //
+ // Set the gateway to the destination if it is an multicast
+ // address. The IP4_INTERFACE won't consult ARP to send local
+ // broadcast and multicast.
+ //
+ GateWay = Head->Dst;
+ } else if (GateWay == IP4_ALLZERO_ADDRESS) {
+ //
+ // Route the packet unless overrided, that is, GateWay isn't zero.
+ //
+ if (IpInstance == NULL) {
+ CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);
} else {
- //
- // Consult the route table to route the packet
- //
- if (IpInstance == NULL) {
- CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);
- } else {
- CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src);
- }
-
- if (CacheEntry == NULL) {
- return EFI_NOT_FOUND;
- }
+ CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src);
+ }
- GateWay = CacheEntry->NextHop;
- Ip4FreeRouteCacheEntry (CacheEntry);
+ if (CacheEntry == NULL) {
+ return EFI_NOT_FOUND;
}
+
+ GateWay = CacheEntry->NextHop;
+ Ip4FreeRouteCacheEntry (CacheEntry);
}
//
|