NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/54429: nc(1) loses TCP urgent data

>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
>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.

Home | Main Index | Thread Index | Old Index