As you said that netlink was not implemented in Gramine, I decided to find an alternative to manage TUN/TAP devices, so I found tunectl which uses ioctl. I changed the manifest file to this to access /dev/net/tun device file:
...
fs.mounts = [
{ type = "tmpfs", path = "/tmp" },
{ type = "chroot", path = "/dev/net", uri="file:/dev/net" },
]
sgx.allowed_files = [
"file: /logs/",
"file: /dev/net/",
]
...
but, I get this error
TUNSETIFF: Function not implemented
...
[P1:T1:tunctl] trace: ---- shim_openat(AT_FDCWD, "/dev/net/tun", O_RDWR, 0000) = 0x3
[P1:T1:tunctl] trace: ---- shim_ioctl(3, OP 0x400454ca, 0x112f75c60) ...
[P1:T1:tunctl] trace: ---- return from shim_ioctl(...) = -38
[P1:T1:tunctl] trace: ---- shim_dup(2) = 0x4
[P1:T1:tunctl] trace: ---- shim_fcntl(4, F_GETFL, 0x1132c6720) = 0x401
[P1:T1:tunctl] trace: ---- shim_close(4) = 0x0
[P1:T1:tunctl] trace: ---- shim_write(2, 0x112f730f0, 0x24) ...
[P1:T1:tunctl] trace: ---- return from shim_write(...) = 0x24
[P1:T1:tunctl] debug: ---- shim_exit_group (returning 1)
[P1:T1:tunctl] debug: clearing POSIX locks for pid 1
[P1:T1:tunctl] debug: sync client shutdown: closing handles
[P1:T1:tunctl] debug: sync client shutdown: waiting for confirmation
[P1:T1:tunctl] debug: sync client shutdown: finished
[P1:shim] debug: IPC worker: exiting worker thread
[P1:T1:tunctl] debug: process 1 exited with status 1
debug: DkProcessExit: Returning exit code 1
So, does it mean that this ioctl isn't supported in Gramine? If so, how can I deal with TUN/TAP devices in Gramine?
Raouf