mirror of https://github.com/acidanthera/audk.git
NetworkPkg/DnsDxe: Update RetryCount/RetryInterval to comply with UEFI spec.
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>
This commit is contained in:
parent
1b59de8444
commit
cd2a624071
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
The header files of the driver binding and service binding protocol for DnsDxe driver.
|
The header files of the driver binding and service binding protocol for DnsDxe driver.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -89,8 +89,6 @@ struct _DNS_INSTANCE {
|
||||||
NET_MAP Dns4TxTokens;
|
NET_MAP Dns4TxTokens;
|
||||||
NET_MAP Dns6TxTokens;
|
NET_MAP Dns6TxTokens;
|
||||||
|
|
||||||
UINT32 MaxRetry;
|
|
||||||
|
|
||||||
UDP_IO *UdpIo;
|
UDP_IO *UdpIo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1948,7 +1948,7 @@ DnsOnTimerRetransmit (
|
||||||
// Retransmit the packet if haven't reach the maxmium retry count,
|
// Retransmit the packet if haven't reach the maxmium retry count,
|
||||||
// otherwise exit the transfer.
|
// otherwise exit the transfer.
|
||||||
//
|
//
|
||||||
if (++Dns4TokenEntry->Token->RetryCount < Instance->MaxRetry) {
|
if (++Dns4TokenEntry->RetryCounting <= Dns4TokenEntry->Token->RetryCount) {
|
||||||
DnsRetransmit (Instance, (NET_BUF *)ItemNetMap->Value);
|
DnsRetransmit (Instance, (NET_BUF *)ItemNetMap->Value);
|
||||||
EntryNetMap = EntryNetMap->ForwardLink;
|
EntryNetMap = EntryNetMap->ForwardLink;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1992,7 +1992,7 @@ DnsOnTimerRetransmit (
|
||||||
// Retransmit the packet if haven't reach the maxmium retry count,
|
// Retransmit the packet if haven't reach the maxmium retry count,
|
||||||
// otherwise exit the transfer.
|
// otherwise exit the transfer.
|
||||||
//
|
//
|
||||||
if (++Dns6TokenEntry->Token->RetryCount < Instance->MaxRetry) {
|
if (++Dns6TokenEntry->RetryCounting <= Dns6TokenEntry->Token->RetryCount) {
|
||||||
DnsRetransmit (Instance, (NET_BUF *) ItemNetMap->Value);
|
DnsRetransmit (Instance, (NET_BUF *) ItemNetMap->Value);
|
||||||
EntryNetMap = EntryNetMap->ForwardLink;
|
EntryNetMap = EntryNetMap->ForwardLink;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
DnsDxe support functions implementation.
|
DnsDxe support functions implementation.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -86,7 +86,6 @@ extern EFI_DNS6_PROTOCOL mDns6Protocol;
|
||||||
#define DNS_STATE_DESTROY 2
|
#define DNS_STATE_DESTROY 2
|
||||||
|
|
||||||
#define DNS_DEFAULT_TIMEOUT 2
|
#define DNS_DEFAULT_TIMEOUT 2
|
||||||
#define DNS_DEFAULT_RETRY 3
|
|
||||||
|
|
||||||
#define DNS_TIME_TO_GETMAP 5
|
#define DNS_TIME_TO_GETMAP 5
|
||||||
|
|
||||||
|
@ -115,6 +114,7 @@ typedef struct {
|
||||||
} DNS6_SERVER_IP;
|
} DNS6_SERVER_IP;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
UINT32 RetryCounting;
|
||||||
UINT32 PacketToLive;
|
UINT32 PacketToLive;
|
||||||
CHAR16 *QueryHostName;
|
CHAR16 *QueryHostName;
|
||||||
EFI_IPv4_ADDRESS QueryIpAddress;
|
EFI_IPv4_ADDRESS QueryIpAddress;
|
||||||
|
@ -123,6 +123,7 @@ typedef struct {
|
||||||
} DNS4_TOKEN_ENTRY;
|
} DNS4_TOKEN_ENTRY;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
UINT32 RetryCounting;
|
||||||
UINT32 PacketToLive;
|
UINT32 PacketToLive;
|
||||||
CHAR16 *QueryHostName;
|
CHAR16 *QueryHostName;
|
||||||
EFI_IPv6_ADDRESS QueryIpAddress;
|
EFI_IPv6_ADDRESS QueryIpAddress;
|
||||||
|
|
|
@ -223,8 +223,6 @@ Dns4Configure (
|
||||||
Dns4InstanceCancelToken(Instance, NULL);
|
Dns4InstanceCancelToken(Instance, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance->MaxRetry = 0;
|
|
||||||
|
|
||||||
if (Instance->UdpIo != NULL){
|
if (Instance->UdpIo != NULL){
|
||||||
UdpIoCleanIo (Instance->UdpIo);
|
UdpIoCleanIo (Instance->UdpIo);
|
||||||
}
|
}
|
||||||
|
@ -377,24 +375,30 @@ Dns4HostNameToIp (
|
||||||
|
|
||||||
ConfigData = &(Instance->Dns4CfgData);
|
ConfigData = &(Instance->Dns4CfgData);
|
||||||
|
|
||||||
Instance->MaxRetry = ConfigData->RetryCount;
|
|
||||||
|
|
||||||
Token->Status = EFI_NOT_READY;
|
|
||||||
Token->RetryCount = 0;
|
|
||||||
Token->RetryInterval = ConfigData->RetryInterval;
|
|
||||||
|
|
||||||
if (Instance->State != DNS_STATE_CONFIGED) {
|
if (Instance->State != DNS_STATE_CONFIGED) {
|
||||||
Status = EFI_NOT_STARTED;
|
Status = EFI_NOT_STARTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Token->Status = EFI_NOT_READY;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the MaxRetry and RetryInterval values.
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
//
|
//
|
||||||
if (Instance->MaxRetry == 0) {
|
if (Token->RetryCount == 0) {
|
||||||
Instance->MaxRetry = DNS_DEFAULT_RETRY;
|
Token->RetryCount = ConfigData->RetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
|
//
|
||||||
|
if (Token->RetryInterval == 0) {
|
||||||
|
Token->RetryInterval = ConfigData->RetryInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
|
||||||
|
//
|
||||||
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
||||||
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -621,24 +625,30 @@ Dns4GeneralLookUp (
|
||||||
|
|
||||||
ConfigData = &(Instance->Dns4CfgData);
|
ConfigData = &(Instance->Dns4CfgData);
|
||||||
|
|
||||||
Instance->MaxRetry = ConfigData->RetryCount;
|
|
||||||
|
|
||||||
Token->Status = EFI_NOT_READY;
|
|
||||||
Token->RetryCount = 0;
|
|
||||||
Token->RetryInterval = ConfigData->RetryInterval;
|
|
||||||
|
|
||||||
if (Instance->State != DNS_STATE_CONFIGED) {
|
if (Instance->State != DNS_STATE_CONFIGED) {
|
||||||
Status = EFI_NOT_STARTED;
|
Status = EFI_NOT_STARTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Token->Status = EFI_NOT_READY;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the MaxRetry and RetryInterval values.
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
//
|
//
|
||||||
if (Instance->MaxRetry == 0) {
|
if (Token->RetryCount == 0) {
|
||||||
Instance->MaxRetry = DNS_DEFAULT_RETRY;
|
Token->RetryCount = ConfigData->RetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
|
//
|
||||||
|
if (Token->RetryInterval == 0) {
|
||||||
|
Token->RetryInterval = ConfigData->RetryInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
|
||||||
|
//
|
||||||
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
||||||
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -1052,8 +1062,6 @@ Dns6Configure (
|
||||||
Dns6InstanceCancelToken(Instance, NULL);
|
Dns6InstanceCancelToken(Instance, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance->MaxRetry = 0;
|
|
||||||
|
|
||||||
if (Instance->UdpIo != NULL){
|
if (Instance->UdpIo != NULL){
|
||||||
UdpIoCleanIo (Instance->UdpIo);
|
UdpIoCleanIo (Instance->UdpIo);
|
||||||
}
|
}
|
||||||
|
@ -1204,24 +1212,30 @@ Dns6HostNameToIp (
|
||||||
|
|
||||||
ConfigData = &(Instance->Dns6CfgData);
|
ConfigData = &(Instance->Dns6CfgData);
|
||||||
|
|
||||||
Instance->MaxRetry = ConfigData->RetryCount;
|
|
||||||
|
|
||||||
Token->Status = EFI_NOT_READY;
|
|
||||||
Token->RetryCount = 0;
|
|
||||||
Token->RetryInterval = ConfigData->RetryInterval;
|
|
||||||
|
|
||||||
if (Instance->State != DNS_STATE_CONFIGED) {
|
if (Instance->State != DNS_STATE_CONFIGED) {
|
||||||
Status = EFI_NOT_STARTED;
|
Status = EFI_NOT_STARTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Token->Status = EFI_NOT_READY;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the MaxRetry and RetryInterval values.
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
//
|
//
|
||||||
if (Instance->MaxRetry == 0) {
|
if (Token->RetryCount == 0) {
|
||||||
Instance->MaxRetry = DNS_DEFAULT_RETRY;
|
Token->RetryCount = ConfigData->RetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
|
//
|
||||||
|
if (Token->RetryInterval == 0) {
|
||||||
|
Token->RetryInterval = ConfigData->RetryInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
|
||||||
|
//
|
||||||
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
||||||
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -1452,24 +1466,30 @@ Dns6GeneralLookUp (
|
||||||
|
|
||||||
ConfigData = &(Instance->Dns6CfgData);
|
ConfigData = &(Instance->Dns6CfgData);
|
||||||
|
|
||||||
Instance->MaxRetry = ConfigData->RetryCount;
|
|
||||||
|
|
||||||
Token->Status = EFI_NOT_READY;
|
|
||||||
Token->RetryCount = 0;
|
|
||||||
Token->RetryInterval = ConfigData->RetryInterval;
|
|
||||||
|
|
||||||
if (Instance->State != DNS_STATE_CONFIGED) {
|
if (Instance->State != DNS_STATE_CONFIGED) {
|
||||||
Status = EFI_NOT_STARTED;
|
Status = EFI_NOT_STARTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Token->Status = EFI_NOT_READY;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the MaxRetry and RetryInterval values.
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
//
|
//
|
||||||
if (Instance->MaxRetry == 0) {
|
if (Token->RetryCount == 0) {
|
||||||
Instance->MaxRetry = DNS_DEFAULT_RETRY;
|
Token->RetryCount = ConfigData->RetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If zero, use the parameter configured through Dns.Configure() interface.
|
||||||
|
//
|
||||||
|
if (Token->RetryInterval == 0) {
|
||||||
|
Token->RetryInterval = ConfigData->RetryInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
|
||||||
|
//
|
||||||
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) {
|
||||||
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
Token->RetryInterval = DNS_DEFAULT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue