canonical / openthread-border-router-snap

BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Use internal snap path for wpan socket base path #8

Closed farshidtz closed 1 year ago

farshidtz commented 1 year ago

The default path for the socket and lock files are at /run/openthread-wpan0.*. The snap has no access to these files, so an interface is defined to grant this access on demand: https://github.com/canonical/openthread-border-router-snap/blob/db2c1fb4ae615e1c01a3f7045d25dbb001c1ccef/snap/snapcraft.yaml#L34-L38

However, when the wpan interface name is different, a more open interface needs to be used, giving access to the whole /run directory on the host: https://github.com/canonical/openthread-border-router-snap/blob/db2c1fb4ae615e1c01a3f7045d25dbb001c1ccef/snap/snapcraft.yaml#L39-L42

A better workaround is to change the base path. This can be done at compile time, as suggested by @prash813:

-DOT_CFLAGS=-DOPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME=\"/tmp/openthread-%s\""