[IPv6] kernel_sendmsg returned -101 to kernel module for some multicast destination

From: Kenneth Zhu
Date: Fri Dec 19 2008 - 22:23:28 EST


Hello,

I've been trying to send all sorts of IPv6 packets in my kernel
module and most of them succeeded, while when I want to
send to some special address -- ff02::d in my case --
kernel_sendmsg returned me a -101 error code which means
"Network Unreachable". Compared to similar application layer
implementation like ping6, I find it also reports an error when
the outbound interface is not specified.

This is part of my source code regarding this error, while I think
I have specified the outbound interface (mcast_oif). Is anybody
knows where the problem is?

sock->sk->sk_allocation = GFP_NOIO;

inet = inet_sk(sock->sk);
inet->num = ip6h->nexthdr;
inet->hdrincl = 1;

np = inet6_sk(sock->sk);
np->sndflow = 0;
np->daddr = ip6h->daddr;
np->saddr = ip6h->saddr;
np->hop_limit = ip6h->hop_limit;
np->mcast_oif = v6index;

sin.sin6_family = PF_INET6;
sin.sin6_addr = ip6h->daddr;
sin.sin6_port = htons(ip6h->nexthdr);

iov.iov_base = data;
iov.iov_len = pktlen;
msg.msg_name = &sin;
msg.msg_namelen = sizeof(sin);
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = MSG_NOSIGNAL;

kernel_sendmsg(sock, &msg, &iov, 1, pktlen);

Thank you very much!

Best regards,

Kenneth. Z
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/