|
|
|
|
||||||
| comp.protocols.tcp-ip TCP and IP network protocols. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Sep 28, 12:11 am, Manish Katiyar <mkati...@gmail.com> wrote:
> 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 Which version of Linux is this ? If you are just porting an application, I think it is a good idea to just include <netinet/ip6.h> and use the structure struct ip6_hdr{} defined in it. If you want to use the structure struct in6_pktinfo{} use the definition from <netinet/in.h> <linux/ipv6.h> should mostly be used from inside the kernel, from what I understand. --Debashis |
|
![]() |
| Outils de la discussion | |
|
|