IPV6 header creation for dhcpv6 packet

Prabhu prabhum at msys-tech.com
Tue Jun 14 08:45:04 EDT 2011


HI all,

I am writing  simple dhcpv6 client. I gone through the rfc of dhcp and 
ipv6 and understand basic. With the understanding i started to implement 
SOLICIT request option.
I have created a packet with the below structure.

struct udp_dhcp6_packet {

         struct ip6_hdr ip;

         struct udphdr udp;

         struct dhcp6_Message data;

} PACKED;

In the above structure i am able to assign the value for udp and 
data(i.e struct udphdr, struct dhcp6_Message). But i could not able to 
set the value for ip. Below is the structure of ip6_hdr.

struct ip6_hdr
   {
     union   {

         struct ip6_hdrctl
           {
             uint32_t ip6_un1_flow;   /* 4 bits version, 8 bits TC,
                                         20 bits flow-ID */
             uint16_t ip6_un1_plen;   /* payload length */
             uint8_t  ip6_un1_nxt;    /* next header */
             uint8_t  ip6_un1_hlim;   /* hop limit */
           } ip6_un1;
         uint8_t ip6_un2_vfc;       /* 4 bits version, top 4 bits tclass */
       } ip6_ctlun;
     struct in6_addr ip6_src;      /* source address */
     struct in6_addr ip6_dst;      /* destination address */
   };

I want to set the ip6_dst value as ff02::1:2 and the ip6_src address as 
fe80::220:4aff:fea8:8e4a and remaining options. But i dont have any idea 
how to set these values. I googled many times and not able to get the 
idea to creat ipv6 header.

Kindly help me to solve my problem?

Note :

I don't know whether this is right place to ask this question . If i am 
wrong , i am sorry.

Thanks in advance ,


Prabhu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110614/313c475a/attachment-0001.html 


More information about the Kernelnewbies mailing list