Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1784751

Summary: [ncat] no output when sctp, but tcp/udp has
Product: Red Hat Enterprise Linux 8 Reporter: Tomáš Hozza <thozza>
Component: nmapAssignee: Pavel Zhukov <pzhukov>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: jiji, pzhukov, qe-baseos-daemons, yiche
Target Milestone: rcKeywords: Reopened, Reproducer, TestBlocker, TestCaseNeeded
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1724416 Environment:
Last Closed: 2021-06-18 07:30:30 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 Tomáš Hozza 2019-12-18 09:11:02 UTC
+++ This bug was initially created as a clone of Bug #1724416 +++

Description of problem:
In this format:  
echo ncat --sctp -l 127.0.0.1 | bash
ncat no output for sctp, but tcp/udp has

Version-Release number of selected component (if applicable):
nmap-ncat-7.70-4.el8.x86_64
nmap-ncat-6.40-19.el7.x86_64
Both exists on RHEL7 and RHEL8

How reproducible:
always

Steps to Reproduce:
1.
# echo ncat -l 127.0.0.1 2000 |bash
abc
# echo ncat -u -l 127.0.0.1 2000 |bash
abc
# echo ncat --sctp -l 127.0.0.1 2000 |bash
#
Get nothing here!

2.
At another terminal
# ncat  127.0.0.1 2000 <<<'abc'
# ncat -u 127.0.0.1 2000 <<<'abc'
# ncat --sctp 127.0.0.1 2000 <<<'abc'

3.

Actual results:
# echo ncat --sctp -l 127.0.0.1 2000 |bash
This command returned but has no ouput.

Expected results:
ncat --sctp work as expected.

Additional info:
This issue affect our test script. Please fix it.

--- Additional comment from RHEL Program Management on 2019-06-27 05:54:18 CEST ---

Since this bug report was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Pavel Zhukov on 2019-06-27 10:44:45 CEST ---

** SELF NOTE **
SIGPIPE should be ignored in sctp mode as well as in dgram and stream modes

--- Additional comment from Pavel Zhukov on 2019-07-31 10:54:20 CEST ---

https://github.com/nmap/nmap/commit/811d6096e1e7f2380c7ab3a4ae098a8f997c81b7

--- Additional comment from Pavel Zhukov on 2019-07-31 13:54:24 CEST ---

This is not a bug in ncat.
Ncat adds stdin to select() and wait for ready FDs. In your case select() returns with [1a]
while "normal" execution doesn't return STDIN as ready [1b]

Thus ncat sees 0 input and returns [2]
This was done to properly handle protocols which don't support half-closed sockets like sctp [3]

I'd suggest to adjust your script not to proxy ncat input or redirect /dev/full to stdin
[1a]

[pid  3252] select(5, [0<pipe:[39940975]> 4<socket:[39941357]>], [], NULL, NULL) = 1 (in [0])
[pid  3252] read(0<pipe:[39940975]>, "", 8192) = 0
[1b]
select(5, [0 4], [], NULL, NULL)        = 1 (in [4])
recvfrom(4, "abc\n", 8192, 0, NULL, NULL) = 4
write(1, "abc\n", 4abc
)                    = 4
select(5, [0 4], [], NULL, NULL)        = 1 (in [4])
recvfrom(4, "", 8192, 0, NULL, NULL)    = 0
close(4)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

[2]             } else if (i == STDIN_FILENO) {
                    /* Read from stdin and write to all clients. */
                    rc = read_stdin();
                    if (rc == 0) {
                        if (o.proto != IPPROTO_TCP || (o.proto == IPPROTO_TCP && o.sendonly)) {
                            /* There will be nothing more to send. If we're not
                               receiving anything, we can quit here. */
                            return 0;
                        }
                        if (!o.noshutdown) shutdown_sockets(SHUT_WR);
                   

[3]
https://github.com/nmap/nmap/commit/811d6096e1e7f2380c7ab3a4ae098a8f997c81b7

--- Additional comment from Pavel Zhukov on 2019-07-31 15:27:23 CEST ---

I thought about the issue a bit more and looks there's room for improvement at least
Will send patch upstream for review

--- Additional comment from Pavel Zhukov on 2019-07-31 15:47:58 CEST ---

https://github.com/nmap/nmap/pull/1673/commits/63a10182c48ecdf46332ffbaea6aa6030097e37c

--- Additional comment from yiche on 2019-08-01 04:39:23 CEST ---

Thank you very much for investigate!

Comment 2 RHEL Program Management 2020-03-27 13:23:57 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.

Comment 14 RHEL Program Management 2021-06-18 07:30:30 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.