Wind River Support Network

HomeDefectsLIN8-1178
Not to be fixed

LIN8-1178 : Parameter "-w" of nc.netcat does not work

Created: Oct 20, 2015    Updated: Apr 19, 2018
Resolved Date: Apr 17, 2018
Found In Version: 8.0
Severity: Standard
Applicable for: Wind River Linux 8
Component/s: Userspace

Description

Environment
======================
Requirement No.: N/A
Peer Reviewer: Hongjun Yang
WRLinux Version: 8.0.0.0
Workbench Version: N/A
Binary/FS From: N/A
BSP/Configuration: intel-x86-64+glibc-std+standard

HOST OS:

Log location
======================
N/A


7. Symptom Details
****************************

Problem Description
======================
In help info of nc.netcat
  -w, --wait=SECS            timeout for connects and final net reads

on wrlinux:
nc -w 60 -u -v <ip addr of another host> 8001
Use netstat to get the port number which used by nc
netstat -apn | grep nc

on ubuntu:
nc -u -p 8001 <ip addr of wrlinux> <port number of nc on wrlinux>

Now, input something on ubuntu and press enter, you will get the same word on wrlinux.
Stop nc by "Ctrl+c" on ubuntu, wait 60 seconds, the nc on wrlinux should be terminated
by itself.  But now, nc on wrlinux will hang there except use "ctrl+c"

Also tried netcat-openbsd, it will not hang, but "-w" also does not work, the nc command
will terminate immediately without waiting.

Expected Behavior
======================
if set "-w 60", and there are not connects and final net reads, the nc on wrlinux should be terminated by itself after 60s

Observed Behavior
======================
On wrlinux:
root@SDP_Wildcat_Pass-3-C1:~# nc -w 60 -u -v 128.224.162.158 8001
aaa

root@SDP_Wildcat_Pass-3-C1:~# netstat -apn | grep nc
udp        0      0 128.224.167.90:50153    128.224.162.158:8001 ESTABLISHED 7326/nc
unix  2      [ ACC ]     STREAM     LISTENING     28756 1272/master         private/bounce
unix  3      [ ]         STREAM     CONNECTED     58474 865/irqbalance

On ubuntu:
cxu@cxu-OptiPlex-9010:~$ nc -u -p 8001 128.224.167.90 50153
aaa
^C
cxu@cxu-OptiPlex-9010:~$

Test netcat-openbsd
root@Romley-EP-Ivy-Refresh-1:~# rpm -ivh libbsd0-0.7.0-r0.0.corei7_64.rpm
Preparing... ########################################### [100%]
   1:libbsd0 ########################################### [100%]
root@Romley-EP-Ivy-Refresh-1:~# rpm -ivh netcat-openbsd-1.105-r0.0.corei7_64.rpm
Preparing... ########################################### [100%]
   1:netcat-openbsd ########################################### [100%]
update-alternatives: Linking /usr/bin/nc to /usr/bin/nc.netcat
root@Romley-EP-Ivy-Refresh-1:~#
root@Romley-EP-Ivy-Refresh-1:~# nc.netcat-openbsd -w 60 -u -v 128.224.162.158 8001
root@Romley-EP-Ivy-Refresh-1:~# nc.netcat-openbsd -w 60 -u -v 128.224.162.158 8001
root@Romley-EP-Ivy-Refresh-1:~# nc.netcat-openbsd -w 60 -u -v 128.224.162.158 8001 

Steps to Reproduce

See descriptions for detail 
Live chat
Online