Netdev List
 help / color / mirror / Atom feed
From: Chris Ross <chris@compilednetworks.com>
To: netdev@vger.kernel.org
Subject: skb_copy/clone question
Date: Wed, 26 Aug 2009 10:07:59 -0500	[thread overview]
Message-ID: <17cd85320908260807k78a0353ha82da7f8dbc34ec@mail.gmail.com> (raw)

I have a driver that generate N packets to send for every 1 it
receives, similar to a bridge in functionality. I need to insert a
slightly different header for each output packet. My current approach
which is causing some issues is ..

send_packet(struct sk_buff* skb)
{
  if (skb_cow_head(skb, some_val) < 0)
    goto error_condition;

  .. insert header ..

  .. set skb->dst, and ident ..

  ip_local_out(skb)
}

// main section
for each egress packet
{
  // skb->len is always > 0 here
  if ((tskb = pskb_copy(skb, GFP_ATOMIC)) == NULL)
    goto error_condition;

  // tskb->len seems to be 0 here
  send_packet(tskb)
}

I've played with both pskb_copy and skb_copy and both seem to result
in a packet with len of 0. I was expecting skb->len to be equivalent
to tskb->len. I am running 2.6.29, any pointers would be appreciated.

thanks,

-chris

                 reply	other threads:[~2009-08-26 15:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=17cd85320908260807k78a0353ha82da7f8dbc34ec@mail.gmail.com \
    --to=chris@compilednetworks.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox