|
Description
|
udptest() in usr/src/cmd/cmd-inet/usr.bin/nc/netcat.c is accompanied with curious comment (which comes from the original code):
854 /*
855 * udptest()
856 * Do a few writes to see if the UDP port is there.
857 * XXX - Better way of doing this? Doesn't work for IPv6.
858 * Also fails after around 100 ports checked.
859 */
It's indeed not very reliable as the nc(1) man page suggests:
NOTES
UDP port scans always succeeds, that is, reports the port as
open, rendering the -uz combination of flags relatively use-
less.
It'd be probably too much to incorporate UDP port scanning techniques [*] but
the statements about IPv6 and 100 ports should be verified and fixed (one way or the other - in code or the comment itself).
[*] That said, the XXXX pattern in udptest() could be made configurable.
|