-
-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy path0094-Handle-missing-IP-address-resolution.patch
41 lines (37 loc) · 1.77 KB
/
0094-Handle-missing-IP-address-resolution.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 2bd81ee3674c87420c5c571b77cf75cff629f540 Mon Sep 17 00:00:00 2001
From: giulcioffi <g.cioffi@arduino.cc>
Date: Wed, 14 Jul 2021 10:25:40 +0200
Subject: [PATCH 094/157] Handle missing IP address resolution
---
.../GEMALTO_CINTERION_CellularStack.cpp | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
index 13c1a0b2fa..9eb3e27b39 100644
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
@@ -172,11 +172,19 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::gethostbyname(const char *host, S
_at.cmd_start_stop("^SISX" , "=" , "%s%d%s", "HostByName" , _cid, host);
_at.resp_start("^SISX: \"HostByName\",");
char ipAddress[NSAPI_IP_SIZE];
- _at.read_string(ipAddress, sizeof(ipAddress));
- _at.restore_at_timeout();
- if (!address->set_ip_address(ipAddress)) {
- _at.unlock();
- return NSAPI_ERROR_DNS_FAILURE;
+ int size = _at.read_string(ipAddress, sizeof(ipAddress));
+ if (size) {
+ //Valid string received
+ tr_info("Read %d bytes. Valid string: %s\n", size, ipAddress);
+ _at.restore_at_timeout();
+ if (!address->set_ip_address(ipAddress)) {
+ _at.unlock();
+ return NSAPI_ERROR_DNS_FAILURE;
+ }
+ } else {
+ //Null string received
+ tr_info("Read %d bytes. Null string\n", size);
+ return NSAPI_ERROR_NO_ADDRESS;
}
}
--
2.36.0