[<prev] [next>] [day] [month] [year] [list]
Message-ID: <7f65365c1001070712p348c3522l1874886b0bfb80b9@mail.gmail.com>
Date: Fri, 8 Jan 2010 00:12:40 +0900
From: Vadim Galitsyn <galitsyn@...il.com>
To: linux-kernel@...r.kernel.org
Subject: Multicasting from kernel space.
Hi All,
I am trying to find the proper way to send multicast traffic from
kernel space at 2.6.32 kernel.
My code is like this:
/* Create a socket */
static struct socket *sock;
sock_create_kern(AF_INET, SOCK_DGRAM,
IPPROTO_UDP, &sock);
...
/* Set address */
struct sockaddr_in mc_addr;
mc_addr.sin_family = AF_INET;
#define MCAST_ADDR "224.1.1.1"
#define MCAST_PORT 10000
mc_addr.sin_addr.s_addr = htonl((__be32)MCAST_ADDR);
mc_addr.sin_port = htons(MCAST_PORT);
/* Prepare transfer */
struct kvec vec;
struct msghdr msg;
vec.iov_base = buf;
vec.iov_len = BUF_SIZE;
msg.msg_name = &mc_addr;
msg.msg_namelen = sizeof(mc_addr);
kernel_sendmsg(sock, &msg, &vec, 1, size);
I am getting error -101 (ENETUNREACH) here. But routing table is ok:
root:~> route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.1.0.0 * 255.255.255.0 U 0 0 0 eth0
224.0.0.0 * 240.0.0.0 U 0 0 0 eth0
root:~>
I am able to send multicast packets from user space in this
configuration. What's wrong with kernel space?
Thank you,
Vadim.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists