[Nagiosplug-devel] [ nagiosplug-Bugs-1894850 ] check_ping: incorrectly parses ping6 output

SourceForge.net noreply at sourceforge.net
Fri Oct 15 15:09:47 CEST 2010


Bugs item #1894850, was opened at 2008-02-16 10:57
Message generated for change (Comment added) made by webcompas
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1894850&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parsing problem
Group: Release (specify)
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Matej Vela (vela)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_ping: incorrectly parses ping6 output

Initial Comment:
Plugin Version:
    1.4.11, HEAD
Plugin Name:
    check_ping
Plugin Commandline showing issues:
    check_ping -H [invalid-ipv6-address] -w 5000,100% -c 5000,100% -p 1
Operating System:
    Debian GNU/Linux 4.0 (etch)

Debian's ping6 may produce output in the following format:

    3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2009ms

There's a corresponding pattern in check_ping.c:450:

    "%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss"

but the pattern in check_ping.c:448 matches first:

    "%*d packets transmitted, %*d received, %d%% loss, time"

because sscanf interprets "+3" as a match for "%d".  Although the rest
of the pattern doesn't match, the number of successful assignments
(and thus the return value of sscanf) is still 1.

A simple way to make sure the whole pattern matches is to add a "%n"
specifier at the end, which will assign the number of characters
matched by that point.  (The same trick is used in check_http.c.)
There seems to be some confusion whether "%n" affects the return value
of sscanf, so it's safer to check the assigned number of characters.

Patch attached.


----------------------------------------------------------------------

Comment By: WebComPas (webcompas)
Date: 2010-10-15 15:09

Message:
I also need "check_ping" to work correctly with ping6 on debian. The
attached fix seems to work, so where is the problem to include this patch?

----------------------------------------------------------------------

Comment By: Matija Nalis (mnalis)
Date: 2010-08-12 16:17

Message:
Any chance of this fix being implemented? It's been sitting here for years
now :-(
BTW, it has also been reported at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514588 if more info is
needed

----------------------------------------------------------------------

Comment By: Matija Nalis (mnalis)
Date: 2009-02-09 11:27

Message:
has there been any luck with integrating this patch to nagios-plugins ?
It does not seem to be getting any activity.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1894850&group_id=29880




More information about the Devel mailing list