The userspace application running on HOST works without any issue but the same application fails to run in LXC container with error ECONNREFUSED;
The userspace application fails with ECONNREFUSED during sendmsg to netlink
Linux kernel 3.4 with namespace support and LXC with 1.0.2 version is used.
Registering myApp.ko kernel module as below
netlink_kernel_create(&init_net, ..... );
and userspace app fails during sendmsg to the netlink socket;
sock = socket(PF_NETLINK, SOCK_RAW, ....);
Userspace application is running insider C1 container and it make use of getpid(); for nlMsg->nlmsg->pid
nlMsg->nlmsg_pid = getpid();
Netlink register handler on receiving the msg is not even called in Kernel but userspace application running inside container fails with "Connection Refused" during sendmsg();
Is there something I need to address to run the same userspace app in container? I tried even giving constant number to pid variable rather than using getpid(); but then also hitting the same issue;
socket(PF_NETLINK, SOCK_RAW, 31) = 4
bind(4, {sa_family=AF_NETLINK, pid=812, groups=00000000}, 12) = 0
sendmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\20\0\0\0\2\0\0\0\0\0\0\0,\3\0\0", 16}], msg_controllen=0, msg_flags=0}, 0) = -1 **ECONNREFUSED** (Connection refused)