aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h46
1 files changed, 39 insertions, 7 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0fca06f16463..9f8821e3293a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -224,8 +224,24 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
224 224
225/* Bit Flags for sysctl_tcp_fastopen */ 225/* Bit Flags for sysctl_tcp_fastopen */
226#define TFO_CLIENT_ENABLE 1 226#define TFO_CLIENT_ENABLE 1
227#define TFO_SERVER_ENABLE 2
227#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */ 228#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */
228 229
230/* Process SYN data but skip cookie validation */
231#define TFO_SERVER_COOKIE_NOT_CHKED 0x100
232/* Accept SYN data w/o any cookie option */
233#define TFO_SERVER_COOKIE_NOT_REQD 0x200
234
235/* Force enable TFO on all listeners, i.e., not requiring the
236 * TCP_FASTOPEN socket option. SOCKOPT1/2 determine how to set max_qlen.
237 */
238#define TFO_SERVER_WO_SOCKOPT1 0x400
239#define TFO_SERVER_WO_SOCKOPT2 0x800
240/* Always create TFO child sockets on a TFO listener even when
241 * cookie/data not present. (For testing purpose!)
242 */
243#define TFO_SERVER_ALWAYS 0x1000
244
229extern struct inet_timewait_death_row tcp_death_row; 245extern struct inet_timewait_death_row tcp_death_row;
230 246
231/* sysctl variables for tcp */ 247/* sysctl variables for tcp */
@@ -421,12 +437,6 @@ extern void tcp_metrics_init(void);
421extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check); 437extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check);
422extern bool tcp_remember_stamp(struct sock *sk); 438extern bool tcp_remember_stamp(struct sock *sk);
423extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 439extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
424extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
425 struct tcp_fastopen_cookie *cookie,
426 int *syn_loss, unsigned long *last_syn_loss);
427extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
428 struct tcp_fastopen_cookie *cookie,
429 bool syn_lost);
430extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 440extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
431extern void tcp_disable_fack(struct tcp_sock *tp); 441extern void tcp_disable_fack(struct tcp_sock *tp);
432extern void tcp_close(struct sock *sk, long timeout); 442extern void tcp_close(struct sock *sk, long timeout);
@@ -537,6 +547,7 @@ extern void tcp_send_delayed_ack(struct sock *sk);
537extern void tcp_cwnd_application_limited(struct sock *sk); 547extern void tcp_cwnd_application_limited(struct sock *sk);
538extern void tcp_resume_early_retransmit(struct sock *sk); 548extern void tcp_resume_early_retransmit(struct sock *sk);
539extern void tcp_rearm_rto(struct sock *sk); 549extern void tcp_rearm_rto(struct sock *sk);
550extern void tcp_reset(struct sock *sk);
540 551
541/* tcp_timer.c */ 552/* tcp_timer.c */
542extern void tcp_init_xmit_timers(struct sock *); 553extern void tcp_init_xmit_timers(struct sock *);
@@ -586,6 +597,7 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
586extern int tcp_mss_to_mtu(struct sock *sk, int mss); 597extern int tcp_mss_to_mtu(struct sock *sk, int mss);
587extern void tcp_mtup_init(struct sock *sk); 598extern void tcp_mtup_init(struct sock *sk);
588extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); 599extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt);
600extern void tcp_init_buffer_space(struct sock *sk);
589 601
590static inline void tcp_bound_rto(const struct sock *sk) 602static inline void tcp_bound_rto(const struct sock *sk)
591{ 603{
@@ -1104,6 +1116,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
1104 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ 1116 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
1105 req->cookie_ts = 0; 1117 req->cookie_ts = 0;
1106 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; 1118 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
1119 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
1107 req->mss = rx_opt->mss_clamp; 1120 req->mss = rx_opt->mss_clamp;
1108 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 1121 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
1109 ireq->tstamp_ok = rx_opt->tstamp_ok; 1122 ireq->tstamp_ok = rx_opt->tstamp_ok;
@@ -1308,15 +1321,34 @@ extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff
1308extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1321extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1309 const struct tcp_md5sig_key *key); 1322 const struct tcp_md5sig_key *key);
1310 1323
1324/* From tcp_fastopen.c */
1325extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
1326 struct tcp_fastopen_cookie *cookie,
1327 int *syn_loss, unsigned long *last_syn_loss);
1328extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
1329 struct tcp_fastopen_cookie *cookie,
1330 bool syn_lost);
1311struct tcp_fastopen_request { 1331struct tcp_fastopen_request {
1312 /* Fast Open cookie. Size 0 means a cookie request */ 1332 /* Fast Open cookie. Size 0 means a cookie request */
1313 struct tcp_fastopen_cookie cookie; 1333 struct tcp_fastopen_cookie cookie;
1314 struct msghdr *data; /* data in MSG_FASTOPEN */ 1334 struct msghdr *data; /* data in MSG_FASTOPEN */
1315 u16 copied; /* queued in tcp_connect() */ 1335 u16 copied; /* queued in tcp_connect() */
1316}; 1336};
1317
1318void tcp_free_fastopen_req(struct tcp_sock *tp); 1337void tcp_free_fastopen_req(struct tcp_sock *tp);
1319 1338
1339extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1340int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1341void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc);
1342
1343#define TCP_FASTOPEN_KEY_LENGTH 16
1344
1345/* Fastopen key context */
1346struct tcp_fastopen_context {
1347 struct crypto_cipher __rcu *tfm;
1348 __u8 key[TCP_FASTOPEN_KEY_LENGTH];
1349 struct rcu_head rcu;
1350};
1351
1320/* write queue abstraction */ 1352/* write queue abstraction */
1321static inline void tcp_write_queue_purge(struct sock *sk) 1353static inline void tcp_write_queue_purge(struct sock *sk)
1322{ 1354{