Skip to contentSkip to conversation

Setting skb->len

DISCUSSION Fred Moyer 1 participant 1 message Aug 30, 2007

lore
Share & tools
lore

Fred Moyer

author
#0 lore raw

Hi netfilter list,

This is my first post to this list, so if this question is better handled by a different list, or offtopic, please kindly inform me that is the case. My C is a bit rusty also, so please forgive me if I'm asking something that is not clear. In addition, this is my first netfilter module :-)

In a netfilter module I am working on I alter the packet data such that the length of the packet is reduced by an amount diff. I then set skb->len via the following code:

  skb->len -= diff;

This worked fine with gcc 2.96 but when cross-compiling this module for OpenWrt with gcc 4.1.2 I get the following error:

error: assignment of read-only member 'len'

Is there a function I can use to set skb->len or do I need to poke around the kernel code and modify this member to be read-write. I accept the fact that what I'm doing is probably a hack, but I would like to get this module working first, then make it well coded second.

Thanks in advance for any advice,

Fred