Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cellular resolve does not return 0 / false when it receives bad DNS resolution related to bad cell service #1304

Closed
hwestbrook opened this issue Apr 21, 2017 · 1 comment

Comments

@hwestbrook
Copy link

commented Apr 21, 2017

Bug Report

Expected Behavior

Based on the documentation, I would expect IP address to be 0.0.0.0 and an if statement pertaining to the IP address to resolve to false in the scenario that the modem cannot resolve the hostname's ip address.

Observed Behavior

I am running cellular resolve in my code and when my device has bad connectivity, the IP address resolves to the wrong address without throwing an error. The below snippet recreates the issue.

For google.com the expected result is: 172.217.23.46. I've received:

  • 0.0.174.11
  • 0.0.0.8

A tangential and possibly related issue is that when the device is trying to resolve hostname and does not have cell signal it attempts to reset the WLAN and acquire a cell signal again, meanwhile blocking the loop. Is this expected behavior? How might I exit from this block if I need to run critical application code? It blocks for quite a while...

Steps to Reproduce

Run the below test app and then detach the cellular antenna to your device.

Test App

#include "application.h"

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);
SerialLogHandler logHandler(LOG_LEVEL_INFO);

void setup() {
	Serial.begin(9600);
	while(!Serial.available()) {}
	Serial.read();
	Cellular.on();
	Cellular.connect();
	waitFor(Cellular.ready, 120000);
}

void loop() {
	CellularSignal sig = Cellular.RSSI();
	IPAddress ip = Cellular.resolve("google.com");
	Serial.printlnf("Google IP Address: %s. This is a %s bool. Cell reception is %i / %i.", ip.toString().c_str(), ip ? "true" : "false", sig.rssi, sig.qual);
	delay(3000);
}

References

Here is some logging:

0000004523 [system] INFO: ready(): 0; connecting(): 0; listening(): 0; WLAN_SMART_CONFIG_START: 0
0000004523 [system] INFO: Sim Ready
0000004523 [system] INFO: ARM_WLAN_WD 1
0000004995 [system] INFO: ARM_WLAN_WD 2
0000004995 [system] INFO: CLR_WLAN_WD 1, DHCP success
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -111 / 19.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -111 / 19.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -111 / 19.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -111 / 19.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 7.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
0000041515 [system] INFO: ARM_WLAN_WD 3
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 0.
0000043595 [system] WARN: Resetting WLAN due to WLAN_WD_TO()
0000043615 [system] INFO: DHCP fail, ARM_WLAN_WD 5
0000143565 [system] INFO: Network Connect: !SPARK_WLAN_STARTED
0000143565 [system] INFO: ready(): 0; connecting(): 0; listening(): 0; WLAN_SMART_CONFIG_START: 0
Google IP Address: 0.0.0.8. This is a true bool. Cell reception is 0 / 0.
0000176606 [system] INFO: Sim Ready
0000176606 [system] INFO: ARM_WLAN_WD 1
Google IP Address: 0.0.0.3. This is a true bool. Cell reception is 0 / 0.
0000486646 [system] WARN: Resetting WLAN due to WLAN_WD_TO()
0000490856 [system] INFO: Network Connect: !SPARK_WLAN_STARTED
0000490856 [system] INFO: ready(): 0; connecting(): 0; listening(): 0; WLAN_SMART_CONFIG_START: 0
Google IP Address: 0.0.174.11. This is a true bool. Cell reception is 0 / 0.
0000523897 [system] INFO: Sim Ready
0000523897 [system] INFO: ARM_WLAN_WD 1
0000683017 [system] INFO: ARM_WLAN_WD 2
0000683017 [system] INFO: CLR_WLAN_WD 1, DHCP success
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is 0 / 0.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 13.
Google IP Address: 172.217.23.46. This is a true bool. Cell reception is -113 / 13.
@hwestbrook

This comment has been minimized.

Copy link
Author

commented Apr 26, 2019

Looks like this now returns false when DNS fails. I think this resolves the issue

@hwestbrook hwestbrook closed this Apr 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.