Bug 845075 - ncat: does not call shutdown(2) on EOF
ncat: does not call shutdown(2) on EOF
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: nmap (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michal Hlavinka
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: 879275
  Show dependency treegraph
 
Reported: 2012-08-01 12:32 EDT by Enrico Scholz
Modified: 2013-01-05 01:51 EST (History)
5 users (show)

See Also:
Fixed In Version: nmap-6.01-2.fc17
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 879275 (view as bug list)
Environment:
Last Closed: 2012-12-06 23:23:35 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2012-08-01 12:32:15 EDT
Description of problem:

Because ncat is going to replace nc:

Old 'nc' calls shutdown(2) when the corresponding site has been closed.  This makes data transfer very easy because both sites terminate automatically when all data have been sent. New 'ncat' does not shutdown the fds which causes the programs to stay forever:

--- new ---

$ nc -l 1234 > /tmp/foo         # program #1 / server

$ ncat `hostname` 1234          # program #2 / client
type-some-text
^D

---> neither program #1 nor #2 terminate


--- old ---

$ nc -l 1234 > /tmp/foo         # program #1 / server

$ nc `hostname` 1234            # program #2 / client
type-some-text
^D

--> program #1 and #2 terminate on EOF of client


(Note: examples use manually typed input; a more common example is something like

  nc `hostname` 1234 < some-file

which does not work with ncat anymore)


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

nmap-6.00-1.fc17.x86_64
Comment 1 Michal Hlavinka 2012-08-02 07:30:44 EDT
ncat does not call close nor shutdown on EOF. If you want it to terminate connection on EOF, use --send-only. Anyway, I can see it'd be nice if it called shutdown(fd, SHUT_WR) in the above case. I'll ask upstream for their opinion.
Comment 2 Enrico Scholz 2012-08-02 10:56:26 EDT
fwiw, in my use case, the server side reads the file completely over TCP, processes it and gives a status output to client.  With '--sent-only' the status output will be supressed and (yet more) worse, a broken pipe might be seen on server when client terminates the connection on stdin EOF instead of waiting for the server closing the connection.

E.g. server makes:

| timeout -t 600 cat > some-file
| echo "Processing file..."
| process-file
| echo "Done"
Comment 3 Michal Hlavinka 2012-09-19 11:31:57 EDT
upstream accepted the patch
Comment 4 Fedora Update System 2012-09-19 11:35:00 EDT
nmap-6.01-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/nmap-6.01-2.fc17
Comment 5 Fedora Update System 2012-09-19 11:35:13 EDT
nmap-6.01-6.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/nmap-6.01-6.fc18
Comment 6 Fedora Update System 2012-09-20 01:57:44 EDT
Package nmap-6.01-6.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing nmap-6.01-6.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-14386/nmap-6.01-6.fc18
then log in and leave karma (feedback).
Comment 7 Fedora Update System 2012-09-27 01:09:24 EDT
nmap-6.01-6.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Tomas Mraz 2012-11-22 08:10:51 EST
This is still not fully fixed. The EOF handling works from client to server but not the other way. That is:

$ nc -l 1234
Type something
^D

$ nc localhost 1234 > data

Does not terminate too.

if I replace the listening netcat with the original (not from nmap) one, it will terminate fine regardless of whether the client side is original or nmap netcat.
Comment 9 Fedora Update System 2012-11-29 07:20:09 EST
nmap-6.01-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/nmap-6.01-3.fc17
Comment 10 Fedora Update System 2012-11-29 07:20:24 EST
nmap-6.01-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/nmap-6.01-2.fc16
Comment 11 Fedora Update System 2012-11-29 07:20:35 EST
nmap-6.01-8.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/nmap-6.01-8.fc18
Comment 12 Fedora Update System 2012-11-30 01:42:11 EST
Package nmap-6.01-8.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing nmap-6.01-8.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-19398/nmap-6.01-8.fc18
then log in and leave karma (feedback).
Comment 13 Fedora Update System 2012-12-06 23:23:38 EST
nmap-6.01-8.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 14 Fedora Update System 2012-12-15 13:03:13 EST
nmap-6.01-3.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2013-01-05 01:51:11 EST
nmap-6.01-2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.