Bug 1724416
| Summary: | [ncat] no output when sctp, but tcp/udp has | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | yiche <yiche> | |
| Component: | nmap | Assignee: | Pavel Zhukov <pzhukov> | |
| Status: | CLOSED WONTFIX | QA Contact: | qe-baseos-daemons | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 7.6 | CC: | jiji, pzhukov, thozza | |
| Target Milestone: | rc | Keywords: | Reproducer, TestCaseNeeded | |
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1784751 (view as bug list) | Environment: | ||
| Last Closed: | 2020-01-09 12:23:13 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
yiche
2019-06-27 03:54:16 UTC
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
I thought about the issue a bit more and looks there's room for improvement at least Will send patch upstream for review Red Hat Enterprise Linux version 7 entered the Maintenance Support 1 phase in August 2019. In this phase only qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. Other errata advisories may be delivered as appropriate. This bug has been reviewed by Support and Engineering representative and does not meet the inclusion criteria for Maintenance Support 1 phase. If this issue still exists in newer major version of Red Hat Enterprise Linux, it has been cloned there and work will continue in the cloned bug. For more information about Red Hat Enterprise Linux Lifecycle, please see https://access.redhat.com/support/policy/updates/errata#Maintenance_Support_1_Phase. Development Management has reviewed and declined this request. You may appeal this decision by using your Red Hat support channels, who will make certain the issue receives the proper prioritization with product and development management. https://www.redhat.com/support/process/production/#howto |