aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2008-04-10 06:12:40 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-10 06:12:40 -0400
commit4dfc2817025965a2fc78a18c50f540736a6b5c24 (patch)
treef8f2f76e660d9d5c7a0f39ed8a79cb6d6d181206 /include/net/tcp.h
parent15be75cdb5db442d0e33d37b20832b88f3ccd383 (diff)
[Syncookies]: Add support for TCP options via timestamps.
Allow the use of SACK and window scaling when syncookies are used and the client supports tcp timestamps. Options are encoded into the timestamp sent in the syn-ack and restored from the timestamp echo when the ack is received. Based on earlier work by Glenn Griffin. This patch avoids increasing the size of structs by encoding TCP options into the least significant bits of the timestamp and by not using any 'timestamp offset'. The downside is that the timestamp sent in the packet after the synack will increase by several seconds. changes since v1: don't duplicate timestamp echo decoding function, put it into ipv4/syncookie.c and have ipv6/syncookies.c use it. Feedback from Glenn Griffin: fix line indented with spaces, kill redundant if () Reviewed-by: Hagen Paul Pfeifer <hagen@jauu.net> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 723b36851dde..7b41bb962b9c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -442,6 +442,9 @@ extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
442extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, 442extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
443 __u16 *mss); 443 __u16 *mss);
444 444
445extern __u32 cookie_init_timestamp(struct request_sock *req);
446extern void cookie_check_timestamp(struct tcp_options_received *tcp_opt);
447
445/* From net/ipv6/syncookies.c */ 448/* From net/ipv6/syncookies.c */
446extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 449extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
447extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, 450extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb,
@@ -956,6 +959,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
956 struct inet_request_sock *ireq = inet_rsk(req); 959 struct inet_request_sock *ireq = inet_rsk(req);
957 960
958 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ 961 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
962 req->cookie_ts = 0;
959 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; 963 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
960 req->mss = rx_opt->mss_clamp; 964 req->mss = rx_opt->mss_clamp;
961 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 965 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;