aboutsummaryrefslogtreecommitdiff
path: root/plugins-root/check_icmp.c
AgeCommit message (Collapse)Author
2022-11-29check_icmp: fix parsing help/version long optionsGravatar Aksel Sjögren
Fix parsing of the long options --help and --version. The special handling must be done before calling getopt(). This fixes erroneous output like: ./check_icmp --version ./check_icmp: invalid option -- '-' ./check_icmp: invalid option -- 'e' ./check_icmp: invalid option -- 'r' ./check_icmp: invalid option -- '-' ./check_icmp: invalid option -- 'e' ./check_icmp: invalid option -- 'r' Signed-off-by: Aksel Sjögren <asjogren@itrsgroup.com>
2022-07-14Set msg_namelen to the size of the sockaddr struct for the appropriate ↵Gravatar eriksejr
address family and not sockaddr_storage (#1771) Co-authored-by: Erik Sejr <eriks@ssimicro.com> Co-authored-by: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
2022-03-15check_icmp: buffer offerflow (#1733)Gravatar Lorenz
* Fix different overflows * Less includes * Add testcases * Remove unused variable * Remove unused and commented includes
2022-01-29- delay set_source_ip() until address_family is detectedGravatar ghciv6
- add a test to check '-s'
2021-11-24More wrong printf formattingGravatar RincewindsHat
2021-11-24Fix CodeQL checksGravatar RincewindsHat
2021-11-15check_icmp: Fix pkt perfdata in check_host modeGravatar Aksel Sjögren
Add missing "warn" threshold field in "pkt" perfdata output. Perfdata should be interpreted as; 'label'=value[UOM];[warn];[crit];[min];[max] With one field missing, the hardcoded min value '0' ended up in the "crit" field, making applications interpreting the perfdata thining that critical threshold is always exceeded. Signed-off-by: Aksel Sjögren <asjogren@itrsgroup.com>
2020-12-19docs: fix simple typo, conspicuosly -> conspicuouslyGravatar Tim Gates
There is a small typo in plugins-root/check_icmp.c. Should read `conspicuously` rather than `conspicuosly`.
2018-12-10check_icmp: Do not overwrite -4,-6 on lookupGravatar Jacob Hansen
In case we needed to do a lookup, we previously overwrote the address_family to IPv6, even if we supplied -4 as a cmd line argument. This commit should ensure the cmd line argument is always followed. Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-10check_icmp: emit error if multiple protocol versionGravatar Jacob Hansen
As we do not support checking both IPv4 and IPv6 hosts in one execution we emit an error if multiple protocol versions are defined in the cmd line args. Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-10check_icmp: move opts string into a variableGravatar Jacob Hansen
This commit moves the opts string into a variable as it is now used twice. Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07check_icmp: Correctly set address_family on lookupGravatar Jacob Hansen
If a hostname is supplied instead of an IP address, the automatic address family detection would fail to correctly set the IP protocol version (it would always be IPv6). We now supply AF_UNSPEC to getaddrinfo, which should then return the correct address family in the result. Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07check_icmp: removed outcommented codeGravatar Jacob Hansen
Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07check_icmp: process protocol version args firstGravatar Jacob Hansen
Detection of protocol version is in the previous patch implemented in the add_target() function, which is called when adding the -H command line argument. That means that if a protocal version argument (-4, -6) is added after the -H then the protocol version might be incorrectly set. This patch ensures that we first process the protocol version arguments, and then we process the rest of the arguments. Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07check_icmp: Automatically detect IP protocolGravatar Jacob Hansen
This patch automatically detects whether the protocol version is IPv4 or IPv6 All credits to: https://github.com/ghciv6 Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07Fixed parameter handling after 01efbb2183d49c5082598d4799788fc385342f28Gravatar Lars Michelsen
2018-12-07check_icmp: Add IPv6 supportGravatar Lars Michelsen
This commit adds IPv6 capabilities to check_icmp. It is now possible to specify the address family using the arguments -4 (default) or -6. To make the change possible we had to move the argument parsing previous to creating the socket to be able to create it with the correct address family. This commit also fixes some gcc 4.9.2 compiler warnings. It has been tested with several current linux distributions (debian, ubuntu, rh, sles). This commit fixes monitoring-plugins/monitoring-plugins#1291
2017-01-10Apply another spelling fixGravatar Holger Weiss
2016-12-01Spelling fixes suggested by lintianGravatar Jan Wagner
2015-10-04use unknown exit code for help/version in plugins-root as wellGravatar Sven Nierlein
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-01-29make use of MSG_CONFIRM optionalGravatar Sven Nierlein
since MSG_CONFIRM is a linux thing and only available on linux kernels >= 2.3.15, see send(2)
2014-12-02check_icmp: Cast size_t values for printf(3)Gravatar Holger Weiss
Convert size_t values to unsigned long for printf(3) in order to maximize portability.
2014-11-28check_icmp: Fix a few type errorsGravatar Holger Weiss
2014-11-28Don't mix variable declarations and codeGravatar Holger Weiss
We still support pre-C99 compilers.
2014-11-28Use kernel reception time on ICMP packets to compute rtt.Gravatar Matthieu Kermagoret
This commit uses the SO_TIMESTAMP feature of setsockopt to fetch kernel reception time of ICMP packets. This avoids invalid computations of rtt on machines with heavy load and/or heavy network traffic.
2014-07-06check_icmp/check_dhcp: disable check, if we are rootGravatar Jan Wagner
As it is possible to use capabilities(7) on linux or solaris privileges for example, it is not necessary in all cases to have those binaries making use of setuid.
2014-01-21Capitalize "Monitoring Plugins"Gravatar Holger Weiss
"Monitoring Plugins" is a name.
2014-01-20Capitalize "Monitoring" when it's the first wordGravatar Holger Weiss
2014-01-19Project rename initial commit.Gravatar Monitoring Plugins Development Team
This is an initial take at renaming the project to Monitoring Plugins. It's not expected to be fully complete, and it is expected to break things (The perl module for instance). More testing will be required before this goes mainline.
2013-09-04check_icmp: Minor whitespace/indentation fixesGravatar Holger Weiss
2013-09-04check_icmp: Support "--help" and "--version"Gravatar Holger Weiss
Let check_icmp provide "--help" and "--version" flags (in addition to "-h" and "-V"), just as the other plugins do.
2011-04-28check_host: Allocate a large-enough buffer for the host table.Gravatar Sebastian Harl
When specifying a host-name on the command line, each of its IPs is added to the host table (and each one is pinged). So, the buffer has to be large enough to hold all of the respective host objects. (argc - 1) only fits hosts with a single IP. Thanks to Max Kosmach <max@tcen.ru> for reporting this in Debian bug #623702.
2010-04-22Add newline after "Usage:" in --helpGravatar Thomas Guyot-Sionnest
2010-04-21Standardize the extra-opts notesGravatar Thomas Guyot-Sionnest
2010-04-14Fix translations when extra-opts aren't enabledGravatar Thomas Guyot-Sionnest
Bug #2832884 reported problem with translations outputting pot file headers. This is caused by "" matching the header of the translation files. This patch moves gettext macros inside utils macros and update some french translations.
2009-10-15Set proper network byte order for icmp_id and icmp_seq in icmp packetsGravatar Thomas Guyot-Sionnest
2009-10-15Increment per-host sequence in check_icmpGravatar Thomas Guyot-Sionnest
2009-06-14Fixed error in rtt/rta calculation in case of system clock problemsGravatar Matthias Eble
Time differences are now set to 0 in case of backward timejumps so there are no wrap-around problems any more. The RTA calculation hopefully gets a more accurate value in these cases also.
2009-06-02Don't use the plain char type for data buffersGravatar Holger Weiss
Buffers which are used for holding arbitrary data should be referenced using pointers to void and accessed using pointers to unsigned char. Signed-off-by: Holger Weiss <holger@zedat.fu-berlin.de>
2009-06-01Fixed check_icmp compiler warnings by including float.hGravatar Matthias Eble
Self defined DBL_MAX caused compiler warnings. Now float.h which defines DBL_MAX is included.
2009-06-01Fixed --help output for warn and critical thresholds (sf.net #2796624, ↵Gravatar Matthias Eble
debian #530553) check_icmp wrongly calculated the current thresholds in --help output.
2008-11-23Removing CVS/SVN tags and replacing with git-based versioningGravatar Thomas Guyot-Sionnest
For contrib/, full tags have been imported from subversion git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-19Bulk EOL cleanupGravatar Thomas Guyot-Sionnest
$ git diff --ignore-space-change|diffstat 0 files changed git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2087 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-07check_icmp now reports min and max round trip time perfdata (Steve Rader)Gravatar Thomas Guyot-Sionnest
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2073 f882894a-f735-0410-b71e-b25c423dba1c
2008-08-08Typo in --help outputGravatar Thomas Guyot-Sionnest
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2029 f882894a-f735-0410-b71e-b25c423dba1c
2008-07-28-b option now specifies ICMP data bytes instead of packet sizeGravatar Matthias Eble
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2027 f882894a-f735-0410-b71e-b25c423dba1c
2008-07-17Add support for packet size modification (-b)Gravatar Matthias Eble
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2026 f882894a-f735-0410-b71e-b25c423dba1c
2008-05-07Added support for --extra-opts in all C plugins (disabled by default, see ↵Gravatar Thomas Guyot-Sionnest
configure --help) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-29--help output cleanup (plus removal of spaces on blank lines)Gravatar Thomas Guyot-Sionnest
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1985 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-31Bump plugins-root/ to GPLv3Gravatar Thomas Guyot-Sionnest
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1920 f882894a-f735-0410-b71e-b25c423dba1c