NetBSD Problem Report #54429

From  Fri Aug  2 00:22:51 2019
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 8A2EF7A178
	for <>; Fri,  2 Aug 2019 00:22:51 +0000 (UTC)
Message-Id: <>
Date: Fri,  2 Aug 2019 00:22:50 +0000 (UTC)
Subject: nc(1) loses TCP urgent data
X-Send-Pr-Version: www-1.0

>Number:         54429
>Category:       bin
>Synopsis:       nc(1) loses TCP urgent data
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 02 00:25:00 +0000 2019
>Last-Modified:  Fri Aug 02 00:30:01 +0000 2019
>Originator:     Valery Ushakov
>Release:        NetBSD-8
nc(1) does not use SO_OOBINLINE and so it loses any TCP urgent data
sent by the peer.

TCP urgent data (MSG_OOB) is virtually unused, so there's no readily
available real-world test case.  Consider the following test server
in python (sorry, I'm lazy :)

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1);

s.bind(('', 12345))

while True:
    c, peer = s.accept()
    print "Connection from", peer[0] + ":" + str(peer[1])

    c.send('b', socket.MSG_OOB)


Now run nc(1) against it:

$ nc localhost 12345

and you can see that "b", sent as urgent data, is lost.


  setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &x, sizeof(x));

to set_common_sockopts() in netcat.c.  I'm not sure if we can just do
that for all address families.  Since it's at the socket level, it
should be just a no-op for those that don't support MSG_OOB, so it
should be ok to do it indiscriminately I think.

And we probably need to add POLLPRI along with POLLIN to the relevant
poll(2) calls.

From: Valery Ushakov <>
Subject: Re: bin/54429: nc(1) loses TCP urgent data
Date: Fri, 2 Aug 2019 03:29:19 +0300

 PS: In our tree only rlogin, telnet and ftp (that speaks telnet for
 its control connection) send urgent data.


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.