traceroute6.c (66808) | traceroute6.c (78064) |
---|---|
1/* $KAME: traceroute6.c,v 1.32 2000/07/07 12:21:34 itojun Exp $ */ | 1/* $KAME: traceroute6.c,v 1.42 2001/05/08 04:36:41 itojun Exp $ */ |
2 3/* 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 61 unchanged lines hidden (view full) --- 71 The Regents of the University of California. All rights reserved.\n"; 72#endif /* not lint */ 73 74#ifndef lint 75#if 0 76static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93"; 77#endif 78static const char rcsid[] = | 2 3/* 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 61 unchanged lines hidden (view full) --- 71 The Regents of the University of California. All rights reserved.\n"; 72#endif /* not lint */ 73 74#ifndef lint 75#if 0 76static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93"; 77#endif 78static const char rcsid[] = |
79 "$FreeBSD: head/usr.sbin/traceroute6/traceroute6.c 66808 2000-10-08 07:52:08Z kris $"; | 79 "$FreeBSD: head/usr.sbin/traceroute6/traceroute6.c 78064 2001-06-11 12:39:29Z ume $"; |
80#endif /* not lint */ 81 82/* 83 * traceroute host - trace the route ip packets follow going to "host". 84 * 85 * Attempt to trace the route an ip packet would follow to some 86 * internet host. We find out intermediate hops by launching probe 87 * packets with a small ttl (time to live) then listening for an --- 292 unchanged lines hidden (view full) --- 380 char *argv[]; 381{ 382 struct hostent *hp; 383 int error; 384 struct addrinfo hints, *res; 385 int ch, i, on, probe, seq, hops, rcvcmsglen; 386 static u_char *rcvcmsgbuf; 387 char hbuf[NI_MAXHOST], src0[NI_MAXHOST]; | 80#endif /* not lint */ 81 82/* 83 * traceroute host - trace the route ip packets follow going to "host". 84 * 85 * Attempt to trace the route an ip packet would follow to some 86 * internet host. We find out intermediate hops by launching probe 87 * packets with a small ttl (time to live) then listening for an --- 292 unchanged lines hidden (view full) --- 380 char *argv[]; 381{ 382 struct hostent *hp; 383 int error; 384 struct addrinfo hints, *res; 385 int ch, i, on, probe, seq, hops, rcvcmsglen; 386 static u_char *rcvcmsgbuf; 387 char hbuf[NI_MAXHOST], src0[NI_MAXHOST]; |
388 char *ep; |
|
388 389 /* 390 * Receive ICMP 391 */ 392 if ((rcvsock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) { 393 perror("socket(ICMPv6)"); 394 exit(5); 395 } 396 | 389 390 /* 391 * Receive ICMP 392 */ 393 if ((rcvsock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) { 394 perror("socket(ICMPv6)"); 395 exit(5); 396 } 397 |
398 /* revoke privs */ 399 seteuid(getuid()); 400 setuid(getuid()); 401 |
|
397 /* set a minimum set of socket options */ 398 on = 1; 399 /* specify to tell receiving interface */ 400#ifdef IPV6_RECVPKTINFO 401 if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, 402 sizeof(on)) < 0) 403 err(1, "setsockopt(IPV6_RECVPKTINFO)"); 404#else /* old adv. API */ --- 8 unchanged lines hidden (view full) --- 413 sizeof(on)) < 0) 414 err(1, "setsockopt(IPV6_RECVHOPLIMIT)"); 415#else /* old adv. API */ 416 if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_HOPLIMIT, &on, 417 sizeof(on)) < 0) 418 err(1, "setsockopt(IPV6_HOPLIMIT)"); 419#endif 420 | 402 /* set a minimum set of socket options */ 403 on = 1; 404 /* specify to tell receiving interface */ 405#ifdef IPV6_RECVPKTINFO 406 if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, 407 sizeof(on)) < 0) 408 err(1, "setsockopt(IPV6_RECVPKTINFO)"); 409#else /* old adv. API */ --- 8 unchanged lines hidden (view full) --- 418 sizeof(on)) < 0) 419 err(1, "setsockopt(IPV6_RECVHOPLIMIT)"); 420#else /* old adv. API */ 421 if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_HOPLIMIT, &on, 422 sizeof(on)) < 0) 423 err(1, "setsockopt(IPV6_HOPLIMIT)"); 424#endif 425 |
421 /* revoke privs */ 422 seteuid(getuid()); 423 setuid(getuid()); 424 | |
425 seq = 0; 426 | 426 seq = 0; 427 |
427 while ((ch = getopt(argc, argv, "df:g:lm:np:q:rs:w:v")) != EOF) | 428 while ((ch = getopt(argc, argv, "df:g:lm:np:q:rs:w:v")) != -1) |
428 switch(ch) { 429 case 'd': 430 options |= SO_DEBUG; 431 break; 432 case 'f': | 429 switch(ch) { 430 case 'd': 431 options |= SO_DEBUG; 432 break; 433 case 'f': |
433 first_hop = atoi(optarg); | 434 ep = NULL; 435 first_hop = strtoul(optarg, &ep, 0); 436 if (!*argv || *ep) { 437 Fprintf(stderr, 438 "traceroute6: invalid min hoplimit.\n"); 439 exit(1); 440 } |
434 if (first_hop > max_hops) { 435 Fprintf(stderr, 436 "traceroute6: min hoplimit must be <= %d.\n", max_hops); 437 exit(1); 438 } 439 break; 440 case 'g': 441 hp = getipnodebyname(optarg, AF_INET6, 0, &h_errno); --- 30 unchanged lines hidden (view full) --- 472 inet6_rthdr_add(cmsg, (struct in6_addr *)hp->h_addr, IPV6_RTHDR_LOOSE); 473#endif 474 freehostent(hp); 475 break; 476 case 'l': 477 lflag++; 478 break; 479 case 'm': | 441 if (first_hop > max_hops) { 442 Fprintf(stderr, 443 "traceroute6: min hoplimit must be <= %d.\n", max_hops); 444 exit(1); 445 } 446 break; 447 case 'g': 448 hp = getipnodebyname(optarg, AF_INET6, 0, &h_errno); --- 30 unchanged lines hidden (view full) --- 479 inet6_rthdr_add(cmsg, (struct in6_addr *)hp->h_addr, IPV6_RTHDR_LOOSE); 480#endif 481 freehostent(hp); 482 break; 483 case 'l': 484 lflag++; 485 break; 486 case 'm': |
480 max_hops = atoi(optarg); | 487 ep = NULL; 488 max_hops = strtoul(optarg, &ep, 0); 489 if (!*argv || *ep) { 490 Fprintf(stderr, 491 "traceroute6: invalid max hoplimit.\n"); 492 exit(1); 493 } |
481 if (max_hops < first_hop) { 482 Fprintf(stderr, 483 "traceroute6: max hoplimit must be >= %d.\n", first_hop); 484 exit(1); 485 } 486 break; 487 case 'n': 488 nflag++; 489 break; 490 case 'p': | 494 if (max_hops < first_hop) { 495 Fprintf(stderr, 496 "traceroute6: max hoplimit must be >= %d.\n", first_hop); 497 exit(1); 498 } 499 break; 500 case 'n': 501 nflag++; 502 break; 503 case 'p': |
491 port = atoi(optarg); | 504 ep = NULL; 505 port = strtoul(optarg, &ep, 0); 506 if (!*argv || *ep) { 507 Fprintf(stderr, 508 "traceroute6: port.\n"); 509 exit(1); 510 } |
492 if (port < 1) { 493 Fprintf(stderr, 494 "traceroute6: port must be >0.\n"); 495 exit(1); 496 } 497 break; 498 case 'q': | 511 if (port < 1) { 512 Fprintf(stderr, 513 "traceroute6: port must be >0.\n"); 514 exit(1); 515 } 516 break; 517 case 'q': |
499 nprobes = atoi(optarg); | 518 ep = NULL; 519 nprobes = strtoul(optarg, &ep, 0); 520 if (!*argv || *ep) { 521 Fprintf(stderr, 522 "traceroute6: invalid nprobes.\n"); 523 exit(1); 524 } |
500 if (nprobes < 1) { 501 Fprintf(stderr, 502 "traceroute6: nprobes must be >0.\n"); 503 exit(1); 504 } 505 break; 506 case 'r': 507 options |= SO_DONTROUTE; --- 4 unchanged lines hidden (view full) --- 512 * probe (e.g., on a multi-homed host). 513 */ 514 source = optarg; 515 break; 516 case 'v': 517 verbose++; 518 break; 519 case 'w': | 525 if (nprobes < 1) { 526 Fprintf(stderr, 527 "traceroute6: nprobes must be >0.\n"); 528 exit(1); 529 } 530 break; 531 case 'r': 532 options |= SO_DONTROUTE; --- 4 unchanged lines hidden (view full) --- 537 * probe (e.g., on a multi-homed host). 538 */ 539 source = optarg; 540 break; 541 case 'v': 542 verbose++; 543 break; 544 case 'w': |
520 waittime = atoi(optarg); | 545 ep = NULL; 546 waittime = strtoul(optarg, &ep, 0); 547 if (!*argv || *ep) { 548 Fprintf(stderr, 549 "traceroute6: invalid wait time.\n"); 550 exit(1); 551 } |
521 if (waittime <= 1) { 522 Fprintf(stderr, 523 "traceroute6: wait must be >1 sec.\n"); 524 exit(1); 525 } 526 break; 527 default: 528 usage(); 529 } 530 argc -= optind; 531 argv += optind; 532 | 552 if (waittime <= 1) { 553 Fprintf(stderr, 554 "traceroute6: wait must be >1 sec.\n"); 555 exit(1); 556 } 557 break; 558 default: 559 usage(); 560 } 561 argc -= optind; 562 argv += optind; 563 |
533 if (argc < 1) | 564 if (argc < 1 || argc > 2) |
534 usage(); 535 536#if 1 537 setvbuf(stdout, NULL, _IOLBF, BUFSIZ); 538#else 539 setlinebuf (stdout); 540#endif 541 --- 10 unchanged lines hidden (view full) --- 552 } 553 if (res->ai_addrlen != sizeof(Dst)) { 554 (void)fprintf(stderr, 555 "traceroute6: size of sockaddr mismatch\n"); 556 exit(1); 557 } 558 memcpy(&Dst, res->ai_addr, res->ai_addrlen); 559 hostname = res->ai_canonname ? strdup(res->ai_canonname) : *argv; | 565 usage(); 566 567#if 1 568 setvbuf(stdout, NULL, _IOLBF, BUFSIZ); 569#else 570 setlinebuf (stdout); 571#endif 572 --- 10 unchanged lines hidden (view full) --- 583 } 584 if (res->ai_addrlen != sizeof(Dst)) { 585 (void)fprintf(stderr, 586 "traceroute6: size of sockaddr mismatch\n"); 587 exit(1); 588 } 589 memcpy(&Dst, res->ai_addr, res->ai_addrlen); 590 hostname = res->ai_canonname ? strdup(res->ai_canonname) : *argv; |
591 if (!hostname) { 592 (void)fprintf(stderr, "traceroute6: not enough core\n"); 593 exit(1); 594 } |
|
560 | 595 |
561 if (*++argv) 562 datalen = atoi(*argv); | 596 if (*++argv) { 597 ep = NULL; 598 datalen = strtoul(*argv, &ep, 0); 599 if (!*argv || *ep) { 600 Fprintf(stderr, 601 "traceroute6: invalid packet length.\n"); 602 exit(1); 603 } 604 } |
563 if (datalen < 0 || datalen >= MAXPACKET - sizeof(struct opacket)) { 564 Fprintf(stderr, 565 "traceroute6: packet size must be 0 <= s < %ld.\n", 566 (long)(MAXPACKET - sizeof(struct opacket))); 567 exit(1); 568 } 569 datalen += sizeof(struct opacket); 570 outpacket = (struct opacket *)malloc((unsigned)datalen); --- 211 unchanged lines hidden (view full) --- 782 ident = ntohs(Src.sin6_port); 783 } 784 785 /* 786 * Message to users 787 */ 788 if (getnameinfo((struct sockaddr *)&Dst, Dst.sin6_len, hbuf, 789 sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag)) | 605 if (datalen < 0 || datalen >= MAXPACKET - sizeof(struct opacket)) { 606 Fprintf(stderr, 607 "traceroute6: packet size must be 0 <= s < %ld.\n", 608 (long)(MAXPACKET - sizeof(struct opacket))); 609 exit(1); 610 } 611 datalen += sizeof(struct opacket); 612 outpacket = (struct opacket *)malloc((unsigned)datalen); --- 211 unchanged lines hidden (view full) --- 824 ident = ntohs(Src.sin6_port); 825 } 826 827 /* 828 * Message to users 829 */ 830 if (getnameinfo((struct sockaddr *)&Dst, Dst.sin6_len, hbuf, 831 sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag)) |
790 strcpy(hbuf, "(invalid)"); | 832 strlcpy(hbuf, "(invalid)", sizeof(hbuf)); |
791 Fprintf(stderr, "traceroute6"); 792 Fprintf(stderr, " to %s (%s)", hostname, hbuf); 793 if (source) 794 Fprintf(stderr, " from %s", source); 795 Fprintf(stderr, 796 ", %d hops max, %d byte packets\n", 797 max_hops, datalen); 798 (void) fflush(stderr); --- 85 unchanged lines hidden (view full) --- 884 cc = recvmsg(rcvsock, mhdr, 0); 885 886 return(cc); 887#else 888 fd_set *fdsp; 889 struct timeval wait; 890 int cc = 0, fdsn; 891 | 833 Fprintf(stderr, "traceroute6"); 834 Fprintf(stderr, " to %s (%s)", hostname, hbuf); 835 if (source) 836 Fprintf(stderr, " from %s", source); 837 Fprintf(stderr, 838 ", %d hops max, %d byte packets\n", 839 max_hops, datalen); 840 (void) fflush(stderr); --- 85 unchanged lines hidden (view full) --- 926 cc = recvmsg(rcvsock, mhdr, 0); 927 928 return(cc); 929#else 930 fd_set *fdsp; 931 struct timeval wait; 932 int cc = 0, fdsn; 933 |
892 fdsn = howmany(sock+1, NFDBITS) * sizeof(fd_mask); | 934 fdsn = howmany(sock + 1, NFDBITS) * sizeof(fd_mask); |
893 if ((fdsp = (fd_set *)malloc(fdsn)) == NULL) 894 err(1, "malloc"); 895 memset(fdsp, 0, fdsn); 896 FD_SET(sock, fdsp); 897 wait.tv_sec = waittime; wait.tv_usec = 0; 898 899 if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0) 900 cc = recvmsg(rcvsock, mhdr, 0); --- 168 unchanged lines hidden (view full) --- 1069#ifdef OLDRAWSOCKET 1070 ip = (struct ip6_hdr *) buf; 1071 hlen = sizeof(struct ip6_hdr); 1072 if (cc < hlen + sizeof(struct icmp6_hdr)) { 1073 if (verbose) { 1074 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1075 hbuf, sizeof(hbuf), NULL, 0, 1076 NI_NUMERICHOST | niflag) != 0) | 935 if ((fdsp = (fd_set *)malloc(fdsn)) == NULL) 936 err(1, "malloc"); 937 memset(fdsp, 0, fdsn); 938 FD_SET(sock, fdsp); 939 wait.tv_sec = waittime; wait.tv_usec = 0; 940 941 if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0) 942 cc = recvmsg(rcvsock, mhdr, 0); --- 168 unchanged lines hidden (view full) --- 1111#ifdef OLDRAWSOCKET 1112 ip = (struct ip6_hdr *) buf; 1113 hlen = sizeof(struct ip6_hdr); 1114 if (cc < hlen + sizeof(struct icmp6_hdr)) { 1115 if (verbose) { 1116 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1117 hbuf, sizeof(hbuf), NULL, 0, 1118 NI_NUMERICHOST | niflag) != 0) |
1077 strcpy(hbuf, "invalid"); | 1119 strlcpy(hbuf, "invalid", sizeof(hbuf)); |
1078 Printf("packet too short (%d bytes) from %s\n", cc, 1079 hbuf); 1080 } 1081 return (0); 1082 } 1083 cc -= hlen; 1084 icp = (struct icmp6_hdr *)(buf + hlen); 1085#else 1086 if (cc < sizeof(struct icmp6_hdr)) { 1087 if (verbose) { 1088 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1089 hbuf, sizeof(hbuf), NULL, 0, 1090 NI_NUMERICHOST | niflag) != 0) | 1120 Printf("packet too short (%d bytes) from %s\n", cc, 1121 hbuf); 1122 } 1123 return (0); 1124 } 1125 cc -= hlen; 1126 icp = (struct icmp6_hdr *)(buf + hlen); 1127#else 1128 if (cc < sizeof(struct icmp6_hdr)) { 1129 if (verbose) { 1130 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1131 hbuf, sizeof(hbuf), NULL, 0, 1132 NI_NUMERICHOST | niflag) != 0) |
1091 strcpy(hbuf, "invalid"); | 1133 strlcpy(hbuf, "invalid", sizeof(hbuf)); |
1092 Printf("data too short (%d bytes) from %s\n", cc, hbuf); 1093 } 1094 return(0); 1095 } 1096 icp = (struct icmp6_hdr *)buf; 1097#endif 1098 /* get optional information via advanced API */ 1099 rcvpktinfo = NULL; --- 41 unchanged lines hidden (view full) --- 1141 } 1142 if (verbose) { 1143 int i; 1144 u_int8_t *p; 1145 char sbuf[NI_MAXHOST+1], dbuf[INET6_ADDRSTRLEN]; 1146 1147 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1148 sbuf, sizeof(sbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0) | 1134 Printf("data too short (%d bytes) from %s\n", cc, hbuf); 1135 } 1136 return(0); 1137 } 1138 icp = (struct icmp6_hdr *)buf; 1139#endif 1140 /* get optional information via advanced API */ 1141 rcvpktinfo = NULL; --- 41 unchanged lines hidden (view full) --- 1183 } 1184 if (verbose) { 1185 int i; 1186 u_int8_t *p; 1187 char sbuf[NI_MAXHOST+1], dbuf[INET6_ADDRSTRLEN]; 1188 1189 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1190 sbuf, sizeof(sbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0) |
1149 strcpy(sbuf, "invalid"); | 1191 strlcpy(sbuf, "invalid", sizeof(hbuf)); |
1150 Printf("\n%d bytes from %s to %s", cc, sbuf, 1151 rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr, 1152 dbuf, sizeof(dbuf)) 1153 : "?"); 1154 Printf(": icmp type %d (%s) code %d\n", type, pr_type(type), 1155 icp->icmp6_code); 1156 p = (u_int8_t *)(icp + 1); 1157#define WIDTH 16 --- 62 unchanged lines hidden (view full) --- 1220 struct msghdr *mhdr; 1221 int cc; 1222{ 1223 struct sockaddr_in6 *from = (struct sockaddr_in6 *)mhdr->msg_name; 1224 char hbuf[NI_MAXHOST]; 1225 1226 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1227 hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0) | 1192 Printf("\n%d bytes from %s to %s", cc, sbuf, 1193 rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr, 1194 dbuf, sizeof(dbuf)) 1195 : "?"); 1196 Printf(": icmp type %d (%s) code %d\n", type, pr_type(type), 1197 icp->icmp6_code); 1198 p = (u_int8_t *)(icp + 1); 1199#define WIDTH 16 --- 62 unchanged lines hidden (view full) --- 1262 struct msghdr *mhdr; 1263 int cc; 1264{ 1265 struct sockaddr_in6 *from = (struct sockaddr_in6 *)mhdr->msg_name; 1266 char hbuf[NI_MAXHOST]; 1267 1268 if (getnameinfo((struct sockaddr *)from, from->sin6_len, 1269 hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0) |
1228 strcpy(hbuf, "invalid"); | 1270 strlcpy(hbuf, "invalid", sizeof(hbuf)); |
1229 if (nflag) 1230 Printf(" %s", hbuf); 1231 else if (lflag) 1232 Printf(" %s (%s)", inetname((struct sockaddr *)from), hbuf); 1233 else 1234 Printf(" %s", inetname((struct sockaddr *)from)); 1235 1236 if (verbose) { --- 40 unchanged lines hidden (view full) --- 1277 static char line[NI_MAXHOST]; 1278 static char domain[MAXHOSTNAMELEN + 1]; 1279 static int first = 1; 1280 1281 if (first && !nflag) { 1282 first = 0; 1283 if (gethostname(domain, MAXHOSTNAMELEN) == 0 && 1284 (cp = index(domain, '.'))) | 1271 if (nflag) 1272 Printf(" %s", hbuf); 1273 else if (lflag) 1274 Printf(" %s (%s)", inetname((struct sockaddr *)from), hbuf); 1275 else 1276 Printf(" %s", inetname((struct sockaddr *)from)); 1277 1278 if (verbose) { --- 40 unchanged lines hidden (view full) --- 1319 static char line[NI_MAXHOST]; 1320 static char domain[MAXHOSTNAMELEN + 1]; 1321 static int first = 1; 1322 1323 if (first && !nflag) { 1324 first = 0; 1325 if (gethostname(domain, MAXHOSTNAMELEN) == 0 && 1326 (cp = index(domain, '.'))) |
1285 (void) strcpy(domain, cp + 1); | 1327 (void) strlcpy(domain, cp + 1, sizeof(domain)); |
1286 else 1287 domain[0] = 0; 1288 } 1289 cp = NULL; 1290 if (!nflag) { 1291 if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0, 1292 NI_NAMEREQD) == 0) { 1293 if ((cp = index(line, '.')) && 1294 !strcmp(cp + 1, domain)) 1295 *cp = 0; 1296 cp = line; 1297 } 1298 } 1299 if (cp) 1300 return cp; 1301 1302 if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0, 1303 NI_NUMERICHOST | niflag) != 0) | 1328 else 1329 domain[0] = 0; 1330 } 1331 cp = NULL; 1332 if (!nflag) { 1333 if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0, 1334 NI_NAMEREQD) == 0) { 1335 if ((cp = index(line, '.')) && 1336 !strcmp(cp + 1, domain)) 1337 *cp = 0; 1338 cp = line; 1339 } 1340 } 1341 if (cp) 1342 return cp; 1343 1344 if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0, 1345 NI_NUMERICHOST | niflag) != 0) |
1304 strcpy(line, "invalid"); | 1346 strlcpy(line, "invalid", sizeof(line)); |
1305 return line; 1306} 1307 1308void 1309usage() 1310{ 1311 (void)fprintf(stderr, | 1347 return line; 1348} 1349 1350void 1351usage() 1352{ 1353 (void)fprintf(stderr, |
1312"usage: traceroute6 [-dlnrv] [-f first_hop] [-m max_hops] [-p port#] \n" 1313" [-q nqueries] [-s src_addr] [-g gateway] [-w wait] host [data size]\n"); | 1354"usage: traceroute6 [-dlnrv] [-f firsthop] [-g gateway] [-m hoplimit] [-p port]\n" 1355" [-q probes] [-s src] [-w waittime] target [datalen]\n"); |
1314 exit(1); 1315} | 1356 exit(1); 1357} |