All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roar Bjørgum Rotvik" <roarbr@tihlde.org>
To: Anton <Anton.Uzunov@dsto.defence.gov.au>
Cc: netdev@vger.kernel.org
Subject: Re: sending IPv6 packets via kern_sendmsg
Date: Wed, 06 Jun 2007 08:44:10 +0200	[thread overview]
Message-ID: <466657BA.9080903@tihlde.org> (raw)
In-Reply-To: <466636DB.8060107@dsto.defence.gov.au>

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

      reply	other threads:[~2007-06-06  7:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06  4:23 sending IPv6 packets via kern_sendmsg Anton
2007-06-06  6:44 ` Roar Bjørgum Rotvik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=466657BA.9080903@tihlde.org \
    --to=roarbr@tihlde.org \
    --cc=Anton.Uzunov@dsto.defence.gov.au \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.