summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/DnsDxe/DnsImpl.c
Commit message (Collapse)AuthorAgeFilesLines
* NetworkPkg/DnsDxe: cosmetic fixupswenyi,xie via groups.io2021-01-051-4/+4
| | | | | | | | | add whitespace according to coding style. Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
* NetworkPkg/DnsDxe: Fix various typosAntoine Coeur2020-02-101-10/+10
| | | | | | | | | | | | | Fix various typos in comments and documentation. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Maciej Rabeda <maciej.rabeda@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-35-philmd@redhat.com>
* NetworkPkg/DnsDxe: Fix a typoPhilippe Mathieu-Daudé2020-02-101-4/+4
| | | | | | | | | | | Fix the same typo in various comments. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Maciej Rabeda <maciej.rabeda@intel.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-34-philmd@redhat.com>
* NetworkPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-091-7/+1
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg/DnsDxe: [CVE-2018-12178] Check the received packet size before ↵Jiaxin Wu2019-02-281-10/+67
| | | | | | | | | | | | | | | | | | | | | | parsing the message. Fix CVE-2018-12178 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=809 The DNS driver only checks the received packet size against the minimum DNS header size in DnsOnPacketReceived(), later it accesses the QueryName and QuerySection beyond the header scope, which might cause the pointer within DNS driver points to an invalid entry or modifies the memory content beyond the header scope. This patch is to fix above problem. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wang Fan <fan.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg: Clean up source filesLiming Gao2018-06-281-176/+176
| | | | | | | | | 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
* NetworkPkg/DnsDxe: Fix the potential memory leak issue.Jiaxin Wu2017-12-121-10/+121
| | | | | | | | | Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wang Fan <fan.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg/DnsDxe: Update RetryCount/RetryInterval to comply with UEFI spec.Jiaxin Wu2017-12-121-2/+2
| | | | | | | | | | | | | | | | | | | According to UEFI spec: "Retry number if no response received after RetryInterval. If zero, use the parameter configured through Dns.Configure() interface." "Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second. If zero, use the parameter configured through Dns.Configure() interface." For both DNS.HostNameToIp and DNS.GeneralLookUp, the value of RetryCount / RetryInterval need to be updated to comply with UEFI spec. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wang Fan <fan.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6Jiaxin Wu2017-03-301-3/+5
| | | | | | | | | | | | | | | | According UEFI Spec, set to zero StationIp means to let the underlying IPv6 driver choose a source address. But currently, DNSv6 always return EFI_NO_MAPPING. The issue is caused by below bugs in DnsDxe: * Incorrect TPL(TPL_CALLBACK) usage during UDP configuration. * Failed to create the timer used to get IPv6 mapping * Doesn't check the Ip6Mode.IsStarted flag. Cc: Zhang Lubo <lubo.zhang@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg/DnsDxe: Fixed the assert issue in DnsDxeJiaxin Wu2016-12-261-4/+17
| | | | | | | | | | | | | Fix the DnsDxe assert issue when the incorrect answer message received. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg: Fix the wrong Timer event checkJiaxin Wu2016-10-311-2/+2
| | | | | | | | | | Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Correct the DNS token return status by RCODEJiaxin Wu2016-09-201-64/+40
| | | | | | | | | | | | | | | | | | | | When HostNameToIp() and GeneralLookUp() are called with a invalid host name, RCODE (4 bit field is set as part of responses) error will returned in packet to identify the domain name referenced in the query does not exist. So, EFI_NOT_FOUND should be returned directly. Current implementation only check the RCODE in successful condition. Need update the code for more error check according to RFC 1035 4.1.1 section. Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
* NetworkPkg/DnsDxe: Handle CNAME type responded from the name serverJiaxin Wu2016-09-071-29/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: * Code refine. * For DnsCache, the minimum value of TTL is selected between CNAME and A/AAAA record. According RFC 1034 - 3.6.2, if the query name is an alias, the name server will include the CNAME record in the response and restart the query at the domain name specified in the data field of the CNAME record. RFC also provides one example server action when A query received: Suppose a name server was processing a query with for USCISIC.ARPA, asking for type A information, and had the following resource records: USC-ISIC.ARPA IN CNAME C.ISI.EDU C.ISI.EDU IN A 10.0.0.52 Both of these RRs would be returned in the response to the type A query. Currently, DnsDxe driver doesn't handle the CNAME type response, which will cause any exception result. The driver need continue the packet parsing while CNAME type record parsed. So, this patch is used to handle it correctly. Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
* NetworkPkg: Fix DNS GeneralLookUp failure in some caseJiaxin Wu2016-06-131-8/+21
| | | | | | | | | | | | | | | QClass value may be not equal to 1(DNS_CLASS_INET) when GeneralLookUp query is called. So, remove QClass value check. Moreover, the 'Identification' and 'Type' filed in Query packet should not be changed to little endian since the packet maybe retransmitted while there is any error happened. Cc: Ye Ting <ting.ye@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg: Check received packet size before use it.Fu Siyuan2016-04-011-7/+11
| | | | | | | | | | | | | | | | | Arbitrary length of packet may be received from network, including the packets with zero payload data or malformed protocol header. So the code much check the actually received data size before using it. For example, in current edk2 network stack, an zero payload UDP packet may cause the platform ASSERT in NetbufFromExt() because of the zero fragment number. This patch update the IpIoLib and UdpIoLib to check and discard the zero payload data packet to avoid above assert. Some other network drivers are also updated to check the packet size to guarantee the minimum length of protocol header is received from upper layer driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Replace the internal function with exposed oneJiaxin Wu2016-02-181-57/+6
| | | | | | | | | | | | | | This patch is used to replace the internal function with the exposed one defined in NetLib.h. Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg:Fix Network memory leak when calling GetModeData interfaceZhang Lubo2016-01-281-5/+29
| | | | | | | | | | | | | Multiple network protocols have a GetModeData() interface, which may allocate memory resource in the return mode data structure. It's callers responsibility to free these buffers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19758 6f19259b-4bc3-4df7-8a09-765794883524
* NetworkPkg: DnsDxe: fix return type of DnsFillinQNameForQueryIp()Laszlo Ersek2016-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the return type of DnsFillinQNameForQueryIp() from (UINT8*) to (CHAR*). This brings the function in sync with both its internal variables and all of its call sites, fixing the following gcc build breakage: > NetworkPkg/DnsDxe/DnsImpl.c: In function 'DnsFillinQNameForQueryIp': > NetworkPkg/DnsDxe/DnsImpl.c:1068:3: error: pointer targets in return > differ in signedness > [-Werror=pointer-sign] > return QueryName; > ^ The code was added in git commit fcae1a99 (SVN r19579). Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19609 6f19259b-4bc3-4df7-8a09-765794883524
* NetworkPkg: Removing or adding some ASSERT statementJiaxin Wu2016-01-061-4/+0
| | | | | | | | | | | | | | Refine the code by removing or adding some ASSERT statement to make the code more readable. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19592 6f19259b-4bc3-4df7-8a09-765794883524
* NetworkPkg: Support DNS4/6 GeneralLookUp featureJiaxin Wu2015-12-301-70/+251
| | | | | | | | | | | | | | This patch is used to support DNS4/6 GeneralLookUp feature. Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19579 6f19259b-4bc3-4df7-8a09-765794883524
* NetworkPkg: Fix the potential NULL pointer dereferenced issueJiaxin Wu2015-12-101-18/+41
| | | | | | | | | | | | | | This patch is used to fix the potential NULL pointer dereferenced in function 'ParseDnsResponse'. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19178 6f19259b-4bc3-4df7-8a09-765794883524
* NetworkPkg: Fix an error that the call function declared implicitly.Zhang Lubo2015-07-141-8/+8
| | | | | | | | | | | | | | Use NetRandomInitSeed() instead of AsmReadTsc() to generate a random seed. Macro definition of EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE for EBC architecture. Add some space to make codes more standard. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: jiaxinwu <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17941 6f19259b-4bc3-4df7-8a09-765794883524
* NetworkPkg: Code logic optimization for DnsDxe and HttpDxe driverfanwang22015-07-101-1/+3
| | | | | | | | | | | | | | | Revise some errors which may lead NULL pointer be dereferenced: * DnsDhcp.c: Paralist may be used without any initialized * DnsHeader and RcvString may be null but be dereferenced * HttpDriver.c: revise an if judgment * HttpImpl.c: add a judgment to avoid null dereferenced Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: fanwang2 <fan.wang@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17923 6f19259b-4bc3-4df7-8a09-765794883524
* NetworkPkg: Add DNS feature support over IPv4 and IPv6.jiaxinwu2015-07-071-0/+1875
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: jiaxinwu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17854 6f19259b-4bc3-4df7-8a09-765794883524