[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AFCFAD0.4010701@gmail.com>
Date: Fri, 13 Nov 2009 07:21:04 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: William Allen Simpson <william.allen.simpson@...il.com>
CC: Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [net-next-2.6 PATCH v6 2/7 RFC] TCPCT part 1b: generate Responder
Cookie
William Allen Simpson a écrit :
> Define (missing) hash message size for SHA1.
>
> Define hashing size constants specific to TCP cookies, and add new
> function.
>
> Maintain global secret values for tcp_cookie_generator().
>
> This is a significantly revised implementation of earlier (15-year-old)
> Photuris [RFC-2522] code for the KA9Q cooperative multitasking platform.
>
> Linux RCU technique appears to be well-suited to this application, though
> neither of the circular queue items are freed.
>
> These functions will also be used in subsequent patches that implement
> additional features.
>
> Signed-off-by: William.Allen.Simpson@...il.com
> ---
> include/linux/cryptohash.h | 1 +
> include/net/tcp.h | 8 +++
> net/ipv4/tcp.c | 146
> ++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 155 insertions(+), 0 deletions(-)
>
Small point :
+ if (unlikely(time_after_eq(jiffy, tcp_secret_generating->expires))) {
+ spin_lock_bh(&tcp_secret_locker);
+ if (!time_after_eq(jiffy, tcp_secret_generating->expires)) {
+ /* refreshed by another */
+ spin_unlock_bh(&tcp_secret_locker);
+ memcpy(bakery,
+ &tcp_secret_generating->secrets[0],
+ sizeof(tcp_secret_generating->secrets));
Technically speaking, you should perform the memcpy() before spin_unlock_bh()
+ if (unlikely(time_after_eq(jiffy, tcp_secret_generating->expires))) {
+ spin_lock_bh(&tcp_secret_locker);
+ if (!time_after_eq(jiffy, tcp_secret_generating->expires)) {
+ /* refreshed by another */
+ memcpy(bakery,
+ &tcp_secret_generating->secrets[0],
+ sizeof(tcp_secret_generating->secrets));
+ spin_unlock_bh(&tcp_secret_locker);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists