aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-03-25 20:29:20 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-25 20:29:20 -0400
commit04f58c88542b6b351efb4eea01134eb672e22e6e (patch)
tree47bb617212f8c8951f35730e324bdc43487a01ca /include/net/tcp.h
parent0fc31966035d7a540c011b6c967ce8eae1db121b (diff)
parent632b06aa2842b12c6d6a510ec080fb6ebdb38ea5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: Documentation/devicetree/bindings/net/micrel-ks8851.txt net/core/netpoll.c The net/core/netpoll.c conflict is a bug fix in 'net' happening to code which is completely removed in 'net-next'. In micrel-ks8851.txt we simply have overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index bb253b9b2f06..87d877408188 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -480,20 +480,21 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
480 struct ip_options *opt); 480 struct ip_options *opt);
481#ifdef CONFIG_SYN_COOKIES 481#ifdef CONFIG_SYN_COOKIES
482 482
483/* Syncookies use a monotonic timer which increments every 64 seconds. 483/* Syncookies use a monotonic timer which increments every 60 seconds.
484 * This counter is used both as a hash input and partially encoded into 484 * This counter is used both as a hash input and partially encoded into
485 * the cookie value. A cookie is only validated further if the delta 485 * the cookie value. A cookie is only validated further if the delta
486 * between the current counter value and the encoded one is less than this, 486 * between the current counter value and the encoded one is less than this,
487 * i.e. a sent cookie is valid only at most for 128 seconds (or less if 487 * i.e. a sent cookie is valid only at most for 2*60 seconds (or less if
488 * the counter advances immediately after a cookie is generated). 488 * the counter advances immediately after a cookie is generated).
489 */ 489 */
490#define MAX_SYNCOOKIE_AGE 2 490#define MAX_SYNCOOKIE_AGE 2
491 491
492static inline u32 tcp_cookie_time(void) 492static inline u32 tcp_cookie_time(void)
493{ 493{
494 struct timespec now; 494 u64 val = get_jiffies_64();
495 getnstimeofday(&now); 495
496 return now.tv_sec >> 6; /* 64 seconds granularity */ 496 do_div(val, 60 * HZ);
497 return val;
497} 498}
498 499
499u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, 500u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,