diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index cf54034019d9..8983386356a5 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -50,6 +50,7 @@ extern atomic_t tcp_orphan_count; | |||
50 | extern void tcp_time_wait(struct sock *sk, int state, int timeo); | 50 | extern void tcp_time_wait(struct sock *sk, int state, int timeo); |
51 | 51 | ||
52 | #define MAX_TCP_HEADER (128 + MAX_HEADER) | 52 | #define MAX_TCP_HEADER (128 + MAX_HEADER) |
53 | #define MAX_TCP_OPTION_SPACE 40 | ||
53 | 54 | ||
54 | /* | 55 | /* |
55 | * Never offer a window over 32767 without using window scaling. Some | 56 | * Never offer a window over 32767 without using window scaling. Some |
@@ -184,6 +185,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
184 | #define TCPOLEN_SACK_BASE_ALIGNED 4 | 185 | #define TCPOLEN_SACK_BASE_ALIGNED 4 |
185 | #define TCPOLEN_SACK_PERBLOCK 8 | 186 | #define TCPOLEN_SACK_PERBLOCK 8 |
186 | #define TCPOLEN_MD5SIG_ALIGNED 20 | 187 | #define TCPOLEN_MD5SIG_ALIGNED 20 |
188 | #define TCPOLEN_MSS_ALIGNED 4 | ||
187 | 189 | ||
188 | /* Flags in tp->nonagle */ | 190 | /* Flags in tp->nonagle */ |
189 | #define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ | 191 | #define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ |
@@ -265,13 +267,10 @@ static inline int tcp_too_many_orphans(struct sock *sk, int num) | |||
265 | 267 | ||
266 | extern struct proto tcp_prot; | 268 | extern struct proto tcp_prot; |
267 | 269 | ||
268 | DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics); | 270 | #define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field) |
269 | #define TCP_INC_STATS(field) SNMP_INC_STATS(tcp_statistics, field) | 271 | #define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field) |
270 | #define TCP_INC_STATS_BH(field) SNMP_INC_STATS_BH(tcp_statistics, field) | 272 | #define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field) |
271 | #define TCP_INC_STATS_USER(field) SNMP_INC_STATS_USER(tcp_statistics, field) | 273 | #define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) |
272 | #define TCP_DEC_STATS(field) SNMP_DEC_STATS(tcp_statistics, field) | ||
273 | #define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val) | ||
274 | #define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val) | ||
275 | 274 | ||
276 | extern void tcp_v4_err(struct sk_buff *skb, u32); | 275 | extern void tcp_v4_err(struct sk_buff *skb, u32); |
277 | 276 | ||
@@ -398,6 +397,8 @@ extern void tcp_parse_options(struct sk_buff *skb, | |||
398 | struct tcp_options_received *opt_rx, | 397 | struct tcp_options_received *opt_rx, |
399 | int estab); | 398 | int estab); |
400 | 399 | ||
400 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); | ||
401 | |||
401 | /* | 402 | /* |
402 | * TCP v4 functions exported for the inet6 API | 403 | * TCP v4 functions exported for the inet6 API |
403 | */ | 404 | */ |
@@ -894,7 +895,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) | |||
894 | 895 | ||
895 | while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { | 896 | while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { |
896 | sk->sk_backlog_rcv(sk, skb1); | 897 | sk->sk_backlog_rcv(sk, skb1); |
897 | NET_INC_STATS_BH(LINUX_MIB_TCPPREQUEUEDROPPED); | 898 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); |
898 | } | 899 | } |
899 | 900 | ||
900 | tp->ucopy.memory = 0; | 901 | tp->ucopy.memory = 0; |
@@ -975,7 +976,7 @@ static inline void tcp_openreq_init(struct request_sock *req, | |||
975 | ireq->rmt_port = tcp_hdr(skb)->source; | 976 | ireq->rmt_port = tcp_hdr(skb)->source; |
976 | } | 977 | } |
977 | 978 | ||
978 | extern void tcp_enter_memory_pressure(void); | 979 | extern void tcp_enter_memory_pressure(struct sock *sk); |
979 | 980 | ||
980 | static inline int keepalive_intvl_when(const struct tcp_sock *tp) | 981 | static inline int keepalive_intvl_when(const struct tcp_sock *tp) |
981 | { | 982 | { |
@@ -1024,13 +1025,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int | |||
1024 | 1025 | ||
1025 | #define TCP_CHECK_TIMER(sk) do { } while (0) | 1026 | #define TCP_CHECK_TIMER(sk) do { } while (0) |
1026 | 1027 | ||
1027 | static inline void tcp_mib_init(void) | 1028 | static inline void tcp_mib_init(struct net *net) |
1028 | { | 1029 | { |
1029 | /* See RFC 2012 */ | 1030 | /* See RFC 2012 */ |
1030 | TCP_ADD_STATS_USER(TCP_MIB_RTOALGORITHM, 1); | 1031 | TCP_ADD_STATS_USER(net, TCP_MIB_RTOALGORITHM, 1); |
1031 | TCP_ADD_STATS_USER(TCP_MIB_RTOMIN, TCP_RTO_MIN*1000/HZ); | 1032 | TCP_ADD_STATS_USER(net, TCP_MIB_RTOMIN, TCP_RTO_MIN*1000/HZ); |
1032 | TCP_ADD_STATS_USER(TCP_MIB_RTOMAX, TCP_RTO_MAX*1000/HZ); | 1033 | TCP_ADD_STATS_USER(net, TCP_MIB_RTOMAX, TCP_RTO_MAX*1000/HZ); |
1033 | TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1); | 1034 | TCP_ADD_STATS_USER(net, TCP_MIB_MAXCONN, -1); |
1034 | } | 1035 | } |
1035 | 1036 | ||
1036 | /* from STCP */ | 1037 | /* from STCP */ |
@@ -1113,14 +1114,12 @@ struct tcp_md5sig_pool { | |||
1113 | #define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ | 1114 | #define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ |
1114 | 1115 | ||
1115 | /* - functions */ | 1116 | /* - functions */ |
1116 | extern int tcp_v4_calc_md5_hash(char *md5_hash, | 1117 | extern int tcp_v4_md5_hash_skb(char *md5_hash, |
1117 | struct tcp_md5sig_key *key, | 1118 | struct tcp_md5sig_key *key, |
1118 | struct sock *sk, | 1119 | struct sock *sk, |
1119 | struct dst_entry *dst, | 1120 | struct request_sock *req, |
1120 | struct request_sock *req, | 1121 | struct sk_buff *skb); |
1121 | struct tcphdr *th, | 1122 | |
1122 | int protocol, | ||
1123 | unsigned int tcplen); | ||
1124 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | 1123 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, |
1125 | struct sock *addr_sk); | 1124 | struct sock *addr_sk); |
1126 | 1125 | ||
@@ -1132,11 +1131,26 @@ extern int tcp_v4_md5_do_add(struct sock *sk, | |||
1132 | extern int tcp_v4_md5_do_del(struct sock *sk, | 1131 | extern int tcp_v4_md5_do_del(struct sock *sk, |
1133 | __be32 addr); | 1132 | __be32 addr); |
1134 | 1133 | ||
1134 | #ifdef CONFIG_TCP_MD5SIG | ||
1135 | #define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ | ||
1136 | &(struct tcp_md5sig_key) { \ | ||
1137 | .key = (twsk)->tw_md5_key, \ | ||
1138 | .keylen = (twsk)->tw_md5_keylen, \ | ||
1139 | } : NULL) | ||
1140 | #else | ||
1141 | #define tcp_twsk_md5_key(twsk) NULL | ||
1142 | #endif | ||
1143 | |||
1135 | extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void); | 1144 | extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void); |
1136 | extern void tcp_free_md5sig_pool(void); | 1145 | extern void tcp_free_md5sig_pool(void); |
1137 | 1146 | ||
1138 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); | 1147 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); |
1139 | extern void __tcp_put_md5sig_pool(void); | 1148 | extern void __tcp_put_md5sig_pool(void); |
1149 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); | ||
1150 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, | ||
1151 | unsigned header_len); | ||
1152 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, | ||
1153 | struct tcp_md5sig_key *key); | ||
1140 | 1154 | ||
1141 | static inline | 1155 | static inline |
1142 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) | 1156 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) |
@@ -1348,7 +1362,7 @@ extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); | |||
1348 | extern struct request_sock_ops tcp_request_sock_ops; | 1362 | extern struct request_sock_ops tcp_request_sock_ops; |
1349 | extern struct request_sock_ops tcp6_request_sock_ops; | 1363 | extern struct request_sock_ops tcp6_request_sock_ops; |
1350 | 1364 | ||
1351 | extern int tcp_v4_destroy_sock(struct sock *sk); | 1365 | extern void tcp_v4_destroy_sock(struct sock *sk); |
1352 | 1366 | ||
1353 | extern int tcp_v4_gso_send_check(struct sk_buff *skb); | 1367 | extern int tcp_v4_gso_send_check(struct sk_buff *skb); |
1354 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); | 1368 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); |
@@ -1366,11 +1380,8 @@ struct tcp_sock_af_ops { | |||
1366 | int (*calc_md5_hash) (char *location, | 1380 | int (*calc_md5_hash) (char *location, |
1367 | struct tcp_md5sig_key *md5, | 1381 | struct tcp_md5sig_key *md5, |
1368 | struct sock *sk, | 1382 | struct sock *sk, |
1369 | struct dst_entry *dst, | ||
1370 | struct request_sock *req, | 1383 | struct request_sock *req, |
1371 | struct tcphdr *th, | 1384 | struct sk_buff *skb); |
1372 | int protocol, | ||
1373 | unsigned int len); | ||
1374 | int (*md5_add) (struct sock *sk, | 1385 | int (*md5_add) (struct sock *sk, |
1375 | struct sock *addr_sk, | 1386 | struct sock *addr_sk, |
1376 | u8 *newkey, | 1387 | u8 *newkey, |