monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: monit net.c


From: Jan-Henrik Haukeland
Subject: Re: monit net.c
Date: Mon, 20 Oct 2003 02:25:48 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux)

Martin Pala <address@hidden> writes:

> Hm,
>
> i found the place where the problem occures, but i don't understand
> it. It happens if you use hostname, which is alias of the real
> name. For example:
>
> www.underground.cz ... is alias for technomat.underground.cz
>
> If you use IP address (81.31.2.202) or its real name
> (technomat.underground.cz) ping test woks good.
>
> The problem is caused in icmp_echo() function (net.c) in
> gethostbyname(hostname). If alias is used it is resolved to bad
> address (probably gethostbyname error?)
>
> Any ideas?

Nice detective work :) I think you are right, something is wrong with
gethostbyname() and DNS. There was recently a new bind release that
created some problems, maybe there are something there? Probably not
since standard ping works, still something is wrong here. I tried to
test the h_errno variable and, yep, it flags that there is an error:

  h_errno= 0;
  hp= gethostbyname(hostname);
  switch(h_errno) {
  case HOST_NOT_FOUND:
  case NO_ADDRESS:
  case NO_RECOVERY:
  case TRY_AGAIN:
      printf("NAME ERROR: %s\n", hstrerror(h_errno));
  }

Result: NAME ERROR: Unknown host (I still get a value for hp though,
strange)

I tried to rewrite using getaddrinfo(), which as another more modern
interface to DNS, but with the same problem. But why in Gods name does
ping(8) work without problems? I'll continue to debug this into the
night...


> Martin
>
> Jan-Henrik Haukeland wrote:
>
>>CVSROOT:      /cvsroot/monit
>>Module name:  monit
>>Branch:       
>>Changes by:   Jan-Henrik Haukeland <address@hidden>   03/10/18 12:46:35
>>
>>Modified files:
>>      .              : net.c Log message:
>>      Adding a guard against interrupt. It's strange though, I can ping some
>>      hosts but many I cannot ping (i.e. get a reply from) from monit but
>>      the standard ping program can. I'm wondering if there is something
>>      wrong in how the icmp package is built? Martin, what do you think?
>>
>>CVSWeb URLs:
>>http://savannah.gnu.org/cgi-bin/viewcvs/monit/monit/net.c.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
>>
>>
>>
>>_______________________________________________
>>monit-dev mailing list
>>address@hidden
>>http://mail.nongnu.org/mailman/listinfo/monit-dev

-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]