- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the method "wiced_hostname_lookup" from wiced_tcpip_common.c, there is a check to see if a DNS lookup is necessary. For this check the method "str_to_ip" from wiced_lib.c is used. The str_to_ip method, however, considers URL's with three dots in them as IP addresses. Hence no DNS lookup is done.
I have attached a very minimal example that reproduces this issue in dns_lookup-fails.c.
Locally I have fixed the issue by patching str_to_ip to include a check if the IP address is nonzero.
I.e. change "if ( num == 4 )" to "if ( num == 4 && (address->ip.v4 != 0) )"
- Labels:
-
SDK 3.x
-
TCPIP
-
Web Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have fixed it in str_to_ip as:
int str_to_ip( const char* arg, wiced_ip_address_t* address )
{
uint32_t* addr = &address->ip.v4;
uint8_t num = 0;
int error = 0;
arg--;
*addr = 0;
do
{
uint32_t tmp_val = 0;
*addr = *addr << 8;
// string_to_unsigned( ++arg, 3, &tmp_val, 0 ); // CML Problem is here
if (string_to_unsigned( ++arg, 3, &tmp_val, 0 ) == 0) // CML change
error = -1; // CML if bad conversion, set error return state
*addr += (uint32_t) tmp_val;
while ( ( *arg != '\x00' ) && ( *arg != '.' ) )
{
arg++;
}
num++;
} while ( ( num < 4 ) && ( *arg != '\x00' ) );
if ( num == 4 )
{
address->version = WICED_IPV4;
return error; //CML was "return 0"
}
return error; // CML was "return -1"
}
I am not sure how to get this in the production code but easy test is to use the "snip.email..." test application and set "account.smpt_server = "smtp.mail.yahoo.com". Most of the constructs were in place, it is just that if the function try to convert random letters it fails, but the failure is not checked in the above routine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This might be exactly what I ran into. When the originally problem happens, I saw IP returns 0.0.0.0 without any error code. Is this what you see?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe that is what I saw. I hope this is fixed in the latest code. 3.5.2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The sdk-3.5.2 includes the fix already (with slightly different code).
I just tested on sdk-3.5.2 and the DNS lookup for both smtp.mail.yahoo.com
and www.dailymail.co.uk looks good.