On Thu, Oct 03, 2013 at 02:03:08AM -0300, Rogério Brito wrote:
> I'm attaching (as compressed files) the output of running both
> `sudo strace mtr` and `sudo strace mtr --curses`.

That works. 

strace shows: 

// from mtr.c: 
  if ( ( net_preopen_result = net_preopen () ) ) {
                    fprintf( stderr, "mtr: unable to get raw sockets.\n" );
    exit( EXIT_FAILURE );
  }

ends with: 
  fcntl64(7, F_GETFD)                     = 0
  fcntl64(7, F_SETFD, FD_CLOEXEC)         = 0   


then mtr.c does: 

  /*  Now drop to user permissions  */
  if (setgid(getgid()) || setuid(getuid())) {
    fprintf (stderr, "mtr: Unable to drop permissions.\n");
    exit(1);
  }

  /*  Double check, just in case  */
  if ((geteuid() != getuid()) || (getegid() != getgid())) {
    fprintf (stderr, "mtr: Unable to drop permissions.\n");
    exit(1);
  }

and it shows in the strace:
getgid32()                              = 0
setgid32(0)                             = 0
getuid32()                              = 0
setuid32(0)                             = 0
geteuid32()                             = 0
getuid32()                              = 0
getegid32()                             = 0
getgid32()                              = 0

which works as designed.... 

And then the code does: 

  /* reset the random seed */
  srand (getpid());

time(NULL)                              = 1380776131

which should show up as a call to getpid, and not to "time". 
   srand (time (NULL)); 

is a very common call to initialize the random generator, but arguably
the getpid is better for mtr than the time variant.

I haven't touched this code in ages. (I had to think really hard to 
reproduce the choice for "getpid" as opposed to "time"). 

The thing is, I'd say that the getpid change is MUCH older than the
IPV6 support that you DO have.... So what codebase are you running?

OK. Cancel that. The getpid is apparently cached so won't show up in 
strace. 

much later: 

  time_t now = time(NULL);

happens, which is the time call. 

After that mtr should start adding/testing hosts etc. There could have
been a bug in there (which has been fixed in the current version!) 
that would no longer start mtr with the default of "localhost" if you
don't supply a hostname. So: 

have you tried:

  mtr www.google.com

?

If that works, it's a bug that has been fixed in the main codebase:
either work around it by supplying a hostname, or upgrade if you want.

(I personally think the default of "localhost" is untidy: cleanlyness
would require mtr to say: "no host to trace provided. Bye!" (or just
exit wihtout doing anything as it does in your case). However that
means that starting mtr from a menu in a gui without arguments would
make it close immediately.)

        Roger. 

-- 
** r.e.wo...@bitwizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to