[Bug 178241] New: tcp.7 says SIOCOUTQ counts unsent bytes, but in actually counts unacknowledged bytes

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

 



https://bugzilla.kernel.org/show_bug.cgi?id=178241

            Bug ID: 178241
           Summary: tcp.7 says SIOCOUTQ counts unsent bytes, but in
                    actually counts unacknowledged bytes
           Product: Documentation
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: man-pages
          Assignee: documentation_man-pages@xxxxxxxxxxxxxxxxxxxx
          Reporter: njs@xxxxxxxxx
        Regression: No

tcp.7 says:

       SIOCOUTQ
              Returns the amount of unsent data in the socket send queue. [...]

I believe that this is incorrect, and that it actually returns the amount of
*unacknowledged* data in the socket send queue (i.e., unsent data + data that
has been sent, but for which we're still waiting for an ACK).

This can be confirmed by looking at the source, which does:

575                         answ = tp->write_seq - tp->snd_una;

http://lxr.free-electrons.com/source/net/ipv4/tcp.c#L568

here tp->snd_una is the boundary between acknowledged and unacknowledged data.
If it were reporting unsent data, it would need to use tp->snd_nxt instead.
(The diagram in RFC 793 may help visualize this:
https://tools.ietf.org/html/rfc793#page-20)

I discovered this while trying to figure out how TCP_NOTSENT_LOWAT works.
TCP_NOTSENT_LOWAT makes it so that a socket only becomes writeable if the
unsent data is under a certain threshold, yet SIOCOUTQ was reporting that I had
more unsent data than that, and yet the socket was still writeable... which
makes sense if SIOCOUTQ is not actually reporting the amount of unsent data
:-).

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux