traceroute.c (176428) | traceroute.c (196475) |
---|---|
1/* 2 * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000 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, 1997, 1998, 1999, 2000\n\ 25The Regents of the University of California. All rights reserved.\n"; 26#if 0 27static const char rcsid[] = 28 "@(#)$Id: traceroute.c,v 1.68 2000/12/14 08:04:33 leres Exp $ (LBL)"; 29#endif 30static const char rcsid[] = | 1/* 2 * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000 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, 1997, 1998, 1999, 2000\n\ 25The Regents of the University of California. All rights reserved.\n"; 26#if 0 27static const char rcsid[] = 28 "@(#)$Id: traceroute.c,v 1.68 2000/12/14 08:04:33 leres Exp $ (LBL)"; 29#endif 30static const char rcsid[] = |
31 "$FreeBSD: head/contrib/traceroute/traceroute.c 176428 2008-02-20 23:29:53Z rpaulo $"; | 31 "$FreeBSD: head/contrib/traceroute/traceroute.c 196475 2009-08-23 17:00:16Z ume $"; |
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 --- 1432 unchanged lines hidden (view full) --- 1472 && ntohs(ptr[1]) == port + seq); 1473} 1474 1475void 1476print(register u_char *buf, register int cc, register struct sockaddr_in *from) 1477{ 1478 register struct ip *ip; 1479 register int hlen; | 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 --- 1432 unchanged lines hidden (view full) --- 1472 && ntohs(ptr[1]) == port + seq); 1473} 1474 1475void 1476print(register u_char *buf, register int cc, register struct sockaddr_in *from) 1477{ 1478 register struct ip *ip; 1479 register int hlen; |
1480 char addr[INET_ADDRSTRLEN]; |
|
1480 1481 ip = (struct ip *) buf; 1482 hlen = ip->ip_hl << 2; 1483 cc -= hlen; 1484 | 1481 1482 ip = (struct ip *) buf; 1483 hlen = ip->ip_hl << 2; 1484 cc -= hlen; 1485 |
1486 strlcpy(addr, inet_ntoa(from->sin_addr), sizeof(addr)); 1487 |
|
1485 if (as_path) | 1488 if (as_path) |
1486 Printf(" [AS%d]", as_lookup(asn, &from->sin_addr)); | 1489 Printf(" [AS%u]", as_lookup(asn, addr, AF_INET)); |
1487 1488 if (nflag) | 1490 1491 if (nflag) |
1489 Printf(" %s", inet_ntoa(from->sin_addr)); | 1492 Printf(" %s", addr); |
1490 else | 1493 else |
1491 Printf(" %s (%s)", inetname(from->sin_addr), 1492 inet_ntoa(from->sin_addr)); | 1494 Printf(" %s (%s)", inetname(from->sin_addr), addr); |
1493 1494 if (verbose) 1495 Printf(" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); 1496} 1497 1498/* 1499 * Checksum routine for UDP and TCP headers. 1500 */ --- 298 unchanged lines hidden --- | 1495 1496 if (verbose) 1497 Printf(" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); 1498} 1499 1500/* 1501 * Checksum routine for UDP and TCP headers. 1502 */ --- 298 unchanged lines hidden --- |