dataConnectionService fails if cellular network doesn't give DNS servers

My cellular network provider doesn’t give DNS servers, and it looks like the Legato dataConnectionService fails if no DNS servers are provided. On my mangohRed, I edited Legato file dcsServer.c to include the 2 DNS Servers we use and recompiled Legato and it works. I purchased an FX30S and the same thing is happening, so how do I recompile Legato for the FX30S? It looks like the update files are different to the mangoh Red. Can I use Developer Studio?

static le_result_t SetDnsConfiguration
(
    le_mdc_ProfileRef_t profileRef,     ///< [IN] Modem data connection profile reference
    bool addDnsRoutes                   ///< [IN] Add routes for DNS
)
{
    char dns1Addr[LE_MDC_IPV6_ADDR_MAX_BYTES] = {0};
    char dns2Addr[LE_MDC_IPV6_ADDR_MAX_BYTES] = {0};
    if (le_mdc_IsIPv4(profileRef))
    {
        if (LE_OK != le_mdc_GetIPv4DNSAddresses(profileRef,
                                                dns1Addr, sizeof(dns1Addr),
                                                dns2Addr, sizeof(dns2Addr)))
    {
//**Added the following 2 lines**
            strcpy(dns1Addr, "203.50.2.71");
            strcpy(dns2Addr, "139.130.4.4");
//**Commented the following 2 lines**
            //LE_ERROR("IPv4: le_mdc_GetDNSAddresses failed");
            //return LE_FAULT;
        }
        if (LE_OK != AddNameserversToResolvConf(dns1Addr, dns2Addr))
        {
            LE_ERROR("IPv4: Could not write in resolv file");
            return LE_FAULT;
        }
        strcpy(InterfaceDataBackup.newDnsIPv4[0], dns1Addr);
        strcpy(InterfaceDataBackup.newDnsIPv4[1], dns2Addr);
        // Add the DNS routes if necessary
        if (addDnsRoutes)
        {
            if (   (LE_OK != le_data_AddRoute(dns1Addr))
                || (LE_OK != le_data_AddRoute(dns2Addr)))
           {
                LE_ERROR("IPv4: Could not add DNS routes");
            }
        }
    }
   else

Good catch. It’s also nice to see code that identifies the failure case. Thanks. If manual DNS settings are going to be considered, then I think it makes sense for them to be stored in the config tree. I think something like this would cover most reasonable use cases.

dataConnectionService:/dns/<technology>/servers :: string =
    "1.2.3.4 5.6.7.8 9.10.11.12"
dataConnectionService:/dns/<technology>/selectionStrategy :: string =
    "DHCP" | "config" | "prepend config" | "append config"

That sounds like a great idea. Can you point me in the right direction on how to recompile Legato for an FX30S? From what I have been reading, it is different to recompiling Legato for the mangoh.

I can’t help with that, but I bet @cchenry can.

Hi spmaurer,
For the FX30S, you need must use the 16.10.x branch of Legato.

If your FX30S has R13.1.3.001, then use 16.10.1. If by some chance you have the newer R14 already, then use 16.10.3

You can use Developer Studio 5.1 and newer to build 16.10.1 for the FX30 target. Support for 16.10.3 will be released, very soon.

BR,
Chris

Thanks Chris. I have downloaded 16.10.1 and have recompiled. Now I need to upload the Legato to the FX30S. Can I use “instsys system.wp85.update 192.168.2.2”?

Regards,
Sheldon

Hi Sheldon,
Yes, that should work. You could also scp the wp85.update file to the FX30 and use “update”.
BR,
Chris

This sounds very interesting. I’m running into the same problem currently and modified the dcsServer.c code, too to get the connection up and running. Off course, the use of the data connection service’s config tree is more preferable.

Is there any documentation on config tree settings for this and other services ? May be there are more points of interrest ! Looking at your description above: which setting is applicable for the “technology” item (especially the cellular connection) ? Is it “ipv4” or “cellular” or any other ?

Taking a closer look at the DNS service: our application runs in a closed private (10.x.x.x) mobile network without any gateway to the internet. Are there any pitfalls, if there’s absolutely no internet access (i.e. any NTP access will fail) ?

Best regards and thanks for your support, Heino

Forget about my last post. Just found out, that dfrey only suggested a change in the dcsServer.c code, but nothing happened in the last 4 (!) years, which makes the framework unusable for closed private mobile networks without DNS servers - at least, if no manual modifications are applied to the source code.

BR

This issue seems to affect legato 19.11.6 again, whereas it did not affect 19.0.2.

The offending commit could be Convert le_data code and logic to use le_dcs to interface with data c… · legatoproject/legato-af@d3122bd · GitHub

When using an APN that does not hand out DNS, the following legato log appears:

“Releasing data channel upon failure to retry setting DNS configuration; error -6”