Bug 1243773

Summary: nc (nmap-ncat) does not support -z option
Product: [Fedora] Fedora Reporter: Jakub Vavra <jvavra>
Component: nmapAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 22CC: mhlavink, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-04 09:46:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jakub Vavra 2015-07-16 09:35:04 UTC
Description of problem:
nc no longer supports -z switch as before.

 -z      Specifies that nc should just scan for listening daemons, without
             sending any data to them.  It is an error to use this option in
             conjunction with the -l option.

This introduces random incompatibility (for example Bug 891109) as nc is used like in scripts to verify that port is open.
Nc is used as it is a tool that is usually present on the system and can be used by unprivileged user.


Version-Release number of selected component (if applicable):

nmap-ncat-2:6.47-2.fc22.x86_64 : Nmap's Netcat replacement

How reproducible:
always

Steps to Reproduce:
1. run nc -zv <machine> <port>


Actual results:
$ nc -zv localhost 2222
nc: invalid option -- 'z'
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.


Expected results:
$ nc -zv localhost 22
Connection to localhost 22 port [tcp/ssh] succeeded!

or 

$ nc -zv localhost 666
nc: connect to localhost port 666 (tcp) failed: Connection refused


Additional info:
Maybe, if the replacement for nc is is incomplete, until it is finished the original package should be put back at least as an optional package that can be installed and configured using update-alternatives.

Comment 1 Michal Hlavinka 2015-09-04 09:46:03 UTC
(In reply to Jakub Vavra from comment #0)
> Description of problem:
> nc no longer supports -z switch as before.
> 
>  -z      Specifies that nc should just scan for listening daemons, without
>              sending any data to them.  It is an error to use this option in
>              conjunction with the -l option.

This was discussed some time ago. This change won't be accepted upstream. If you want to test open ports, you should use nmap

> Additional info:
> Maybe, if the replacement for nc is is incomplete, until it is finished 

ncat is "finished", it is not a drop-in replacement and never will be

> the original package should be put back at least as an optional package that can
> be installed and configured using update-alternatives.

It does not depend on me. You'd have to find someone willing to maintain nc. Then I can remove the nc->ncat link so it won't conflict with it. I won't argue :)