All of lore.kernel.org
 help / color / mirror / Atom feed
* A question about reinjecting packets
@ 2004-02-11 15:58 Paul Tipper
  2004-02-12  2:04 ` Henrik Nordstrom
  2004-02-12 15:51 ` Unit Zero
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Tipper @ 2004-02-11 15:58 UTC (permalink / raw)
  To: netfilter-devel

Greetings, 

I'm working on an implementation of an IPv4 to IPv6 bump in the stack (yes
I admit it, I'm a student) and while doing this I've gotten stuck at the
stage of reinjecting packets into the network.  The model I'm working with
is a little kludgey but in short translates v6 addresses to Class E v4
addresses so that they can be consistently addressed.

I've written a module that hooks into NF_IP_LOCAL_OUT and intercepts
outgoing v4 packets, checks to see if there is a v6 mapping and if there
is translates the packet to v6.

Currently this translation consists of using skb_unshare() on the packet
to ensure its not a clone, then skb_copy_expand() to create an entirely
new copy of the packet including its data.

The sk_buff->protocol field is changed and the new struct ipv6hdr is
constructed (with the local v6 address in the saddr and the destination
the 240.x.x.x address maps onto in the daddr field.  Finally the new
sk_buff has its ->nh changed to point at the new ipv6hdr and the csum is
recalculated.

So as far as I can see I've modified everything I need to change to make
this v4 sk_buff into a v6 one, the problem I then run into is I can find
no way of getting it successfully out onto the network.

I've tried using ip6_xmit() (for which I constructed a struct flowi).
When I couldn't get that work I prodded about some more and tried to use
the NF_HOOK macro to send it out on PF_INET6, NF_IP6_POST_ROUTING, however
the packet never seems to make it out onto the network and just vanishes
without a trace, which leads me to believe I've not converted it properly
and some nice peice of code further down the line is dropping it for
safety reasons.

Is anyone feeling generous enough to make a stab at what I must have
missed?  Or point me in the right direction?


-- 
   /\   Paul Tipper -- Code Monkey & Caffeine Junky
  /<>\   Email: tipper at wintermute dot me dot uk
 /____\   WWW: http://www.wintermute.me.uk/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-02-12 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-11 15:58 A question about reinjecting packets Paul Tipper
2004-02-12  2:04 ` Henrik Nordstrom
2004-02-12 15:51 ` Unit Zero
2004-02-12 16:10   ` Patrick McHardy
2004-02-12 16:29     ` Unit Zero

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.