linuxkit icon indicating copy to clipboard operation
linuxkit copied to clipboard

Enable network CAN flag (SocketCAN)

Open duraki opened this issue 5 years ago • 8 comments

As pointed by docker/for-mac#2580, linuxkit should enable CAN flag in kernel configuration to allow Docker containers to setup virtual CAN device. The namespace was presented by O. Hartkopp in Linux Kernel 4.12; update docs available on SocketCAN April 2018.

This issue affects both Linux & MacOS.

With [email protected] update, we can now bridge cap for virtual CAN interface in Docker, instead of relying on hardware devices and tunnelling.

https://github.com/linuxkit/linuxkit/blob/262e6ed3ec9d1d6327df58eda02c8f20f3571b93/kernel/config-4.18.x-x86_64#L1451

This wouldn't be such a hassle, if D4M (Docker 4 Mac) wasn't private. We can't recompile docker-for-mac.iso properly as seen in linked issue. This needs to be set on linuxkit/linuxkit side.

duraki avatar Aug 30 '18 19:08 duraki

~reserved

duraki avatar Aug 31 '18 12:08 duraki

Can't you compile the require kernel modules externally and modprobe them? All the config options in net/can seem to be tristate suggesting this should be possible

rn avatar Dec 22 '18 13:12 rn

No. Tested under RedHat Linux and MacOS. Check this comment on why it's not possible. We need explicit allowance from linuxkit side.

duraki avatar Dec 24 '18 22:12 duraki

@duraki how did you test this? The comment does not say why what i proposed is not possible.

What I suggested was to compile the CAN kernel modules against the headers of the linuxkit kernel used in Docker for Mac and then load the kernel modules from a privileged container. There is some documentation on how to compile external modules in docs/kernels.md and example code in test/cases/020_kernel/01*_kmod/.

Unlike the WIFI config (see https://github.com/linuxkit/linuxkit/issues/3092) the CAN kernel config seems to be all kernel modules so this should work. You could even package the compiled kernel modules in a docker image....

rn avatar Dec 28 '18 12:12 rn

Can this be closed?

brandonros avatar Oct 29 '19 21:10 brandonros

@brandonros not yet, give me some more time so I can coop with @hartkopp and make a final decision. Thank you. @rn: will provide additional information.

duraki avatar Nov 03 '19 17:11 duraki

@duraki Were you able to get this to work with D4M ?

thomasantony avatar Jan 28 '20 15:01 thomasantony

Are there any news on support for SocketCan in D4M?

PhilippKirchnerOSMA avatar May 18 '22 13:05 PhilippKirchnerOSMA