Bug 127528 - incorrect socket sndbuf accounting for multicast sockets with IP_MULTICAST_LOOP set
incorrect socket sndbuf accounting for multicast sockets with IP_MULTICAST_LO...
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Neil Horman
Brian Brock
Depends On:
Blocks: 123574
  Show dependency treegraph
Reported: 2004-07-09 10:49 EDT by Neil Horman
Modified: 2007-11-30 17:07 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-12-20 15:55:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
C++ test case to demonstrate sendto blocking failure (3.98 KB, text/plain)
2004-07-09 10:50 EDT, Neil Horman
no flags Details
patch to adjust socket buffer accounting. (1.03 KB, patch)
2004-07-09 10:59 EDT, Neil Horman
no flags Details | Diff

  None (edit)
Description Neil Horman 2004-07-09 10:49:36 EDT
Description of problem:
when sending fragmented packets over multicast sockets, if the
IP_MULTICAST_LOOP option is enabled, each skbuff is cloned and
fragmented.  The accounting for the sockets SNDBUF is preformed on
each fragment, but after the frame is transmitted the kfree_skb call
fails to preform the reverse accounting, since the cloned skbuffs are
not freed, only the top level skbuff representing the entire frame. 
Only after the socket is read from, clearing the received skbuff from
the receive queue, is the reverse accounting preformed.  This can lead
to inacurate sndbuf values, and if the socket is not read from often
enough, the user process using the socket can block indefinately on a
send(to/msg) call.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1) Remove iptables modules from the system (iptables can prematurely
free buffers to prevent queue backlog).

2) build and run the attached testcase (multicast_test.C).  Specify
when running a large packet size (I've been using 10000 bytes) so as
to incur fragmenting.  Also specify that IP_MUTLICAST_LOOP should be
set, and that the reader thread should never read.

Actual results:
After a few packets, the call to sendto will block forever, waiting
for available memory in the SNDBUF buffer.  This will not be made
available until the socket is read from

Expected results:
Socket sends only block until frames are transmitted, at which point
memory should be available in the send buffer.

Additional info:
Comment 1 Neil Horman 2004-07-09 10:50:10 EDT
Created attachment 101749 [details]
C++ test case to demonstrate sendto blocking failure
Comment 2 Neil Horman 2004-07-09 10:59:27 EDT
Created attachment 101751 [details]
patch to adjust socket buffer accounting.

This patch corrects this issue by moving socket layer accounting to the top
level skbuff.  By doing this all SNDBUF memory is released on the freeing of
the top level skbuff, which allows individual fragments to be cloned without
affecting the accounting.  I also checked, and this problem seems to present in
the 2.6 kernel as well, so this patch should probably be pushed there.
Comment 3 Ernie Petrides 2004-08-31 00:16:52 EDT
A fix for this problem has just been committed to the RHEL3 U4
patch pool this evening (in kernel version 2.4.21-20.1.EL).
Comment 4 John Flanagan 2004-12-20 15:55:36 EST
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.