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.
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.
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.
An additional thing that I did this weekend was to set the pdp just to IPV4, and now I am able to use “curl” to get a web page running the application.
Another thing that have a different behavior when used on console and in the application, is that when I connect to internet over cellular, I must disable the eth0 interface, when my script calls “ifdown eth0” on console, it works just fine, but in the legato application it does not. Any idea about it?