MdeModulePkg: Update IP4 stack drivers for classless address unicast check.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
@@ -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.
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user