1 #include "ping.h" 2 3 void send_v6()4send_v6() 5 { 6 #ifdef IPV6 7 int len; 8 struct icmp6_hdr *icmp6; 9 10 icmp6 = (struct icmp6_hdr *) sendbuf; 11 icmp6->icmp6_type = ICMP6_ECHO_REQUEST; 12 icmp6->icmp6_code = 0; 13 icmp6->icmp6_id = pid; 14 icmp6->icmp6_seq = nsent++; 15 Gettimeofday((struct timeval *) (icmp6 + 1), NULL); 16 17 len = 8 + datalen; /* 8-byte ICMPv6 header */ 18 19 Sendto(sockfd, sendbuf, len, 0, pr->sasend, pr->salen); 20 /* 4kernel calculates and stores checksum for us */ 21 #endif /* IPV6 */ 22 } 23