dataConnectionService fails if cellular network doesn't give DNS servers


#1

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

#2

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"

#3

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.


#4

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


#5

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


#6

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


#7

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