Trying to execute a system "route add" command fails


#1

I’m making a connection using the MDC test code. Also, this same method is used under the "Default data connection/Data connection routing section in the Legato API guides.

I can make the connection fine. However, when I try to add a route via the “system” call, it fails. I can run the same exact command in the command window, so it appears to be a permission issue, which would make sense, since this is a privileged command.

My question is, how does this test work? Because looking at the code and the test, I can’t see it working without elevated privileges. So, how does it pass? When it fails the route update, the ASSERT kills the app.

Thanks


#2

Yes, even on Linux PC we need “sudo” (or root permission) before we can alter the route table.

Would you try add “sandboxed: false” in your app .adef file so the app can get root privileges to run “route add” command?

Or you can use le_data_Request() which take care the route table setting:
http://legato.io/legato-docs/latest/c_le_data.html

Thx


#3

I get that you normally have to do a “sudo” type command… But that’s exactly my point. In the .adef, of that test, there is nothing about privilege in the build process. How does that test pass?

Thanks for the suggestions, I don’t want to have to run my app non-sandboxed if I can help it. I will take a look at the le_data_Request() and see if that will work.