You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/09/16 10:09:35 UTC

[nuttx-apps] branch master updated: lte/alt1250: Fix bug that name resolution failed for a long time

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new a9a8fbbc4 lte/alt1250: Fix bug that name resolution failed for a long time
a9a8fbbc4 is described below

commit a9a8fbbc4ab81d8cd8516ea7496a494d7c46ddb3
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Thu Sep 14 10:16:49 2023 +0900

    lte/alt1250: Fix bug that name resolution failed for a long time
    
    Fix bug that name resolution failed for a long time under particular cases.
    If a DNS query for IPv6 succeeds and IPv4 fails, only the answer of the
    IPv6 query is saved in the cache. If only IPv4 is given from LTE,
    name resolution will fail while the answer is saved in the cache.
    Therefore, the ALT1250 daemon sets the given IP type to the DNS client,
    which can only send DNS queries for that IP type.
---
 lte/alt1250/callback_handlers/alt1250_evt.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lte/alt1250/callback_handlers/alt1250_evt.c b/lte/alt1250/callback_handlers/alt1250_evt.c
index 19cf674b1..a2ab7782a 100644
--- a/lte/alt1250/callback_handlers/alt1250_evt.c
+++ b/lte/alt1250/callback_handlers/alt1250_evt.c
@@ -1238,6 +1238,31 @@ static uint64_t lte_set_report_netinfo_exec_cb(FAR void *cb,
         sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
       dns_add_nameserver((FAR const struct sockaddr *)&dnsaddr[i], addrlen);
     }
+
+  if (info->pdn_num > 0)
+    {
+      FAR lte_pdn_t *pdn = &info->pdn_stat[0];
+      FAR lte_ipaddr_t *ipaddr = &pdn->address[0];
+
+      /* ALT1250 can only connect one PDN, so check the first PDN. */
+
+      if ((pdn->ipaddr_num == 1) && (ipaddr->ip_type == LTE_IPTYPE_V4))
+        {
+          dns_set_queryfamily(AF_INET);
+        }
+      else if ((pdn->ipaddr_num == 1) && (ipaddr->ip_type == LTE_IPTYPE_V6))
+        {
+          dns_set_queryfamily(AF_INET6);
+        }
+      else
+        {
+          dns_set_queryfamily(AF_UNSPEC);
+        }
+    }
+  else
+    {
+      dns_set_queryfamily(AF_UNSPEC);
+    }
 #endif
 
   if (callback)