Lines Matching +full:ipv6 +full:- +full:single +full:- +full:target
56 * measure round-trip-delays and packet loss across network paths.
58 * Author -
63 * Status -
65 * Bugs -
86 * because they are linux-specific. It's not needed on Android because Android
170 int pmtudisc=-1;
181 int ni_query = -1;
185 int ni_subject_type = -1;
215 cmsg->cmsg_len = sizeof(struct cmsghdr) + sizeof(struct ip6_rthdr0); in inet6_srcrt_init()
216 cmsg->cmsg_level = SOL_IPV6; in inet6_srcrt_init()
217 cmsg->cmsg_type = IPV6_RTHDR; in inet6_srcrt_init()
228 cmsg->cmsg_len += sizeof(struct in6_addr); in inet6_srcrt_add()
229 hdr->ip6r0_len += sizeof(struct in6_addr) / 8; in inet6_srcrt_add()
231 memcpy(&hdr->ip6r0_addr[hdr->ip6r0_segleft++], addr, in inet6_srcrt_add()
259 .namelen = sizeof(_name) - 1, \
277 NIQUERY_OPTION("ipv6", 0, 0, niquery_option_ipv6_handler),
278 NIQUERY_OPTION("ipv6-all", 0, NI_IPV6ADDR_F_ALL, niquery_option_ipv6_flag_handler),
279 NIQUERY_OPTION("ipv6-compatible", 0, NI_IPV6ADDR_F_COMPAT, niquery_option_ipv6_flag_handler),
280 NIQUERY_OPTION("ipv6-linklocal", 0, NI_IPV6ADDR_F_LINKLOCAL, niquery_option_ipv6_flag_handler),
281 NIQUERY_OPTION("ipv6-sitelocal", 0, NI_IPV6ADDR_F_SITELOCAL, niquery_option_ipv6_flag_handler),
282 NIQUERY_OPTION("ipv6-global", 0, NI_IPV6ADDR_F_GLOBAL, niquery_option_ipv6_flag_handler),
284 NIQUERY_OPTION("ipv4-all", 0, NI_IPV4ADDR_F_ALL, niquery_option_ipv4_flag_handler),
285 NIQUERY_OPTION("subject-ipv6", 1, NI_SUBJ_IPV6, niquery_option_subject_addr_handler),
286 NIQUERY_OPTION("subject-ipv4", 1, NI_SUBJ_IPV4, niquery_option_subject_addr_handler),
287 NIQUERY_OPTION("subject-name", 1, 0, niquery_option_subject_name_handler),
288 NIQUERY_OPTION("subject-fqdn", 1, -1, niquery_option_subject_name_handler),
335 static int seq = -1; in niquery_nonce()
349 memcpy(nonce + sizeof(__u16), digest, NI_NONCE_SIZE - sizeof(__u16)); in niquery_nonce()
352 if (memcmp(nonce + sizeof(__u16), digest, NI_NONCE_SIZE - sizeof(__u16))) in niquery_nonce()
353 return -1; in niquery_nonce()
382 return -1; in niquery_check_nonce()
393 return -1; in niquery_set_qtype()
402 return -1; in niquery_option_name_handler()
409 return -1; in niquery_option_ipv6_handler()
416 return -1; in niquery_option_ipv6_flag_handler()
424 return -1; in niquery_option_ipv4_handler()
431 return -1; in niquery_option_ipv4_flag_handler()
445 return -1; in niquery_set_subject_type()
452 #define OFFSET_OF(type,elem) ((size_t)&((type *)0)->elem)
461 return -1; in niquery_option_subject_addr_handler()
480 offset = -1; in niquery_option_subject_addr_handler()
491 return -1; in niquery_option_subject_addr_handler()
494 for (ai = ai0; ai; ai = ai->ai_next) { in niquery_option_subject_addr_handler()
498 memcpy(p, (__u8 *)ai->ai_addr + offset, ni_subject_len); in niquery_option_subject_addr_handler()
527 return -1; in niquery_option_subject_name_handler()
577 fqdn = dots ? 1 : -1; in niquery_option_subject_name_handler()
581 plus non-fqdn indicator. */ in niquery_option_subject_name_handler()
639 fprintf(stderr, "ping6 -N suboptions\n" in niquery_option_help_handler()
644 "\t\tipv6,ipv6-all,ipv6-compatible,ipv6-linklocal,ipv6-sitelocal,ipv6-global,\n" in niquery_option_help_handler()
645 "\t\tipv4,ipv4-all,\n" in niquery_option_help_handler()
647 "\t\tsubject-ipv6=addr,subject-ipv4=addr,subject-name=name,subject-fqdn=name,\n" in niquery_option_help_handler()
656 int ret = -1; in niquery_option_handler()
657 for (i = 0, p = niquery_options; p->name; i++, p++) { in niquery_option_handler()
658 if (strncmp(p->name, opt_arg, p->namelen)) in niquery_option_handler()
660 if (!p->has_arg) { in niquery_option_handler()
661 if (opt_arg[p->namelen] == '\0') { in niquery_option_handler()
662 ret = p->handler(i, NULL); in niquery_option_handler()
667 if (opt_arg[p->namelen] == '=') { in niquery_option_handler()
668 ret = p->handler(i, &opt_arg[p->namelen] + 1); in niquery_option_handler()
674 if (!p->name) in niquery_option_handler()
689 return -1; in hextoui()
704 char *target; in main() local
770 device = optarg + (p - addr) + 1; in main()
793 fprintf(stderr, "ping: wrong value for -M: do, dont, want are valid ones.\n"); in main()
798 printf("ping6 utility, iputils-%s\n", SNAPSHOT); in main()
802 fprintf(stderr, "ping: -N requires raw socket permissions\n"); in main()
817 argc -= optind; in main()
831 space = inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1); in main()
833 space = inet6_srcrt_space(IPV6_SRCRT_TYPE_0, argc - 1); in main()
853 srcrt->cmsg_len = CMSG_LEN(space); in main()
854 srcrt->cmsg_level = IPPROTO_IPV6; in main()
855 srcrt->cmsg_type = IPV6_RTHDR; in main()
856 inet6_rth_init(CMSG_DATA(srcrt), space, IPV6_RTHDR_TYPE_0, argc - 1); in main()
864 target = *argv; in main()
871 gai = getaddrinfo(target, NULL, &hints, &ai); in main()
876 addr = &((struct sockaddr_in6 *)(ai->ai_addr))->sin6_addr; in main()
885 firsthop.sin6_scope_id = ((struct sockaddr_in6 *)(ai->ai_addr))->sin6_scope_id; in main()
898 argc--; in main()
918 target = *argv; in main()
922 target = ni_group; in main()
930 gai = getaddrinfo(target, NULL, &hints, &ai); in main()
936 memcpy(&whereto, ai->ai_addr, sizeof(whereto)); in main()
939 if (memchr(target, ':', strlen(target))) in main()
958 hostname = target; in main()
987 setsockopt(probe_fd, IPPROTO_IPV6, IPV6_PKTINFO, &ipi, sizeof(ipi)) == -1 && in main()
989 setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1) { in main()
999 if (connect(probe_fd, (struct sockaddr*)&firsthop, sizeof(firsthop)) == -1) { in main()
1004 if (getsockname(probe_fd, (struct sockaddr*)&source, &alen) == -1) { in main()
1020 for (ifa = ifa0; ifa; ifa = ifa->ifa_next) { in main()
1021 if (!ifa->ifa_addr || ifa->ifa_addr->sa_family != AF_INET6) in main()
1023 if (!strncmp(ifa->ifa_name, device, sizeof(device) - 1) && in main()
1024 IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr, in main()
1053 cmsg->cmsg_len = CMSG_LEN(sizeof(*ipi)); in main()
1054 cmsg->cmsg_level = SOL_IPV6; in main()
1055 cmsg->cmsg_type = IPV6_PKTINFO; in main()
1059 ipi->ipi6_ifindex = if_name2index(device); in main()
1078 if (setsockopt(icmp_sock, SOL_IPV6, IPV6_MTU_DISCOVER, &pmtudisc, sizeof(pmtudisc)) == -1) { in main()
1085 bind(icmp_sock, (struct sockaddr*)&source, sizeof(source)) == -1) { in main()
1107 /* Estimate memory eaten by single packet. It is rough estimate. in main()
1125 " - try to continue."); in main()
1159 &loop, sizeof(loop)) == -1) { in main()
1166 &ttl, sizeof(ttl)) == -1) { in main()
1171 &ttl, sizeof(ttl)) == -1) { in main()
1182 &on, sizeof(on)) == -1 && in main()
1184 &on, sizeof(on)) == -1 in main()
1187 &on, sizeof(on)) == -1 in main()
1198 &tclass, sizeof(tclass)) == -1) { in main()
1217 freq_len = CMSG_ALIGN(sizeof(*freq)) + srcrt->cmsg_len; in main()
1220 freq->flr_label = htonl(flowlabel & IPV6_FLOWINFO_FLOWLABEL); in main()
1221 freq->flr_action = IPV6_FL_A_GET; in main()
1222 freq->flr_flags = IPV6_FL_F_CREATE; in main()
1223 freq->flr_share = IPV6_FL_S_EXCL; in main()
1224 memcpy(&freq->flr_dst, &whereto.sin6_addr, 16); in main()
1227 memcpy(freq_buf + CMSG_ALIGN(sizeof(*freq)), srcrt, srcrt->cmsg_len); in main()
1230 freq, freq_len) == -1) { in main()
1234 flowlabel = freq->flr_label; in main()
1237 cmsglen = (char*)srcrt - (char*)cmsgbuf; in main()
1249 &on, sizeof(on)) == -1) { in main()
1282 struct sockaddr_in6 target; in receive_error_msg() local
1289 msg.msg_name = (void*)⌖ in receive_error_msg()
1290 msg.msg_namelen = sizeof(target); in receive_error_msg()
1303 if (cmsg->cmsg_level == SOL_IPV6) { in receive_error_msg()
1304 if (cmsg->cmsg_type == IPV6_RECVERR) in receive_error_msg()
1311 if (e->ee_origin == SO_EE_ORIGIN_LOCAL) { in receive_error_msg()
1317 else if (e->ee_errno != EMSGSIZE) in receive_error_msg()
1318 fprintf(stderr, "ping: local error: %s\n", strerror(e->ee_errno)); in receive_error_msg()
1320 fprintf(stderr, "ping: local error: Message too long, mtu=%u\n", e->ee_info); in receive_error_msg()
1322 } else if (e->ee_origin == SO_EE_ORIGIN_ICMP6) { in receive_error_msg()
1326 memcmp(&target.sin6_addr, &whereto.sin6_addr, 16) || in receive_error_msg()
1342 printf("From %s icmp_seq=%u ", pr_addr(&sin6->sin6_addr), ntohs(icmph.icmp6_seq)); in receive_error_msg()
1343 pr_icmph(e->ee_type, e->ee_code, e->ee_info); in receive_error_msg()
1351 return net_errors ? : -local_errors; in receive_error_msg()
1355 * pinger --
1360 * byte-order, to compute the round-trip time.
1368 icmph->icmp6_type = ICMP6_ECHO_REQUEST; in build_echo()
1369 icmph->icmp6_code = 0; in build_echo()
1370 icmph->icmp6_cksum = 0; in build_echo()
1371 icmph->icmp6_seq = htons(ntransmitted+1); in build_echo()
1372 icmph->icmp6_id = ident; in build_echo()
1390 nih->ni_cksum = 0; in build_niquery()
1392 nih->ni_type = ICMPV6_NI_QUERY; in build_niquery()
1396 niquery_fill_nonce(ntransmitted + 1, nih->ni_nonce); in build_niquery()
1397 nih->ni_code = ni_subject_type; in build_niquery()
1398 nih->ni_qtype = htons(ni_query); in build_niquery()
1399 nih->ni_flags = ni_flag; in build_niquery()
1446 printf(" icmp_seq=%u", ntohs(icmph->icmp6_seq)); in pr_echo_reply()
1466 len -= sizeof(struct ni_hdr) + 4; in pr_niquery_reply_name()
1512 switch (ntohs(nih->ni_qtype)) { in pr_niquery_reply_addr()
1516 truncated = nih->ni_flags & NI_IPV6ADDR_F_TRUNCATE; in pr_niquery_reply_addr()
1521 truncated = nih->ni_flags & NI_IPV4ADDR_F_TRUNCATE; in pr_niquery_reply_addr()
1558 switch (nih->ni_code) { in pr_niquery_reply()
1560 switch (ntohs(nih->ni_qtype)) { in pr_niquery_reply()
1569 printf(" unknown qtype(0x%02x)", ntohs(nih->ni_qtype)); in pr_niquery_reply()
1579 printf(" unknown code(%02x)", ntohs(nih->ni_code)); in pr_niquery_reply()
1581 printf("; seq=%u;", ntohsp((__u16*)nih->ni_nonce)); in pr_niquery_reply()
1585 * parse_reply --
1595 __u8 *buf = msg->msg_iov->iov_base; in parse_reply()
1598 int hops = -1; in parse_reply()
1601 if (c->cmsg_level != SOL_IPV6) in parse_reply()
1603 switch(c->cmsg_type) { in parse_reply()
1608 if (c->cmsg_len < CMSG_LEN(sizeof(int))) in parse_reply()
1624 if (icmph->icmp6_type == ICMP6_ECHO_REPLY) { in parse_reply()
1625 if (!is_ours(icmph->icmp6_id)) in parse_reply()
1628 ntohs(icmph->icmp6_seq), in parse_reply()
1629 hops, 0, tv, pr_addr(&from->sin6_addr), in parse_reply()
1632 } else if (icmph->icmp6_type == ICMPV6_NI_REPLY) { in parse_reply()
1634 int seq = niquery_check_nonce(nih->ni_nonce); in parse_reply()
1639 hops, 0, tv, pr_addr(&from->sin6_addr), in parse_reply()
1651 * using RECVRERR. :-) in parse_reply()
1657 if (memcmp(&iph1->ip6_dst, &whereto.sin6_addr, 16)) in parse_reply()
1660 nexthdr = iph1->ip6_nxt; in parse_reply()
1667 if (icmph1->icmp6_type != ICMP6_ECHO_REQUEST || in parse_reply()
1668 !is_ours(icmph1->icmp6_id)) in parse_reply()
1670 acknowledge(ntohs(icmph1->icmp6_seq)); in parse_reply()
1679 printf("From %s: icmp_seq=%u ", pr_addr(&from->sin6_addr), ntohs(icmph1->icmp6_seq)); in parse_reply()
1685 printf("From %s: ", pr_addr(&from->sin6_addr)); in parse_reply()
1687 pr_icmph(icmph->icmp6_type, icmph->icmp6_code, ntohl(icmph->icmp6_mtu)); in parse_reply()
1809 * pr_addr --
1831 || idna_to_unicode_lzlz(hp->h_name, &s, 0) != IDNA_SUCCESS in pr_addr()
1836 return hp ? (s ? s : hp->h_name) : pr_addr_n(addr); in pr_addr()
1852 " [-" in usage()
1855 " [-c count]" in usage()
1856 " [-i interval]" in usage()
1857 " [-I interface]" in usage()
1859 " [-l preload]" in usage()
1860 " [-m mark]" in usage()
1861 " [-M pmtudisc_option]" in usage()
1863 " [-N nodeinfo_option]" in usage()
1864 " [-p pattern]" in usage()
1865 " [-Q tclass]" in usage()
1866 " [-s packetsize]" in usage()
1868 " [-S sndbuf]" in usage()
1869 " [-t ttl]" in usage()
1870 " [-T timestamp_option]" in usage()
1871 " [-w deadline]" in usage()
1873 " [-W timeout]" in usage()