diff options
Diffstat (limited to 'MdeModulePkg/Universal/Network/Udp4Dxe')
-rw-r--r-- | MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 9 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c index 20dbefff4e..df41433a1a 100644 --- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c +++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c @@ -827,7 +827,9 @@ Udp4ValidateTxToken ( if (TxData->GatewayAddress != NULL) {
CopyMem (&GatewayAddress, TxData->GatewayAddress, sizeof (IP4_ADDR));
- if (!NetIp4IsUnicast (NTOHL (GatewayAddress), 0)) {
+ if (!Instance->ConfigData.UseDefaultAddress &&
+ (EFI_NTOHL(Instance->ConfigData.SubnetMask) != 0) &&
+ !NetIp4IsUnicast (NTOHL (GatewayAddress), EFI_NTOHL(Instance->ConfigData.SubnetMask))) {
//
// The specified GatewayAddress is not a unicast IPv4 address while it's not 0.
//
@@ -842,7 +844,10 @@ Udp4ValidateTxToken ( CopyMem (&SourceAddress, &UdpSessionData->SourceAddress, sizeof (IP4_ADDR));
- if ((SourceAddress != 0) && !NetIp4IsUnicast (HTONL (SourceAddress), 0)) {
+ if ((SourceAddress != 0) &&
+ !Instance->ConfigData.UseDefaultAddress &&
+ (EFI_NTOHL(Instance->ConfigData.SubnetMask) != 0) &&
+ !NetIp4IsUnicast (HTONL (SourceAddress), EFI_NTOHL(Instance->ConfigData.SubnetMask))) {
//
// Check whether SourceAddress is a valid IPv4 address in case it's not zero.
// The configured station address is used if SourceAddress is zero.
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c index 5ea22acb14..bdb79b3abd 100644 --- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c +++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c @@ -1,7 +1,7 @@ /** @file
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, 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
@@ -171,9 +171,9 @@ Udp4Configure ( if (!UdpConfigData->UseDefaultAddress &&
- (!IP4_IS_VALID_NETMASK (SubnetMask) ||
- !((StationAddress == 0) || NetIp4IsUnicast (StationAddress, SubnetMask)) ||
- !((RemoteAddress == 0) || NetIp4IsUnicast (RemoteAddress, 0)))) {
+ (!IP4_IS_VALID_NETMASK (SubnetMask) ||
+ !((StationAddress == 0) || NetIp4IsUnicast (StationAddress, SubnetMask)) ||
+ IP4_IS_LOCAL_BROADCAST (RemoteAddress))) {
//
// Don't use default address, and subnet mask is invalid or StationAddress is not
// a valid unicast IPv4 address or RemoteAddress is not a valid unicast IPv4 address
|