PDA

View Full Version : Using IPv6 and Raw Sockets



Kkloe
October 27th, 2009, 07:09 PM
Hi, I have a problem with sending IPv6 packets through a raw socket, I want to use a ipv6 header I have generated.
I am using the sendto() command, but as there is no IP_HDRINCL you can set as flag in ipv6 sockets in linux so the system inserts it own ipv6 header into the package, thus when sending, the package it is like this: system-ipv6 header->my-ipv6 header->payload

here is the function I do this on.
http://pastebin.com/m38c79b97

for those who wonder what the code is supposed to do:
its a function to capture ipv4 esp packets, check if the spi exist in a internal list and then send it through as a ipv6 esp packet

I have done this for Ipv6 to Ipv4, but I cant make it work in the other way around

Kkloe
October 29th, 2009, 05:25 PM
Seems I have found the solution, for those intrested:
http://lists.openwall.net/netdev/2009/01/15/168

alopez@ac.upc.edu
January 18th, 2013, 04:46 PM
We are trying to implement something similar to what you are explaining. We receive a full IPv6 packet through a tun interface and in some conditions we want to resend it and in other conditions encapsulate it in another IPv6 packet.
Could you give us an example of how have you done it? (the code you uploaded in pastebin is no longer there)