raw IPv6 packets on Linux



Hi,

I am currently porting an application from IPv4 to IPv6. The older
code uses some raw IPV4 packets with a structure defined as

struct
{
struct iphdr ip;
struct tcphdr tcp;
} pkt;


However to replace the above structure for IPV6 I can see two
structures available, "struct ipv6hdr" and "struct ip6_hdr". The later
one doesnt seem to be a complete fit as it doesnt seem to have all the
required fields of IPv6. Can anyone suggest which one to use.

When I use ipv6hdr and include the corresponding files

#include <netinet/ip6.h>
#include <linux/ipv6.h>

I get a compilation error as redefinition of in6_addr.

Also I read that we may not need the following code with IPv6.

ret = setsockopt(s, SOL_IP, IP_HDRINCL, &one, sizeof(one));

Any suggestions?

Thanks in advance

.



Relevant Pages

  • Re: [PATCH] s390 - mark IPv6 support for QETH as broken
    ... defines that as opaque data. ... There is no other ipv6 specific field. ... A simple solution will be adding a pointer to a public struct with ipv6 ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Linux 2.6.19
    ... Reverting that patch fixes things up for me. ... I suspect that it might be because I removed the IPV6 ... needs to explicitly allocate space for the struct ipv6hdr in 'len'. ... if (err < 0) ...
    (Linux-Kernel)
  • constructing IPv6 in6_addr structure from ipv6
    ... Is there a recommended way to construct a struct sockaddr_in6 in kernel ... which is the format the connect function on a socket requires for ipv6 ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: 2.6.19 panic on boot -- i386
    ... Calculate packet length correctly for allocation. ... MAX_HEADER does not include the ipv6 header length in it, ... if (err < 0) ... struct in6_addr *target) ...
    (Linux-Kernel)
  • macro for compile time allocation
    ... The error is because the size doesnt appear to be known at compile time ... this is a macro not a function. ... Prev by Date: ...
    (comp.lang.c)