Deleted Added
full compact
traceroute.c (216184) traceroute.c (220968)
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 216184 2010-12-04 14:19:27Z uqs $";
31 "$FreeBSD: head/contrib/traceroute/traceroute.c 220968 2011-04-23 13:07:35Z simon $";
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

--- 464 unchanged lines hidden (view full) ---

504 pe = getprotobyname(cp);
505 if (pe) {
506 if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0)
507 sockerrno = errno;
508 else if ((sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
509 sockerrno = errno;
510 }
511
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

--- 464 unchanged lines hidden (view full) ---

504 pe = getprotobyname(cp);
505 if (pe) {
506 if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0)
507 sockerrno = errno;
508 else if ((sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
509 sockerrno = errno;
510 }
511
512 setuid(getuid());
512 if (setuid(getuid()) != 0) {
513 perror("setuid()");
514 exit(1);
515 }
513
514#ifdef IPCTL_DEFTTL
515 {
516 int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL };
517 size_t sz = sizeof(max_ttl);
518
519 if (sysctl(mib, 4, &max_ttl, &sz, NULL, 0) == -1) {
520 perror("sysctl(net.inet.ip.ttl)");

--- 1270 unchanged lines hidden ---
516
517#ifdef IPCTL_DEFTTL
518 {
519 int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL };
520 size_t sz = sizeof(max_ttl);
521
522 if (sysctl(mib, 4, &max_ttl, &sz, NULL, 0) == -1) {
523 perror("sysctl(net.inet.ip.ttl)");

--- 1270 unchanged lines hidden ---