[Bug 1772014] [NEW] netcat-openbsd does not allow setting source port

Aki Rossi aki.rossi at iki.fi
Fri May 18 12:41:49 UTC 2018


Public bug reported:

When connecting to a remote host, both the command-line help and man-
page state that specifying `-p` will set the local port number. However,
when I actually attempt to do it, only the usage text is printed:

$ nc.openbsd -p 12345 localhost 12345
usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
   [-m minttl] [-O length] [-P proxy_username] [-p source_port]
   [-q seconds] [-s source] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout]
   [-X proxy_protocol] [-x proxy_address[:port]] 	  [destination] [port]

This appears to be caused by an erroneous check on line 541 of netcat.c,
introduced by `misc-failures-and-features.patch`. If I remove the check
or undo the patch completely, the source port is set correctly, but
remains bound after I close the connection. Meanwhile, netcat-
traditional works as expected.

** Affects: netcat-openbsd (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  When connecting to a remote host, both the command-line help and man-
  page state that specifying `-p` will set the local port number. However,
  when I actually attempt to do it, only the usage text is printed:
  
-     $ nc.openbsd -p 12345 localhost 12345
-     usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
-     	  [-m minttl] [-O length] [-P proxy_username] [-p source_port]
-     	  [-q seconds] [-s source] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout]
-     	  [-X proxy_protocol] [-x proxy_address[:port]] 	  [destination] [port]
+ $ nc.openbsd -p 12345 localhost 12345
+ usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
+    [-m minttl] [-O length] [-P proxy_username] [-p source_port]
+    [-q seconds] [-s source] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout]
+    [-X proxy_protocol] [-x proxy_address[:port]] 	  [destination] [port]
  
  This appears to be caused by an erroneous check on line 541 of netcat.c,
  introduced by `misc-failures-and-features.patch`. If I remove the check
  or undo the patch completely, the source port is set correctly, but
  remains bound after I close the connection. Meanwhile, netcat-
  traditional works as expected.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netcat-openbsd in Ubuntu.
https://bugs.launchpad.net/bugs/1772014

Title:
  netcat-openbsd does not allow setting source port

Status in netcat-openbsd package in Ubuntu:
  New

Bug description:
  When connecting to a remote host, both the command-line help and man-
  page state that specifying `-p` will set the local port number.
  However, when I actually attempt to do it, only the usage text is
  printed:

  $ nc.openbsd -p 12345 localhost 12345
  usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
     [-m minttl] [-O length] [-P proxy_username] [-p source_port]
     [-q seconds] [-s source] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout]
     [-X proxy_protocol] [-x proxy_address[:port]] 	  [destination] [port]

  This appears to be caused by an erroneous check on line 541 of
  netcat.c, introduced by `misc-failures-and-features.patch`. If I
  remove the check or undo the patch completely, the source port is set
  correctly, but remains bound after I close the connection. Meanwhile,
  netcat-traditional works as expected.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netcat-openbsd/+bug/1772014/+subscriptions



More information about the foundations-bugs mailing list