* [PATCH] tcp: update the netstamp_needed counter when cloning sockets
@ 2010-01-05 23:06 Octavian Purdila
2010-01-08 8:00 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Octavian Purdila @ 2010-01-05 23:06 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Octavian Purdila
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>
---
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 76ff58d..e1f6f22 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)
if (newsk->sk_prot->sockets_allocated)
percpu_counter_inc(newsk->sk_prot->sockets_allocated);
+
+ if (sock_flag(newsk, SOCK_TIMESTAMP) ||
+ sock_flag(newsk, SOCK_TIMESTAMPING_RX_SOFTWARE))
+ net_enable_timestamp();
}
out:
return newsk;
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tcp: update the netstamp_needed counter when cloning sockets
2010-01-05 23:06 [PATCH] tcp: update the netstamp_needed counter when cloning sockets Octavian Purdila
@ 2010-01-08 8:00 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-01-08 8:00 UTC (permalink / raw)
To: opurdila; +Cc: netdev
From: Octavian Purdila <opurdila@ixiacom.com>
Date: Wed, 6 Jan 2010 01:06:30 +0200
> 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>
Applied and queued up for -stable, thanks for fixing this!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-08 8:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-05 23:06 [PATCH] tcp: update the netstamp_needed counter when cloning sockets Octavian Purdila
2010-01-08 8:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).