Skip to contentSkip to conversation

New: tcp.7 says SIOCOUTQ counts unsent bytes, but in actually counts unacknowledged bytes

Bug 178241 bugzilla-daemon-590EEB7GvNiWaY/[email protected] 1 participant 1 message Oct 18, 2016 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

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-ztI5WcYan/[email protected]
Reporter: [email protected]
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 :-).

Signature · 6 lines
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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html