[Nagiosplug-devel] RFC: UDP checks

Jeremy T. Bouse jeremy+nagios at undergrid.net
Sun Jun 29 11:53:08 CEST 2003

	Looking into the problem with UDP checks (Bug #731467) I believe
I've found a flaw in design with both UDP check plugins (check_udp.c and
check_tcp.c symlink'd as check_udp)...

	The original check_udp just returns back errors stating there
was no data received from the host; while the newer symlink'd check_udp2
returns back OK whether it succeeded or failed... In trying to look for
differences I found that the check_tcp version just uses send() while
the older check_udp version calls process_udp_request() found in
netutils.c... In fact check_udp.c is apparently the only plugin I found
that uses process_udp_request()... I also found only 3 plugins using the
process_tcp_request() and only one that uses process_tcp_request2()...

	But even the process_udp_request(), process_tcp_request() and
process_tcp_request2() ultimately call process_request() which just does
a send using the socket descriptor returned from my_connect()...

	Which brings me to the conclusion that this may work fine for
TCP connections but UDP connection tests require something different...
The send() function according to man page is used only when the socket
is in a "connected" state... As UDP is a connection-less protocol I
think this may be the problem... Which may mean we need to re-work to
use sendto() or sendmsg() for UDP tests instead of send() and for
receiving use recvfrom() or recvmsg() instead of recv()... 

	At this point I believe both check_udp and check_udp2 (symlinked
to check_tcp) are both broken implimentations...


More information about the Devel mailing list