For the series of patches Reviewed-by: Hegde Nagaraj P <nagaraj-p.he...@hpe.com>
-----Original Message----- From: Jiaxin Wu [mailto:jiaxin...@intel.com] Sent: Thursday, January 21, 2016 11:24 PM To: edk2-devel@lists.01.org Cc: Hegde, Nagaraj P; Ye Ting; Fu Siyuan Subject: [Patch 2/2] NetworkPkg: Replace the internal function with exposed one This patch is used to replace the internal function with the exposed one defined in NetLib.h. Cc: Hegde Nagaraj P <nagaraj-p.he...@hpe.com> Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> --- NetworkPkg/DnsDxe/DnsImpl.c | 63 ++++------------------------------------- NetworkPkg/DnsDxe/DnsImpl.h | 19 ------------- NetworkPkg/DnsDxe/DnsProtocol.c | 6 ++-- 3 files changed, 9 insertions(+), 79 deletions(-) diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c index 71dacce..77e6496 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.c +++ b/NetworkPkg/DnsDxe/DnsImpl.c @@ -1012,65 +1012,10 @@ AddDns6ServerIp ( return EFI_SUCCESS; } /** - Fill QName for IP querying. QName is a domain name represented as - a sequence of labels, where each label consists of a length octet - followed by that number of octets. The domain name terminates with - the zero length octet for the null label of the root. Caller should - take responsibility to the buffer in QName. - - @param HostName Queried HostName - - @retval NULL Failed to fill QName. - @return QName filled successfully. - -**/ -CHAR8 * -EFIAPI -DnsFillinQNameForQueryIp ( - IN CHAR16 *HostName - ) -{ - CHAR8 *QueryName; - CHAR8 *Header; - CHAR8 *Tail; - UINTN Len; - UINTN Index; - - QueryName = NULL; - Header = NULL; - Tail = NULL; - - QueryName = AllocateZeroPool (DNS_DEFAULT_BLKSIZE); - if (QueryName == NULL) { - return NULL; - } - - Header = QueryName; - Tail = Header + 1; - Len = 0; - for (Index = 0; HostName[Index] != 0; Index++) { - *Tail = (CHAR8) HostName[Index]; - if (*Tail == '.') { - *Header = (CHAR8) Len; - Header = Tail; - Tail ++; - Len = 0; - } else { - Tail++; - Len++; - } - } - *Header = (CHAR8) Len; - *Tail = 0; - - return QueryName; -} - -/** Find out whether the response is valid or invalid. @param TokensMap All DNS transmittal Tokens entry. @param Identification Identification for queried packet. @param Type Type for queried packet. @@ -1780,12 +1725,16 @@ ConstructDNSQuery ( ) { NET_FRAGMENT Frag; DNS_HEADER *DnsHeader; DNS_QUERY_SECTION *DnsQuery; - - Frag.Bulk = AllocatePool (DNS_DEFAULT_BLKSIZE * sizeof (UINT8)); + + // + // Messages carried by UDP are restricted to 512 bytes (not counting + the IP // or UDP headers). + // + Frag.Bulk = AllocatePool (DNS_MAX_BLKSIZE * sizeof (UINT8)); if (Frag.Bulk == NULL) { return EFI_OUT_OF_RESOURCES; } // diff --git a/NetworkPkg/DnsDxe/DnsImpl.h b/NetworkPkg/DnsDxe/DnsImpl.h index 72b85cb..e286064 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.h +++ b/NetworkPkg/DnsDxe/DnsImpl.h @@ -85,11 +85,10 @@ extern EFI_DNS6_PROTOCOL mDns6Protocol; #define DNS_STATE_CONFIGED 1 #define DNS_STATE_DESTROY 2 #define DNS_DEFAULT_TIMEOUT 2 #define DNS_DEFAULT_RETRY 3 -#define DNS_DEFAULT_BLKSIZE 512 #define DNS_TIME_TO_GETMAP 5 #pragma pack(1) @@ -555,28 +554,10 @@ AddDns6ServerIp ( IN LIST_ENTRY *Dns6ServerList, IN EFI_IPv6_ADDRESS ServerIp ); /** - Fill QName for IP querying. QName is a domain name represented as - a sequence of labels, where each label consists of a length octet - followed by that number of octets. The domain name terminates with - the zero length octet for the null label of the root. - - @param HostName Queried HostName - - @retval NULL Failed to fill QName. - @return QName filled successfully. - -**/ -CHAR8 * -EFIAPI -DnsFillinQNameForQueryIp ( - IN CHAR16 *HostName - ); - -/** Find out whether the response is valid or invalid. @param TokensMap All DNS transmittal Tokens entry. @param Identification Identification for queried packet. @param Type Type for queried packet. diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c index a3f3de9..3093535 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -1,9 +1,9 @@ /** @file Implementation of EFI_DNS4_PROTOCOL and EFI_DNS6_PROTOCOL interfaces. -Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2015 - 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 http://opensource.org/licenses/bsd-license.php @@ -442,11 +442,11 @@ Dns4HostNameToIp ( TokenEntry->Token = Token; // // Construct QName. // - QueryName = DnsFillinQNameForQueryIp (TokenEntry->QueryHostName); + QueryName = NetLibCreateDnsQName (TokenEntry->QueryHostName); if (QueryName == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; } @@ -1215,11 +1215,11 @@ Dns6HostNameToIp ( // // Construct QName. // - QueryName = DnsFillinQNameForQueryIp (TokenEntry->QueryHostName); + QueryName = NetLibCreateDnsQName (TokenEntry->QueryHostName); if (QueryName == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; } -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel