[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: UDP socket tests useless
From: |
Jan-Henrik Haukeland |
Subject: |
Re: UDP socket tests useless |
Date: |
12 Aug 2002 10:56:21 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service) |
Nils Ohlmeier <address@hidden> writes:
> as i already wrote a few weeks ago to Jan-Henrik the udp socket connection
> test (without protocol test) is sadely useless.
Hmm I forgot about this. Probably suppressed it, unconsciously.
> In detail: if i'm not wrong a udp connection test like in the
> documentation ('port 53 use type udp') will create a udp socket with
> the gvien destination. If the creation of this socket was
> successful a connect call will be made on this socket. On a stream
> (tcp) socket this call will establish a connection to the
> destination (SYN, ACKSYN, ACK), but on a datagram (udp) socket this
> call won't make any network traffic.
Actually according to Stevens book, Unix Network Programming ch. 8.12
it will. If you call connect on a udp socket the unix kernel will
return an ICMP error on the first read if the UDP server is not
running.
> Finaly a select call will be made on the socket to look for any
> error. But because their was no network traffic on a udp socket
> until now, the select won't return an error.
You're absolutely right about the select, but since monit connect the
udp socket a simple read on the socket should in theory return an
error (ECONNREFUSED) if the server is not running. It should be
possible to add such a default test in monit (replacing the select
test for UDP sockets). If I find the time I will also have a lock into
the nmap code since this port scanner obviously can test if a UDP
server will answer (is running); with the following command (run as
root): nmap -sU localhost.
Or if you would like to give it a try, please do, since I'm quite
bussy at the moment :)
--
Jan-Henrik Haukeland