struct libnet_in6_addr 

union 

u_char __u6_addr8[16]; 
u_short __u6_addr16[8]; 
u_int __u6_addr32[4]; 
} __u6_addr; /* 128-bit IP6 address */ 
}; struct libnet_ipv6_hdr 

u_char   ip_flags[4]; /* version, traffic class, flow label */ 
u_short  ip_len; /* total length */ 
u_char   ip_nh; /* next header */ 
u_char   ip_hl; /* hop limit */ 
struct libnet_in6_addr ip_src, ip_dst; /* source and dest address */ 
};     BYTE abData[MAX_BUFF_LEN_M];
    WORD            wTotolLen = 0;

ZeroMemory(abData, MAX_BUFF_LEN_M); //R6报文暂时不存在分片
if (wLen+ETHER_LENGTH+IP6_HDR_LEN_M+UDP_LENGTH> 1500 )
{
                MessageBox(NULL,"目前不支持UDP分片,报文过大!",  "waring", MB_OK);
return FALSE;
}

struct udp_header *ptUdpHdr = (udp_header*)(abData + ETHER_LENGTH + IP6_HDR_LEN_M);
ptUdpHdr->sport = htons(wSrcPort);
ptUdpHdr->dport = htons(wDstPort);
    ptUdpHdr->len   = htons(wLen + UDP_LENGTH);//udp_length = 8
ptUdpHdr->crc   = 0xffff;

struct eth_header *ptEtHdr = (eth_header*)abData; 
ptEtHdr->type = htons(ETH_IP6);//eth_ip6=0x86dd
memcpy(ptEtHdr->smac, s_abSelfMac, 6);
memcpy(ptEtHdr->dmac, s_abDesMac,  6);

//IP头
struct libnet_ipv6_hdr *ip6_hdr = (libnet_ipv6_hdr *) (abData + ETHER_LENGTH); //ether_lenth = 14

ip6_hdr->ip_src.__u6_addr.__u6_addr8[0] = (u_char)0xfe80;
ip6_hdr->ip_src.__u6_addr.__u6_addr8[1] = (u_char)0;
ip6_hdr->ip_src.__u6_addr.__u6_addr8[2] = (u_char)0;
ip6_hdr->ip_src.__u6_addr.__u6_addr8[3] = (u_char)0;
ip6_hdr->ip_src.__u6_addr.__u6_addr8[4] = (u_char)0x217;
ip6_hdr->ip_src.__u6_addr.__u6_addr8[5] = (u_char)0x31ff;
ip6_hdr->ip_src.__u6_addr.__u6_addr8[6] = (u_char)0xfe50;
ip6_hdr->ip_src.__u6_addr.__u6_addr8[7] = (u_char)0x1b26;

ip6_hdr->ip_dst.__u6_addr.__u6_addr8[0] = (u_char)0xfe80;
ip6_hdr->ip_dst.__u6_addr.__u6_addr8[1] = (u_char)0;
ip6_hdr->ip_dst.__u6_addr.__u6_addr8[2] = (u_char)0;
ip6_hdr->ip_dst.__u6_addr.__u6_addr8[3] = (u_char)0;
ip6_hdr->ip_dst.__u6_addr.__u6_addr8[4] = (u_char)0x219;
ip6_hdr->ip_dst.__u6_addr.__u6_addr8[5] = (u_char)0x21ff;
ip6_hdr->ip_dst.__u6_addr.__u6_addr8[6] = (u_char)0xfed6;
           ip6_hdr->ip_dst.__u6_addr.__u6_addr8[7] = (u_char)0xb76e; ip6_hdr->ip_hl = 255; 
ip6_hdr->ip_nh = IPPROTO_UDP; 
ip6_hdr->ip_len = htons (wLen + UDP_LENGTH); 
ip6_hdr->ip_flags[0] = 0x06 << 4;  wTotolLen = ETHER_LENGTH + IP6_HDR_LEN_M + wLen + UDP_LENGTH;
          memcpy( abData + ETHER_LENGTH + IP6_HDR_LEN_M + UDP_LENGTH, pData, wLen);//IP6_HDR_LEN_M = 40 ,UDP_LENGTH = 8 

int n = pcapSend(hdev, abData, wTotolLen);//返回0应该是成功