Connection Manager


#1

Hello you all,

I have a project that runs on an FX30 Gateway, basically I have some python scripts that connects do a server and send some data. Now I am facing a problem, that I must allow the Internet connection interface according to a user preference in a file.

The way I am doing now is to use a python script that calls ‘cm’ commands to configure cellular network and ‘ifup’ and ‘ifdown’ to disable and enable ethernet.

When I run it on terminal it works just fine, but when I put it on legato framework it times work and times not.

I would like some opinion, if it is the best way for me to do this or there is a better way.

Thanks in advance!

Gustavo

Gustavo


#2

Doing some tests today, I realized that the problem maybe is related to DNS on legato, for example if I call a ping script outside legato directly on terminal it works, when I run it on legato application, it gives me ‘bad address’.

I put the resolv.conf in the file dependencies, but it didn’t solve the problem.

Have anyone faced something like this?

Thank you!

Gustavo


#3

Hi Gustavo,

Please try modify your app .adef file:

Option 1 run as non-sandbox, in that case it should run just like you start it from terminal.

sandboxed: false

Option 2 keep run as sandbox but add required networking feature

requires:
{
    file:
    {
        // needed for networking:
        /lib/libnss_compat.so.2 /lib/
        /lib/libnss_files.so.2 /lib/
        /lib/libnss_dns.so.2 /lib/
        /lib/libresolv.so.2 /lib/
        /etc/nsswitch.conf /etc/
        /etc/hosts /etc/
        /etc/resolv.conf /etc/
    }
}

Please refer to below for more info:
https://docs.legato.io/latest/defFilesAdef.html#defFilesAdef_sandboxed
https://github.com/legatoproject/legato-af/blob/master/apps/sample/httpGet/httpGet.adef

Hope it helps.
Thx


#4

Hi lotam,

Thanks for your suggestion, I tried both suggestion and both presented the same problem. I realized that when I am connected through the cellular network, when my script pings it returns it: "“ping: bad address ‘google.com’”, but when I am connected through the Ethernet network it works.

Have you any idea why this happens?

Thank you so much!

Gustavo