syncookies.c (8c27bd75f04fb9cb70c69c3cfe24f4e6d8e15906) syncookies.c (086293542b991fb88a2e41ae7b4f82ac65a20e1a)
1/*
2 * IPv6 Syncookies implementation for the Linux kernel
3 *
4 * Authors:
5 * Glenn Griffin <ggriffin.kernel@gmail.com>
6 *
7 * Based on IPv4 implementation by Andi Kleen
8 * linux/net/ipv4/syncookies.c

--- 10 unchanged lines hidden (view full) ---

19#include <linux/cryptohash.h>
20#include <linux/kernel.h>
21#include <net/ipv6.h>
22#include <net/tcp.h>
23
24#define COOKIEBITS 24 /* Upper bits store count */
25#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
26
1/*
2 * IPv6 Syncookies implementation for the Linux kernel
3 *
4 * Authors:
5 * Glenn Griffin <ggriffin.kernel@gmail.com>
6 *
7 * Based on IPv4 implementation by Andi Kleen
8 * linux/net/ipv4/syncookies.c

--- 10 unchanged lines hidden (view full) ---

19#include <linux/cryptohash.h>
20#include <linux/kernel.h>
21#include <net/ipv6.h>
22#include <net/tcp.h>
23
24#define COOKIEBITS 24 /* Upper bits store count */
25#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
26
27/* Table must be sorted. */
27/* RFC 2460, Section 8.3:
28 * [ipv6 tcp] MSS must be computed as the maximum packet size minus 60 [..]
29 *
30 * Due to IPV6_MIN_MTU=1280 the lowest possible MSS is 1220, which allows
31 * using higher values than ipv4 tcp syncookies.
32 * The other values are chosen based on ethernet (1500 and 9k MTU), plus
33 * one that accounts for common encap (PPPoe) overhead. Table must be sorted.
34 */
28static __u16 const msstab[] = {
35static __u16 const msstab[] = {
29 64,
30 512,
31 536,
32 1280 - 60,
36 1280 - 60, /* IPV6_MIN_MTU - 60 */
33 1480 - 60,
34 1500 - 60,
37 1480 - 60,
38 1500 - 60,
35 4460 - 60,
36 9000 - 60,
37};
38
39static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
40 struct request_sock *req,
41 struct dst_entry *dst)
42{
43 struct inet_connection_sock *icsk = inet_csk(sk);

--- 220 unchanged lines hidden ---
39 9000 - 60,
40};
41
42static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
43 struct request_sock *req,
44 struct dst_entry *dst)
45{
46 struct inet_connection_sock *icsk = inet_csk(sk);

--- 220 unchanged lines hidden ---