<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.4.1">
</HEAD>
<BODY>
Hi,<BR>
<BR>
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.<BR>
<BR>
--ilf<BR>
<BR>
On Wed, 2012-04-25 at 20:16 +0200, fae@onet.eu wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
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. <A HREF="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</A>
_______________________________________________
Lxc-users mailing list
<A HREF="mailto:Lxc-users@lists.sourceforge.net">Lxc-users@lists.sourceforge.net</A>
<A HREF="https://lists.sourceforge.net/lists/listinfo/lxc-users">https://lists.sourceforge.net/lists/listinfo/lxc-users</A>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>