Bug 1014681

Summary: ncat with UDP seems working differently on ppc64 and s390x
Product: Red Hat Enterprise Linux 7 Reporter: Patrik Kis <pkis>
Component: nmapAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-18 09:35:50 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 Patrik Kis 2013-10-02 14:21:49 UTC
Description of problem:
This is maybe not the normal use case but it works as expected on x86_64 it just differs in ppc64 and s390x. See the reproducer below.

Version-Release number of selected component (if applicable):
nmap-ncat-6.40-2.el7

How reproducible:
always

Steps to Reproduce:
Have two terminals opened on the same machine (one client and one server):
SERVER:
# echo ServerSend |ncat -vl --udp 6666
Ncat: Version 6.40 ( http://nmap.org/ncat )
Ncat: Listening on :::6666
Ncat: Listening on 0.0.0.0:6666
Ncat: Connection refused.

CLIENT:
# echo ClientSend |ncat -4 --udp localhost 6666
#


Actual results:
The connection fails.

Expected results:

As on x86_64:

SERVER:
# echo ServerSend |ncat -vl --udp 6666
Ncat: Version 6.40 ( http://nmap.org/ncat )
Ncat: Listening on :::6666
Ncat: Listening on 0.0.0.0:6666
ClientSend


CLIENT:
# echo ClientSend |ncat -4 --udp localhost 6666
ServerSend


Additional info:

Comment 1 Michal Hlavinka 2013-10-17 14:58:38 UTC
Did you really get your expected results on x86_64? Because that (not this) would be bug.
ncat uses EOF as control mechanism, it will terminate ncat immediately and won't wait for remaining data neither it will process them. It's different behaviour from old nc.

What happens in your test:
server:
ncat listens for incomming udp packet together with "ServerSend\n<EOF>" waiting on its input

when you run client, it gets "ClientSend\n<EOF>" so it sends packet to server and terminates immediately. There is no time window for server's packet to reach client. 

Meanwhile server gets new UDP connection, so it checks input, finds "ServerSend\n" and sends it. Because client already exited, server prints connection refused. Because server finds also EOF, it won't process any (remaining) data from client and exits.

Comment 2 Patrik Kis 2013-10-18 09:22:53 UTC
I see, it quite makes sense. BTW, I tested again the whole "issue" and it seems that the behavior I expected appears only on virtual machines. On real x86_64 the behavior is the same as on pcc64 and s390x.
So the bug can be closed. Thanks for explanation. I will rewrite my test.