linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Multicasting from kernel space.
@ 2010-01-07 15:12 Vadim Galitsyn
  0 siblings, 0 replies; only message in thread
From: Vadim Galitsyn @ 2010-01-07 15:12 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-07 15:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-07 15:12 Multicasting from kernel space Vadim Galitsyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).