[Nagiosplug-devel] bug fixes for nagios plugins
Jeremy T. Bouse
jeremy+nagios at undergrid.net
Fri Jun 27 11:54:03 CEST 2003
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...
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);
More information about the Devel
mailing list