PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Noms de domaine > comp.protocols.tcp-ip > Structure used for IPv6 header
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.protocols.tcp-ip TCP and IP network protocols.

Structure used for IPv6 header

Réponse
 
LinkBack Outils de la discussion
Vieux 28/09/2007, 08h11   #1
Manish Katiyar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Structure used for IPv6 header

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

  Réponse avec citation
Vieux 29/09/2007, 01h38   #2
Debashis Dutt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Structure used for IPv6 header

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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 09h49.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08654 seconds with 10 queries