[Nagiosplug-devel] bug fixes for nagios plugins
Janos Mohacsi
mohacsi at niif.hu
Sun Jun 29 06:14:08 CEST 2003
On Fri, 27 Jun 2003, Jeremy T. Bouse wrote:
> I'm assuming your basing your "did not follow the standard
> (RFC3493) on section 6.1 of the RFC which reads:
>
> If the argument hints is not null, it refers to a structure
> containing input values that may direct the operation by providing
> options and by limiting the returned information to a specific socket
> type, address family and/or protocol. In this hints structure every
> member other than ai_flags, ai_family, ai_socktype and ai_protocol
> shall be set to zero or a null pointer. A value of AF_UNSPEC for
> ai_family means that the caller shall accept any address family. A
> value of zero for ai_socktype means that the caller shall accept any
> socket type. A value of zero for ai_protocol means that the caller
> shall accept any protocol. If hints is a null pointer, the behavior
> shall be as if it referred to a structure containing the value zero
> for the ai_flags, ai_socktype and ai_protocol fields, and AF_UNSPEC
> for the ai_family field.
>
> In which case even your patch does not follow the standard as
> you have completely removed the setting of ai_protocol by commenting it
> out... To be compliant I have added the initializing of ai_socktype per
> your example but did not comment out the ai_protocol declaration... This
> should be within revision 1.8 of the CVS code committed a few minutes
> ago... Although this ommission was in fact not per the RFC I don't
> believe it caused any problems as I had tested on FreeBSD 4.x, OpenBSD,
> Linux, Solaris 7, 8 & 9 without any adverse reactions to this as you
> would have noticed by the memset (...) line prior to setting the hints
> values that initialized all of hints to zero so ai_socktype would have
> been initialized to 0 which would have been compliant with the RFC...
> Now it is just more explicit and defines it based on protocol version...
Actually It caused the earlier version some problem on FreeBSD 4.x and
5.x:
If you had a hostname with IPv6 only DNS entry then this machine generated
some error messages like:
servname not supported for ai_socktype.
It was similar when you wanted to specify IPv6 address in numerical
format.
Thanks for adding my patch,
Kindest Regards,
Janos Mohacsi
>
> Regards,
> Jeremy
>
> On Fri, Jun 27, 2003 at 03:31:49PM +0200, Janos Mohacsi wrote:
> > 2. The IPv6 support in the plugins was broken. The hint structure
> > initialisation did not follow the standard (RFC3493). I made the unified
> > diff to fix the problem (see netutils.c.diff). I has been tested on
> > FreeBSD 4.x and 5.x.
> >
>
> > --- netutils.c.orig Fri Jun 27 14:32:52 2003
> > +++ netutils.c Fri Jun 27 14:34:35 2003
> > @@ -255,7 +255,8 @@
> >
> > memset (&hints, 0, sizeof (hints));
> > hints.ai_family = PF_UNSPEC;
> > - hints.ai_protocol = proto;
> > + hints.ai_socktype = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
> > + /*hints.ai_protocol = proto;*/
> >
> > snprintf (port_str, sizeof (port_str), "%d", port);
> > result = getaddrinfo (host_name, port_str, &hints, &res);
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
> _______________________________________________
> Nagiosplug-devel mailing list
> Nagiosplug-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
More information about the Devel
mailing list