Anton wrote:
> Hi,
> 
> Following on from a previous (now lost :-)) posting, I have been trying 
> to send out IPv6 packets from a kernel module using the kern_sendmsg() 
> function. Since in theory I need this function to be started in 
> interrupt context (actually, softirq context), but since this is 
> impossible because kern_sendmsg() needs to sleep, I have created a work 
> queue which calls the kern_sendmsg() function separately. The work queue 
> is scheduled from the softirq context (actually, at the moment this 
> happens from a Netfilter hook). The work queue function creates a msghdr 
> structure, fills in a sin6_addr structure, calls sock_create_kern() and 
> then uses this socket to send an IPv6 packet, which consists of a header 
> (struct ipv6hdr *iphdr) and some data following on from this. The above 
> packet is placed in the msghdr structure by setting (after the 
> appropriate initializations):
> msg.msg_iov->iov_base = (char *) ip6hdr;
> msg.msg_iov->iov_len = sizeof( struct ipv6hdr + ntohs( 
> ip6hdr->payload_len ) );

Shouldn't this be:
msg.msg_iov->iov_len = sizeof (struct ipv6hdr) + ntohs (ip6hdr->payload_len);

Seems you use sizeof (nthos (...)), and that seems wrong.

-- 
Roar B. Rotvik
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to