From 45705f4983bc0fc7155ad092428cb9e2157012a9 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 31 Mar 2006 02:09:36 -0800 Subject: [PATCH] --- yaml --- r: 24959 b: refs/heads/master c: c08e49611a8b4e38a75bf217e1029a48faf10b82 h: refs/heads/master i: 24957: 7ea0f563487f5acd2572fc49f5eec84ecb7ddd37 24955: bb736eb9f72fd274f569d11e76415385050c9247 24951: 7c07c0df47386f27ade60cc92fbca7c3f2bbac9e 24943: ba2e061f082083353b810009c3905619255c9b95 24927: cb18bfd508cb5e2ac49edfdb30fee83db1b071c2 24895: aed9b2c133fda3b9cd3e687859a1d77cfe873563 24831: f349d84973f205a3dc6ba070b5932a9fa98733ef v: v3 --- [refs] | 2 +- trunk/net/core/sock.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index a48fc0842297..91cb5805b0b2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 56079431b6ba163df8ba26b3eccc82379f0c0ce4 +refs/heads/master: c08e49611a8b4e38a75bf217e1029a48faf10b82 diff --git a/trunk/net/core/sock.c b/trunk/net/core/sock.c index a96ea7dd0fc1..ed2afdb9ea2d 100644 --- a/trunk/net/core/sock.c +++ b/trunk/net/core/sock.c @@ -385,7 +385,21 @@ int sock_setsockopt(struct socket *sock, int level, int optname, val = sysctl_rmem_max; set_rcvbuf: sk->sk_userlocks |= SOCK_RCVBUF_LOCK; - /* FIXME: is this lower bound the right one? */ + /* + * We double it on the way in to account for + * "struct sk_buff" etc. overhead. Applications + * assume that the SO_RCVBUF setting they make will + * allow that much actual data to be received on that + * socket. + * + * Applications are unaware that "struct sk_buff" and + * other overheads allocate from the receive buffer + * during socket buffer allocation. + * + * And after considering the possible alternatives, + * returning the value we actually used in getsockopt + * is the most desirable behavior. + */ if ((val * 2) < SOCK_MIN_RCVBUF) sk->sk_rcvbuf = SOCK_MIN_RCVBUF; else