Skip to contentSkip to conversation

Pointers for writing packet mangling modules

DISCUSSION Brian Long 1 participant 1 message Nov 2, 2005 netfilter

lore
Share & tools
lore

Brian Long

author
#0 lore raw

Hi,

I have been experimenting with a module for altering the destination IP address for all packets on a given port at the PRE_ROUTING stage (don’t worry - I know this is something easily done with IPTables).  Unfortunately, any examples/tutorials dealing with writing modules that use Netfilter always fall short of describing the necessary steps to take when altering the skbuff.

Are the following steps necessary (judging from the NAT source code)?

Calling skb_ip_make_writable
Recalculating ip checksum
Calling dst_release

What else am I missing?

Thanks,

Brian