diff options
author | Octavian Purdila <opurdila@ixiacom.com> | 2010-01-08 03:00:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-08 03:00:09 -0500 |
commit | 704da560c0a0120d8869187f511491a00951a1d3 (patch) | |
tree | 9dddcbc4142ca794d065f366a69cf523abe3f4b1 /net/core | |
parent | 1ca518b64b4b5865b677f292322e893fa89997d4 (diff) |
tcp: update the netstamp_needed counter when cloning sockets
This fixes a netstamp_needed accounting issue when the listen socket
has SO_TIMESTAMP set:
s = socket(AF_INET, SOCK_STREAM, 0);
setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, 1); -> netstamp_needed = 1
bind(s, ...);
listen(s, ...);
s2 = accept(s, ...); -> netstamp_needed = 1
close(s2); -> netstamp_needed = 0
close(s); -> netstamp_needed = -1
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/sock.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 76ff58d43e26..e1f6f225f012 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1205,6 +1205,10 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) | |||
1205 | 1205 | ||
1206 | if (newsk->sk_prot->sockets_allocated) | 1206 | if (newsk->sk_prot->sockets_allocated) |
1207 | percpu_counter_inc(newsk->sk_prot->sockets_allocated); | 1207 | percpu_counter_inc(newsk->sk_prot->sockets_allocated); |
1208 | |||
1209 | if (sock_flag(newsk, SOCK_TIMESTAMP) || | ||
1210 | sock_flag(newsk, SOCK_TIMESTAMPING_RX_SOFTWARE)) | ||
1211 | net_enable_timestamp(); | ||
1208 | } | 1212 | } |
1209 | out: | 1213 | out: |
1210 | return newsk; | 1214 | return newsk; |