traceroute.c (77816) | traceroute.c (98709) |
---|---|
1/* 2 * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 14 unchanged lines hidden (view full) --- 23static const char copyright[] = 24 "@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996\n\ 25The Regents of the University of California. All rights reserved.\n"; 26#if 0 27static const char rcsid[] = 28 "@(#)$Header: traceroute.c,v 1.43 96/09/27 20:08:10 leres Exp $ (LBL)"; 29#endif 30static const char rcsid[] = | 1/* 2 * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 14 unchanged lines hidden (view full) --- 23static const char copyright[] = 24 "@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996\n\ 25The Regents of the University of California. All rights reserved.\n"; 26#if 0 27static const char rcsid[] = 28 "@(#)$Header: traceroute.c,v 1.43 96/09/27 20:08:10 leres Exp $ (LBL)"; 29#endif 30static const char rcsid[] = |
31 "$FreeBSD: head/contrib/traceroute/traceroute.c 77816 2001-06-06 16:12:59Z ru $"; | 31 "$FreeBSD: head/contrib/traceroute/traceroute.c 98709 2002-06-23 21:54:18Z robert $"; |
32#endif 33 34/* 35 * traceroute host - trace the route ip packets follow going to "host". 36 * 37 * Attempt to trace the route an ip packet would follow to some 38 * internet host. We find out intermediate hops by launching probe 39 * packets with a small ttl (time to live) then listening for an --- 861 unchanged lines hidden (view full) --- 901 size_t nfds; 902 struct timeval now, wait; 903 struct timezone tz; 904 register int cc = 0; 905 register int error; 906 int fromlen = sizeof(*fromp); 907 908 nfds = howmany(sock + 1, NFDBITS); | 32#endif 33 34/* 35 * traceroute host - trace the route ip packets follow going to "host". 36 * 37 * Attempt to trace the route an ip packet would follow to some 38 * internet host. We find out intermediate hops by launching probe 39 * packets with a small ttl (time to live) then listening for an --- 861 unchanged lines hidden (view full) --- 901 size_t nfds; 902 struct timeval now, wait; 903 struct timezone tz; 904 register int cc = 0; 905 register int error; 906 int fromlen = sizeof(*fromp); 907 908 nfds = howmany(sock + 1, NFDBITS); |
909 if ((fdsp = malloc(nfds)) == NULL) | 909 if ((fdsp = malloc(nfds * sizeof(fd_mask))) == NULL) |
910 err(1, "malloc"); | 910 err(1, "malloc"); |
911 memset(fdsp, 0, nfds); | 911 memset(fdsp, 0, nfds * sizeof(fd_mask)); |
912 FD_SET(sock, fdsp); 913 914 wait.tv_sec = tp->tv_sec + waittime; 915 wait.tv_usec = tp->tv_usec; 916 (void)gettimeofday(&now, &tz); 917 tvsub(&wait, &now); 918 if (wait.tv_sec < 0) { 919 wait.tv_sec = 0; --- 383 unchanged lines hidden --- | 912 FD_SET(sock, fdsp); 913 914 wait.tv_sec = tp->tv_sec + waittime; 915 wait.tv_usec = tp->tv_usec; 916 (void)gettimeofday(&now, &tz); 917 tvsub(&wait, &now); 918 if (wait.tv_sec < 0) { 919 wait.tv_sec = 0; --- 383 unchanged lines hidden --- |