[Lxc-users] using CAN sockets inside the container

Iliyan Stoyanov ilf at ilf.me
Thu Apr 26 13:00:12 UTC 2012


Hi,

could you check if your code works on the host machine where you are
creating the LXC container. It looks like you don't have the CAN net
protocol drivers loaded in the host's kernel. Also I am really
interested in what you are doing. Are you trying to do an app sandboxing
for an automotive system, probably on an ARM or MIPS? Could you share
some more info if that is indeed what you are trying to accomplish, I
think there might be some people here really interested in that.

--ilf

On Wed, 2012-04-25 at 20:16 +0200, fae at onet.eu wrote:

> Hi all,
> 
> I'm trying to set up a test environment for my application (using CAN
> sockets) based on LXC, but I'm stuck now because it seems that opening this
> kind of sockets inside the container does not work...
> 
> The following program works nice on a real host (printing "fd = 3"), but fails
> on the container with:
> "errno = 97, msg = Address family not supported by protocol"
> 
> I'm quite stuck with it right now, so if anyone has any idea how to make it
> work, I'd greatly appreciate it.
> 
> Luke
> 
> ------------------
> 
> #include <stdio.h>
> #include <errno.h>
> #include <string.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <linux/can.h>
> #include <linux/can/raw.h>
> 
> int main()
> {
>     	//int fd = socket(PF_INET, SOCK_RAW, AF_INET);
>     	int fd = socket(PF_CAN, SOCK_RAW, CAN_RAW);
> 	if (fd == -1) {
> 	    	printf("errno = %d, msg = %s\n", errno, strerror(errno));
> 	} else {
> 	    	printf("fd = %d\n", fd);
> 	    	close(fd);
> 	}
> 
> 	return 0;
> }
> 
> ------------------
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20120426/2464a988/attachment.html>


More information about the lxc-users mailing list