diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-10-21 05:22:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-21 05:22:42 -0400 |
commit | cf533ea53ebfae41be15b103d78e7ebec30b9969 (patch) | |
tree | 51ed3c69f4a15117fefe5cbd291a75010beb0f4b | |
parent | f04565ddf52e401880f8ba51de0dff8ba51c99fd (diff) |
tcp: add const qualifiers where possible
Adding const qualifiers to pointers can ease code review, and spot some
bugs. It might allow compiler to optimize code further.
For example, is it legal to temporary write a null cksum into tcphdr
in tcp_md5_hash_header() ? I am afraid a sniffer could catch the
temporary null value...
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/secure_seq.h | 2 | ||||
-rw-r--r-- | include/net/tcp.h | 43 | ||||
-rw-r--r-- | net/core/secure_seq.c | 2 | ||||
-rw-r--r-- | net/ipv4/syncookies.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 18 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 110 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 26 | ||||
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 72 | ||||
-rw-r--r-- | net/ipv6/syncookies.c | 6 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 27 |
11 files changed, 160 insertions, 152 deletions
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h index d97f6892c019..c2e542b27a5a 100644 --- a/include/net/secure_seq.h +++ b/include/net/secure_seq.h | |||
@@ -10,7 +10,7 @@ extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, | |||
10 | __be16 dport); | 10 | __be16 dport); |
11 | extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, | 11 | extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, |
12 | __be16 sport, __be16 dport); | 12 | __be16 sport, __be16 dport); |
13 | extern __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, | 13 | extern __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, |
14 | __be16 sport, __be16 dport); | 14 | __be16 sport, __be16 dport); |
15 | extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, | 15 | extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, |
16 | __be16 sport, __be16 dport); | 16 | __be16 sport, __be16 dport); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 0113d306fcb0..3edef0bebdd1 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -327,9 +327,9 @@ extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, | |||
327 | size_t size, int flags); | 327 | size_t size, int flags); |
328 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 328 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
329 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | 329 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, |
330 | struct tcphdr *th, unsigned len); | 330 | const struct tcphdr *th, unsigned int len); |
331 | extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | 331 | extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
332 | struct tcphdr *th, unsigned len); | 332 | const struct tcphdr *th, unsigned int len); |
333 | extern void tcp_rcv_space_adjust(struct sock *sk); | 333 | extern void tcp_rcv_space_adjust(struct sock *sk); |
334 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); | 334 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); |
335 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); | 335 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); |
@@ -401,10 +401,10 @@ extern void tcp_set_keepalive(struct sock *sk, int val); | |||
401 | extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); | 401 | extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); |
402 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 402 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
403 | size_t len, int nonblock, int flags, int *addr_len); | 403 | size_t len, int nonblock, int flags, int *addr_len); |
404 | extern void tcp_parse_options(struct sk_buff *skb, | 404 | extern void tcp_parse_options(const struct sk_buff *skb, |
405 | struct tcp_options_received *opt_rx, u8 **hvpp, | 405 | struct tcp_options_received *opt_rx, const u8 **hvpp, |
406 | int estab); | 406 | int estab); |
407 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); | 407 | extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); |
408 | 408 | ||
409 | /* | 409 | /* |
410 | * TCP v4 functions exported for the inet6 API | 410 | * TCP v4 functions exported for the inet6 API |
@@ -450,7 +450,7 @@ extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *); | |||
450 | /* From net/ipv6/syncookies.c */ | 450 | /* From net/ipv6/syncookies.c */ |
451 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); | 451 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); |
452 | #ifdef CONFIG_SYN_COOKIES | 452 | #ifdef CONFIG_SYN_COOKIES |
453 | extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, | 453 | extern __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, |
454 | __u16 *mss); | 454 | __u16 *mss); |
455 | #else | 455 | #else |
456 | static inline __u32 cookie_v6_init_sequence(struct sock *sk, | 456 | static inline __u32 cookie_v6_init_sequence(struct sock *sk, |
@@ -522,7 +522,7 @@ static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) | |||
522 | } | 522 | } |
523 | 523 | ||
524 | /* tcp.c */ | 524 | /* tcp.c */ |
525 | extern void tcp_get_info(struct sock *, struct tcp_info *); | 525 | extern void tcp_get_info(const struct sock *, struct tcp_info *); |
526 | 526 | ||
527 | /* Read 'sendfile()'-style from a TCP socket */ | 527 | /* Read 'sendfile()'-style from a TCP socket */ |
528 | typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, | 528 | typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, |
@@ -532,8 +532,8 @@ extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, | |||
532 | 532 | ||
533 | extern void tcp_initialize_rcv_mss(struct sock *sk); | 533 | extern void tcp_initialize_rcv_mss(struct sock *sk); |
534 | 534 | ||
535 | extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); | 535 | extern int tcp_mtu_to_mss(const struct sock *sk, int pmtu); |
536 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); | 536 | extern int tcp_mss_to_mtu(const struct sock *sk, int mss); |
537 | extern void tcp_mtup_init(struct sock *sk); | 537 | extern void tcp_mtup_init(struct sock *sk); |
538 | extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); | 538 | extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); |
539 | 539 | ||
@@ -574,7 +574,7 @@ static inline void tcp_fast_path_check(struct sock *sk) | |||
574 | /* Compute the actual rto_min value */ | 574 | /* Compute the actual rto_min value */ |
575 | static inline u32 tcp_rto_min(struct sock *sk) | 575 | static inline u32 tcp_rto_min(struct sock *sk) |
576 | { | 576 | { |
577 | struct dst_entry *dst = __sk_dst_get(sk); | 577 | const struct dst_entry *dst = __sk_dst_get(sk); |
578 | u32 rto_min = TCP_RTO_MIN; | 578 | u32 rto_min = TCP_RTO_MIN; |
579 | 579 | ||
580 | if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) | 580 | if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) |
@@ -820,6 +820,7 @@ static inline bool tcp_in_initial_slowstart(const struct tcp_sock *tp) | |||
820 | static inline __u32 tcp_current_ssthresh(const struct sock *sk) | 820 | static inline __u32 tcp_current_ssthresh(const struct sock *sk) |
821 | { | 821 | { |
822 | const struct tcp_sock *tp = tcp_sk(sk); | 822 | const struct tcp_sock *tp = tcp_sk(sk); |
823 | |||
823 | if ((1 << inet_csk(sk)->icsk_ca_state) & (TCPF_CA_CWR | TCPF_CA_Recovery)) | 824 | if ((1 << inet_csk(sk)->icsk_ca_state) & (TCPF_CA_CWR | TCPF_CA_Recovery)) |
824 | return tp->snd_ssthresh; | 825 | return tp->snd_ssthresh; |
825 | else | 826 | else |
@@ -832,7 +833,7 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) | |||
832 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) | 833 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) |
833 | 834 | ||
834 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); | 835 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
835 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 836 | extern __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); |
836 | 837 | ||
837 | /* Slow start with delack produces 3 packets of burst, so that | 838 | /* Slow start with delack produces 3 packets of burst, so that |
838 | * it is safe "de facto". This will be the default - same as | 839 | * it is safe "de facto". This will be the default - same as |
@@ -861,7 +862,7 @@ static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, | |||
861 | 862 | ||
862 | static inline void tcp_check_probe_timer(struct sock *sk) | 863 | static inline void tcp_check_probe_timer(struct sock *sk) |
863 | { | 864 | { |
864 | struct tcp_sock *tp = tcp_sk(sk); | 865 | const struct tcp_sock *tp = tcp_sk(sk); |
865 | const struct inet_connection_sock *icsk = inet_csk(sk); | 866 | const struct inet_connection_sock *icsk = inet_csk(sk); |
866 | 867 | ||
867 | if (!tp->packets_out && !icsk->icsk_pending) | 868 | if (!tp->packets_out && !icsk->icsk_pending) |
@@ -1209,10 +1210,10 @@ extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); | |||
1209 | extern void tcp_put_md5sig_pool(void); | 1210 | extern void tcp_put_md5sig_pool(void); |
1210 | 1211 | ||
1211 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); | 1212 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); |
1212 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, | 1213 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, |
1213 | unsigned header_len); | 1214 | unsigned header_len); |
1214 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, | 1215 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, |
1215 | struct tcp_md5sig_key *key); | 1216 | const struct tcp_md5sig_key *key); |
1216 | 1217 | ||
1217 | /* write queue abstraction */ | 1218 | /* write queue abstraction */ |
1218 | static inline void tcp_write_queue_purge(struct sock *sk) | 1219 | static inline void tcp_write_queue_purge(struct sock *sk) |
@@ -1225,22 +1226,24 @@ static inline void tcp_write_queue_purge(struct sock *sk) | |||
1225 | tcp_clear_all_retrans_hints(tcp_sk(sk)); | 1226 | tcp_clear_all_retrans_hints(tcp_sk(sk)); |
1226 | } | 1227 | } |
1227 | 1228 | ||
1228 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) | 1229 | static inline struct sk_buff *tcp_write_queue_head(const struct sock *sk) |
1229 | { | 1230 | { |
1230 | return skb_peek(&sk->sk_write_queue); | 1231 | return skb_peek(&sk->sk_write_queue); |
1231 | } | 1232 | } |
1232 | 1233 | ||
1233 | static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk) | 1234 | static inline struct sk_buff *tcp_write_queue_tail(const struct sock *sk) |
1234 | { | 1235 | { |
1235 | return skb_peek_tail(&sk->sk_write_queue); | 1236 | return skb_peek_tail(&sk->sk_write_queue); |
1236 | } | 1237 | } |
1237 | 1238 | ||
1238 | static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb) | 1239 | static inline struct sk_buff *tcp_write_queue_next(const struct sock *sk, |
1240 | const struct sk_buff *skb) | ||
1239 | { | 1241 | { |
1240 | return skb_queue_next(&sk->sk_write_queue, skb); | 1242 | return skb_queue_next(&sk->sk_write_queue, skb); |
1241 | } | 1243 | } |
1242 | 1244 | ||
1243 | static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_buff *skb) | 1245 | static inline struct sk_buff *tcp_write_queue_prev(const struct sock *sk, |
1246 | const struct sk_buff *skb) | ||
1244 | { | 1247 | { |
1245 | return skb_queue_prev(&sk->sk_write_queue, skb); | 1248 | return skb_queue_prev(&sk->sk_write_queue, skb); |
1246 | } | 1249 | } |
@@ -1254,7 +1257,7 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu | |||
1254 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | 1257 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ |
1255 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) | 1258 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) |
1256 | 1259 | ||
1257 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1260 | static inline struct sk_buff *tcp_send_head(const struct sock *sk) |
1258 | { | 1261 | { |
1259 | return sk->sk_send_head; | 1262 | return sk->sk_send_head; |
1260 | } | 1263 | } |
@@ -1265,7 +1268,7 @@ static inline bool tcp_skb_is_last(const struct sock *sk, | |||
1265 | return skb_queue_is_last(&sk->sk_write_queue, skb); | 1268 | return skb_queue_is_last(&sk->sk_write_queue, skb); |
1266 | } | 1269 | } |
1267 | 1270 | ||
1268 | static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) | 1271 | static inline void tcp_advance_send_head(struct sock *sk, const struct sk_buff *skb) |
1269 | { | 1272 | { |
1270 | if (tcp_skb_is_last(sk, skb)) | 1273 | if (tcp_skb_is_last(sk, skb)) |
1271 | sk->sk_send_head = NULL; | 1274 | sk->sk_send_head = NULL; |
diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c index 45329d7c9dd9..025233de25f9 100644 --- a/net/core/secure_seq.c +++ b/net/core/secure_seq.c | |||
@@ -35,7 +35,7 @@ static u32 seq_scale(u32 seq) | |||
35 | } | 35 | } |
36 | 36 | ||
37 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 37 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
38 | __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, | 38 | __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, |
39 | __be16 sport, __be16 dport) | 39 | __be16 sport, __be16 dport) |
40 | { | 40 | { |
41 | u32 secret[MD5_MESSAGE_BYTES / 4]; | 41 | u32 secret[MD5_MESSAGE_BYTES / 4]; |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 3bc5c8f7c71b..d7b89b12f6d8 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -265,7 +265,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
265 | struct ip_options *opt) | 265 | struct ip_options *opt) |
266 | { | 266 | { |
267 | struct tcp_options_received tcp_opt; | 267 | struct tcp_options_received tcp_opt; |
268 | u8 *hash_location; | 268 | const u8 *hash_location; |
269 | struct inet_request_sock *ireq; | 269 | struct inet_request_sock *ireq; |
270 | struct tcp_request_sock *treq; | 270 | struct tcp_request_sock *treq; |
271 | struct tcp_sock *tp = tcp_sk(sk); | 271 | struct tcp_sock *tp = tcp_sk(sk); |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 132be081cd00..704adad8f07f 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -374,7 +374,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
374 | { | 374 | { |
375 | unsigned int mask; | 375 | unsigned int mask; |
376 | struct sock *sk = sock->sk; | 376 | struct sock *sk = sock->sk; |
377 | struct tcp_sock *tp = tcp_sk(sk); | 377 | const struct tcp_sock *tp = tcp_sk(sk); |
378 | 378 | ||
379 | sock_poll_wait(file, sk_sleep(sk), wait); | 379 | sock_poll_wait(file, sk_sleep(sk), wait); |
380 | if (sk->sk_state == TCP_LISTEN) | 380 | if (sk->sk_state == TCP_LISTEN) |
@@ -528,7 +528,7 @@ static inline void tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb) | |||
528 | tp->pushed_seq = tp->write_seq; | 528 | tp->pushed_seq = tp->write_seq; |
529 | } | 529 | } |
530 | 530 | ||
531 | static inline int forced_push(struct tcp_sock *tp) | 531 | static inline int forced_push(const struct tcp_sock *tp) |
532 | { | 532 | { |
533 | return after(tp->write_seq, tp->pushed_seq + (tp->max_window >> 1)); | 533 | return after(tp->write_seq, tp->pushed_seq + (tp->max_window >> 1)); |
534 | } | 534 | } |
@@ -891,9 +891,9 @@ EXPORT_SYMBOL(tcp_sendpage); | |||
891 | #define TCP_PAGE(sk) (sk->sk_sndmsg_page) | 891 | #define TCP_PAGE(sk) (sk->sk_sndmsg_page) |
892 | #define TCP_OFF(sk) (sk->sk_sndmsg_off) | 892 | #define TCP_OFF(sk) (sk->sk_sndmsg_off) |
893 | 893 | ||
894 | static inline int select_size(struct sock *sk, int sg) | 894 | static inline int select_size(const struct sock *sk, int sg) |
895 | { | 895 | { |
896 | struct tcp_sock *tp = tcp_sk(sk); | 896 | const struct tcp_sock *tp = tcp_sk(sk); |
897 | int tmp = tp->mss_cache; | 897 | int tmp = tp->mss_cache; |
898 | 898 | ||
899 | if (sg) { | 899 | if (sg) { |
@@ -2408,7 +2408,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
2408 | int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | 2408 | int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, |
2409 | unsigned int optlen) | 2409 | unsigned int optlen) |
2410 | { | 2410 | { |
2411 | struct inet_connection_sock *icsk = inet_csk(sk); | 2411 | const struct inet_connection_sock *icsk = inet_csk(sk); |
2412 | 2412 | ||
2413 | if (level != SOL_TCP) | 2413 | if (level != SOL_TCP) |
2414 | return icsk->icsk_af_ops->setsockopt(sk, level, optname, | 2414 | return icsk->icsk_af_ops->setsockopt(sk, level, optname, |
@@ -2430,9 +2430,9 @@ EXPORT_SYMBOL(compat_tcp_setsockopt); | |||
2430 | #endif | 2430 | #endif |
2431 | 2431 | ||
2432 | /* Return information about state of tcp endpoint in API format. */ | 2432 | /* Return information about state of tcp endpoint in API format. */ |
2433 | void tcp_get_info(struct sock *sk, struct tcp_info *info) | 2433 | void tcp_get_info(const struct sock *sk, struct tcp_info *info) |
2434 | { | 2434 | { |
2435 | struct tcp_sock *tp = tcp_sk(sk); | 2435 | const struct tcp_sock *tp = tcp_sk(sk); |
2436 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2436 | const struct inet_connection_sock *icsk = inet_csk(sk); |
2437 | u32 now = tcp_time_stamp; | 2437 | u32 now = tcp_time_stamp; |
2438 | 2438 | ||
@@ -3010,7 +3010,7 @@ int tcp_md5_hash_header(struct tcp_md5sig_pool *hp, | |||
3010 | EXPORT_SYMBOL(tcp_md5_hash_header); | 3010 | EXPORT_SYMBOL(tcp_md5_hash_header); |
3011 | 3011 | ||
3012 | int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp, | 3012 | int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp, |
3013 | struct sk_buff *skb, unsigned header_len) | 3013 | const struct sk_buff *skb, unsigned int header_len) |
3014 | { | 3014 | { |
3015 | struct scatterlist sg; | 3015 | struct scatterlist sg; |
3016 | const struct tcphdr *tp = tcp_hdr(skb); | 3016 | const struct tcphdr *tp = tcp_hdr(skb); |
@@ -3043,7 +3043,7 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp, | |||
3043 | } | 3043 | } |
3044 | EXPORT_SYMBOL(tcp_md5_hash_skb_data); | 3044 | EXPORT_SYMBOL(tcp_md5_hash_skb_data); |
3045 | 3045 | ||
3046 | int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, struct tcp_md5sig_key *key) | 3046 | int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, const struct tcp_md5sig_key *key) |
3047 | { | 3047 | { |
3048 | struct scatterlist sg; | 3048 | struct scatterlist sg; |
3049 | 3049 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 69a90b839984..52b5c2d0ecd0 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -206,7 +206,7 @@ static inline void TCP_ECN_queue_cwr(struct tcp_sock *tp) | |||
206 | tp->ecn_flags |= TCP_ECN_QUEUE_CWR; | 206 | tp->ecn_flags |= TCP_ECN_QUEUE_CWR; |
207 | } | 207 | } |
208 | 208 | ||
209 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) | 209 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, const struct sk_buff *skb) |
210 | { | 210 | { |
211 | if (tcp_hdr(skb)->cwr) | 211 | if (tcp_hdr(skb)->cwr) |
212 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; | 212 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; |
@@ -239,19 +239,19 @@ static inline void TCP_ECN_check_ce(struct tcp_sock *tp, const struct sk_buff *s | |||
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | static inline void TCP_ECN_rcv_synack(struct tcp_sock *tp, struct tcphdr *th) | 242 | static inline void TCP_ECN_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th) |
243 | { | 243 | { |
244 | if ((tp->ecn_flags & TCP_ECN_OK) && (!th->ece || th->cwr)) | 244 | if ((tp->ecn_flags & TCP_ECN_OK) && (!th->ece || th->cwr)) |
245 | tp->ecn_flags &= ~TCP_ECN_OK; | 245 | tp->ecn_flags &= ~TCP_ECN_OK; |
246 | } | 246 | } |
247 | 247 | ||
248 | static inline void TCP_ECN_rcv_syn(struct tcp_sock *tp, struct tcphdr *th) | 248 | static inline void TCP_ECN_rcv_syn(struct tcp_sock *tp, const struct tcphdr *th) |
249 | { | 249 | { |
250 | if ((tp->ecn_flags & TCP_ECN_OK) && (!th->ece || !th->cwr)) | 250 | if ((tp->ecn_flags & TCP_ECN_OK) && (!th->ece || !th->cwr)) |
251 | tp->ecn_flags &= ~TCP_ECN_OK; | 251 | tp->ecn_flags &= ~TCP_ECN_OK; |
252 | } | 252 | } |
253 | 253 | ||
254 | static inline int TCP_ECN_rcv_ecn_echo(struct tcp_sock *tp, struct tcphdr *th) | 254 | static inline int TCP_ECN_rcv_ecn_echo(const struct tcp_sock *tp, const struct tcphdr *th) |
255 | { | 255 | { |
256 | if (th->ece && !th->syn && (tp->ecn_flags & TCP_ECN_OK)) | 256 | if (th->ece && !th->syn && (tp->ecn_flags & TCP_ECN_OK)) |
257 | return 1; | 257 | return 1; |
@@ -315,7 +315,7 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) | |||
315 | return 0; | 315 | return 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | static void tcp_grow_window(struct sock *sk, struct sk_buff *skb) | 318 | static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) |
319 | { | 319 | { |
320 | struct tcp_sock *tp = tcp_sk(sk); | 320 | struct tcp_sock *tp = tcp_sk(sk); |
321 | 321 | ||
@@ -429,7 +429,7 @@ static void tcp_clamp_window(struct sock *sk) | |||
429 | */ | 429 | */ |
430 | void tcp_initialize_rcv_mss(struct sock *sk) | 430 | void tcp_initialize_rcv_mss(struct sock *sk) |
431 | { | 431 | { |
432 | struct tcp_sock *tp = tcp_sk(sk); | 432 | const struct tcp_sock *tp = tcp_sk(sk); |
433 | unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache); | 433 | unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache); |
434 | 434 | ||
435 | hint = min(hint, tp->rcv_wnd / 2); | 435 | hint = min(hint, tp->rcv_wnd / 2); |
@@ -824,7 +824,7 @@ void tcp_update_metrics(struct sock *sk) | |||
824 | } | 824 | } |
825 | } | 825 | } |
826 | 826 | ||
827 | __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst) | 827 | __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst) |
828 | { | 828 | { |
829 | __u32 cwnd = (dst ? dst_metric(dst, RTAX_INITCWND) : 0); | 829 | __u32 cwnd = (dst ? dst_metric(dst, RTAX_INITCWND) : 0); |
830 | 830 | ||
@@ -1216,7 +1216,7 @@ static void tcp_mark_lost_retrans(struct sock *sk) | |||
1216 | tp->lost_retrans_low = new_low_seq; | 1216 | tp->lost_retrans_low = new_low_seq; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | static int tcp_check_dsack(struct sock *sk, struct sk_buff *ack_skb, | 1219 | static int tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb, |
1220 | struct tcp_sack_block_wire *sp, int num_sacks, | 1220 | struct tcp_sack_block_wire *sp, int num_sacks, |
1221 | u32 prior_snd_una) | 1221 | u32 prior_snd_una) |
1222 | { | 1222 | { |
@@ -1310,7 +1310,7 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb, | |||
1310 | return in_sack; | 1310 | return in_sack; |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | static u8 tcp_sacktag_one(struct sk_buff *skb, struct sock *sk, | 1313 | static u8 tcp_sacktag_one(const struct sk_buff *skb, struct sock *sk, |
1314 | struct tcp_sacktag_state *state, | 1314 | struct tcp_sacktag_state *state, |
1315 | int dup_sack, int pcount) | 1315 | int dup_sack, int pcount) |
1316 | { | 1316 | { |
@@ -1465,13 +1465,13 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb, | |||
1465 | /* I wish gso_size would have a bit more sane initialization than | 1465 | /* I wish gso_size would have a bit more sane initialization than |
1466 | * something-or-zero which complicates things | 1466 | * something-or-zero which complicates things |
1467 | */ | 1467 | */ |
1468 | static int tcp_skb_seglen(struct sk_buff *skb) | 1468 | static int tcp_skb_seglen(const struct sk_buff *skb) |
1469 | { | 1469 | { |
1470 | return tcp_skb_pcount(skb) == 1 ? skb->len : tcp_skb_mss(skb); | 1470 | return tcp_skb_pcount(skb) == 1 ? skb->len : tcp_skb_mss(skb); |
1471 | } | 1471 | } |
1472 | 1472 | ||
1473 | /* Shifting pages past head area doesn't work */ | 1473 | /* Shifting pages past head area doesn't work */ |
1474 | static int skb_can_shift(struct sk_buff *skb) | 1474 | static int skb_can_shift(const struct sk_buff *skb) |
1475 | { | 1475 | { |
1476 | return !skb_headlen(skb) && skb_is_nonlinear(skb); | 1476 | return !skb_headlen(skb) && skb_is_nonlinear(skb); |
1477 | } | 1477 | } |
@@ -1720,19 +1720,19 @@ static struct sk_buff *tcp_maybe_skipping_dsack(struct sk_buff *skb, | |||
1720 | return skb; | 1720 | return skb; |
1721 | } | 1721 | } |
1722 | 1722 | ||
1723 | static int tcp_sack_cache_ok(struct tcp_sock *tp, struct tcp_sack_block *cache) | 1723 | static int tcp_sack_cache_ok(const struct tcp_sock *tp, const struct tcp_sack_block *cache) |
1724 | { | 1724 | { |
1725 | return cache < tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache); | 1725 | return cache < tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache); |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | static int | 1728 | static int |
1729 | tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, | 1729 | tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, |
1730 | u32 prior_snd_una) | 1730 | u32 prior_snd_una) |
1731 | { | 1731 | { |
1732 | const struct inet_connection_sock *icsk = inet_csk(sk); | 1732 | const struct inet_connection_sock *icsk = inet_csk(sk); |
1733 | struct tcp_sock *tp = tcp_sk(sk); | 1733 | struct tcp_sock *tp = tcp_sk(sk); |
1734 | unsigned char *ptr = (skb_transport_header(ack_skb) + | 1734 | const unsigned char *ptr = (skb_transport_header(ack_skb) + |
1735 | TCP_SKB_CB(ack_skb)->sacked); | 1735 | TCP_SKB_CB(ack_skb)->sacked); |
1736 | struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2); | 1736 | struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2); |
1737 | struct tcp_sack_block sp[TCP_NUM_SACKS]; | 1737 | struct tcp_sack_block sp[TCP_NUM_SACKS]; |
1738 | struct tcp_sack_block *cache; | 1738 | struct tcp_sack_block *cache; |
@@ -2296,7 +2296,7 @@ static int tcp_check_sack_reneging(struct sock *sk, int flag) | |||
2296 | return 0; | 2296 | return 0; |
2297 | } | 2297 | } |
2298 | 2298 | ||
2299 | static inline int tcp_fackets_out(struct tcp_sock *tp) | 2299 | static inline int tcp_fackets_out(const struct tcp_sock *tp) |
2300 | { | 2300 | { |
2301 | return tcp_is_reno(tp) ? tp->sacked_out + 1 : tp->fackets_out; | 2301 | return tcp_is_reno(tp) ? tp->sacked_out + 1 : tp->fackets_out; |
2302 | } | 2302 | } |
@@ -2316,19 +2316,20 @@ static inline int tcp_fackets_out(struct tcp_sock *tp) | |||
2316 | * they differ. Since neither occurs due to loss, TCP should really | 2316 | * they differ. Since neither occurs due to loss, TCP should really |
2317 | * ignore them. | 2317 | * ignore them. |
2318 | */ | 2318 | */ |
2319 | static inline int tcp_dupack_heuristics(struct tcp_sock *tp) | 2319 | static inline int tcp_dupack_heuristics(const struct tcp_sock *tp) |
2320 | { | 2320 | { |
2321 | return tcp_is_fack(tp) ? tp->fackets_out : tp->sacked_out + 1; | 2321 | return tcp_is_fack(tp) ? tp->fackets_out : tp->sacked_out + 1; |
2322 | } | 2322 | } |
2323 | 2323 | ||
2324 | static inline int tcp_skb_timedout(struct sock *sk, struct sk_buff *skb) | 2324 | static inline int tcp_skb_timedout(const struct sock *sk, |
2325 | const struct sk_buff *skb) | ||
2325 | { | 2326 | { |
2326 | return tcp_time_stamp - TCP_SKB_CB(skb)->when > inet_csk(sk)->icsk_rto; | 2327 | return tcp_time_stamp - TCP_SKB_CB(skb)->when > inet_csk(sk)->icsk_rto; |
2327 | } | 2328 | } |
2328 | 2329 | ||
2329 | static inline int tcp_head_timedout(struct sock *sk) | 2330 | static inline int tcp_head_timedout(const struct sock *sk) |
2330 | { | 2331 | { |
2331 | struct tcp_sock *tp = tcp_sk(sk); | 2332 | const struct tcp_sock *tp = tcp_sk(sk); |
2332 | 2333 | ||
2333 | return tp->packets_out && | 2334 | return tp->packets_out && |
2334 | tcp_skb_timedout(sk, tcp_write_queue_head(sk)); | 2335 | tcp_skb_timedout(sk, tcp_write_queue_head(sk)); |
@@ -2639,7 +2640,7 @@ static void tcp_cwnd_down(struct sock *sk, int flag) | |||
2639 | /* Nothing was retransmitted or returned timestamp is less | 2640 | /* Nothing was retransmitted or returned timestamp is less |
2640 | * than timestamp of the first retransmission. | 2641 | * than timestamp of the first retransmission. |
2641 | */ | 2642 | */ |
2642 | static inline int tcp_packet_delayed(struct tcp_sock *tp) | 2643 | static inline int tcp_packet_delayed(const struct tcp_sock *tp) |
2643 | { | 2644 | { |
2644 | return !tp->retrans_stamp || | 2645 | return !tp->retrans_stamp || |
2645 | (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && | 2646 | (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && |
@@ -2700,7 +2701,7 @@ static void tcp_undo_cwr(struct sock *sk, const bool undo_ssthresh) | |||
2700 | tp->snd_cwnd_stamp = tcp_time_stamp; | 2701 | tp->snd_cwnd_stamp = tcp_time_stamp; |
2701 | } | 2702 | } |
2702 | 2703 | ||
2703 | static inline int tcp_may_undo(struct tcp_sock *tp) | 2704 | static inline int tcp_may_undo(const struct tcp_sock *tp) |
2704 | { | 2705 | { |
2705 | return tp->undo_marker && (!tp->undo_retrans || tcp_packet_delayed(tp)); | 2706 | return tp->undo_marker && (!tp->undo_retrans || tcp_packet_delayed(tp)); |
2706 | } | 2707 | } |
@@ -2764,9 +2765,9 @@ static void tcp_try_undo_dsack(struct sock *sk) | |||
2764 | * that successive retransmissions of a segment must not advance | 2765 | * that successive retransmissions of a segment must not advance |
2765 | * retrans_stamp under any conditions. | 2766 | * retrans_stamp under any conditions. |
2766 | */ | 2767 | */ |
2767 | static int tcp_any_retrans_done(struct sock *sk) | 2768 | static int tcp_any_retrans_done(const struct sock *sk) |
2768 | { | 2769 | { |
2769 | struct tcp_sock *tp = tcp_sk(sk); | 2770 | const struct tcp_sock *tp = tcp_sk(sk); |
2770 | struct sk_buff *skb; | 2771 | struct sk_buff *skb; |
2771 | 2772 | ||
2772 | if (tp->retrans_out) | 2773 | if (tp->retrans_out) |
@@ -3245,7 +3246,7 @@ static void tcp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
3245 | */ | 3246 | */ |
3246 | static void tcp_rearm_rto(struct sock *sk) | 3247 | static void tcp_rearm_rto(struct sock *sk) |
3247 | { | 3248 | { |
3248 | struct tcp_sock *tp = tcp_sk(sk); | 3249 | const struct tcp_sock *tp = tcp_sk(sk); |
3249 | 3250 | ||
3250 | if (!tp->packets_out) { | 3251 | if (!tp->packets_out) { |
3251 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS); | 3252 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS); |
@@ -3497,7 +3498,7 @@ static inline int tcp_may_update_window(const struct tcp_sock *tp, | |||
3497 | * Window update algorithm, described in RFC793/RFC1122 (used in linux-2.2 | 3498 | * Window update algorithm, described in RFC793/RFC1122 (used in linux-2.2 |
3498 | * and in FreeBSD. NetBSD's one is even worse.) is wrong. | 3499 | * and in FreeBSD. NetBSD's one is even worse.) is wrong. |
3499 | */ | 3500 | */ |
3500 | static int tcp_ack_update_window(struct sock *sk, struct sk_buff *skb, u32 ack, | 3501 | static int tcp_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32 ack, |
3501 | u32 ack_seq) | 3502 | u32 ack_seq) |
3502 | { | 3503 | { |
3503 | struct tcp_sock *tp = tcp_sk(sk); | 3504 | struct tcp_sock *tp = tcp_sk(sk); |
@@ -3673,7 +3674,7 @@ static int tcp_process_frto(struct sock *sk, int flag) | |||
3673 | } | 3674 | } |
3674 | 3675 | ||
3675 | /* This routine deals with incoming acks, but not outgoing ones. */ | 3676 | /* This routine deals with incoming acks, but not outgoing ones. */ |
3676 | static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) | 3677 | static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) |
3677 | { | 3678 | { |
3678 | struct inet_connection_sock *icsk = inet_csk(sk); | 3679 | struct inet_connection_sock *icsk = inet_csk(sk); |
3679 | struct tcp_sock *tp = tcp_sk(sk); | 3680 | struct tcp_sock *tp = tcp_sk(sk); |
@@ -3810,14 +3811,14 @@ old_ack: | |||
3810 | * But, this can also be called on packets in the established flow when | 3811 | * But, this can also be called on packets in the established flow when |
3811 | * the fast version below fails. | 3812 | * the fast version below fails. |
3812 | */ | 3813 | */ |
3813 | void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | 3814 | void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *opt_rx, |
3814 | u8 **hvpp, int estab) | 3815 | const u8 **hvpp, int estab) |
3815 | { | 3816 | { |
3816 | unsigned char *ptr; | 3817 | const unsigned char *ptr; |
3817 | struct tcphdr *th = tcp_hdr(skb); | 3818 | const struct tcphdr *th = tcp_hdr(skb); |
3818 | int length = (th->doff * 4) - sizeof(struct tcphdr); | 3819 | int length = (th->doff * 4) - sizeof(struct tcphdr); |
3819 | 3820 | ||
3820 | ptr = (unsigned char *)(th + 1); | 3821 | ptr = (const unsigned char *)(th + 1); |
3821 | opt_rx->saw_tstamp = 0; | 3822 | opt_rx->saw_tstamp = 0; |
3822 | 3823 | ||
3823 | while (length > 0) { | 3824 | while (length > 0) { |
@@ -3928,9 +3929,9 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
3928 | } | 3929 | } |
3929 | EXPORT_SYMBOL(tcp_parse_options); | 3930 | EXPORT_SYMBOL(tcp_parse_options); |
3930 | 3931 | ||
3931 | static int tcp_parse_aligned_timestamp(struct tcp_sock *tp, struct tcphdr *th) | 3932 | static int tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr *th) |
3932 | { | 3933 | { |
3933 | __be32 *ptr = (__be32 *)(th + 1); | 3934 | const __be32 *ptr = (const __be32 *)(th + 1); |
3934 | 3935 | ||
3935 | if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 3936 | if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
3936 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { | 3937 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { |
@@ -3947,8 +3948,9 @@ static int tcp_parse_aligned_timestamp(struct tcp_sock *tp, struct tcphdr *th) | |||
3947 | /* Fast parse options. This hopes to only see timestamps. | 3948 | /* Fast parse options. This hopes to only see timestamps. |
3948 | * If it is wrong it falls back on tcp_parse_options(). | 3949 | * If it is wrong it falls back on tcp_parse_options(). |
3949 | */ | 3950 | */ |
3950 | static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, | 3951 | static int tcp_fast_parse_options(const struct sk_buff *skb, |
3951 | struct tcp_sock *tp, u8 **hvpp) | 3952 | const struct tcphdr *th, |
3953 | struct tcp_sock *tp, const u8 **hvpp) | ||
3952 | { | 3954 | { |
3953 | /* In the spirit of fast parsing, compare doff directly to constant | 3955 | /* In the spirit of fast parsing, compare doff directly to constant |
3954 | * values. Because equality is used, short doff can be ignored here. | 3956 | * values. Because equality is used, short doff can be ignored here. |
@@ -3969,10 +3971,10 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, | |||
3969 | /* | 3971 | /* |
3970 | * Parse MD5 Signature option | 3972 | * Parse MD5 Signature option |
3971 | */ | 3973 | */ |
3972 | u8 *tcp_parse_md5sig_option(struct tcphdr *th) | 3974 | const u8 *tcp_parse_md5sig_option(const struct tcphdr *th) |
3973 | { | 3975 | { |
3974 | int length = (th->doff << 2) - sizeof (*th); | 3976 | int length = (th->doff << 2) - sizeof(*th); |
3975 | u8 *ptr = (u8*)(th + 1); | 3977 | const u8 *ptr = (const u8 *)(th + 1); |
3976 | 3978 | ||
3977 | /* If the TCP option is too short, we can short cut */ | 3979 | /* If the TCP option is too short, we can short cut */ |
3978 | if (length < TCPOLEN_MD5SIG) | 3980 | if (length < TCPOLEN_MD5SIG) |
@@ -4049,8 +4051,8 @@ static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) | |||
4049 | 4051 | ||
4050 | static int tcp_disordered_ack(const struct sock *sk, const struct sk_buff *skb) | 4052 | static int tcp_disordered_ack(const struct sock *sk, const struct sk_buff *skb) |
4051 | { | 4053 | { |
4052 | struct tcp_sock *tp = tcp_sk(sk); | 4054 | const struct tcp_sock *tp = tcp_sk(sk); |
4053 | struct tcphdr *th = tcp_hdr(skb); | 4055 | const struct tcphdr *th = tcp_hdr(skb); |
4054 | u32 seq = TCP_SKB_CB(skb)->seq; | 4056 | u32 seq = TCP_SKB_CB(skb)->seq; |
4055 | u32 ack = TCP_SKB_CB(skb)->ack_seq; | 4057 | u32 ack = TCP_SKB_CB(skb)->ack_seq; |
4056 | 4058 | ||
@@ -4089,7 +4091,7 @@ static inline int tcp_paws_discard(const struct sock *sk, | |||
4089 | * (borrowed from freebsd) | 4091 | * (borrowed from freebsd) |
4090 | */ | 4092 | */ |
4091 | 4093 | ||
4092 | static inline int tcp_sequence(struct tcp_sock *tp, u32 seq, u32 end_seq) | 4094 | static inline int tcp_sequence(const struct tcp_sock *tp, u32 seq, u32 end_seq) |
4093 | { | 4095 | { |
4094 | return !before(end_seq, tp->rcv_wup) && | 4096 | return !before(end_seq, tp->rcv_wup) && |
4095 | !after(seq, tp->rcv_nxt + tcp_receive_window(tp)); | 4097 | !after(seq, tp->rcv_nxt + tcp_receive_window(tp)); |
@@ -4246,7 +4248,7 @@ static void tcp_dsack_extend(struct sock *sk, u32 seq, u32 end_seq) | |||
4246 | tcp_sack_extend(tp->duplicate_sack, seq, end_seq); | 4248 | tcp_sack_extend(tp->duplicate_sack, seq, end_seq); |
4247 | } | 4249 | } |
4248 | 4250 | ||
4249 | static void tcp_send_dupack(struct sock *sk, struct sk_buff *skb) | 4251 | static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb) |
4250 | { | 4252 | { |
4251 | struct tcp_sock *tp = tcp_sk(sk); | 4253 | struct tcp_sock *tp = tcp_sk(sk); |
4252 | 4254 | ||
@@ -4433,7 +4435,7 @@ static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size) | |||
4433 | 4435 | ||
4434 | static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) | 4436 | static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) |
4435 | { | 4437 | { |
4436 | struct tcphdr *th = tcp_hdr(skb); | 4438 | const struct tcphdr *th = tcp_hdr(skb); |
4437 | struct tcp_sock *tp = tcp_sk(sk); | 4439 | struct tcp_sock *tp = tcp_sk(sk); |
4438 | int eaten = -1; | 4440 | int eaten = -1; |
4439 | 4441 | ||
@@ -4917,9 +4919,9 @@ void tcp_cwnd_application_limited(struct sock *sk) | |||
4917 | tp->snd_cwnd_stamp = tcp_time_stamp; | 4919 | tp->snd_cwnd_stamp = tcp_time_stamp; |
4918 | } | 4920 | } |
4919 | 4921 | ||
4920 | static int tcp_should_expand_sndbuf(struct sock *sk) | 4922 | static int tcp_should_expand_sndbuf(const struct sock *sk) |
4921 | { | 4923 | { |
4922 | struct tcp_sock *tp = tcp_sk(sk); | 4924 | const struct tcp_sock *tp = tcp_sk(sk); |
4923 | 4925 | ||
4924 | /* If the user specified a specific send buffer setting, do | 4926 | /* If the user specified a specific send buffer setting, do |
4925 | * not modify it. | 4927 | * not modify it. |
@@ -5028,7 +5030,7 @@ static inline void tcp_ack_snd_check(struct sock *sk) | |||
5028 | * either form (or just set the sysctl tcp_stdurg). | 5030 | * either form (or just set the sysctl tcp_stdurg). |
5029 | */ | 5031 | */ |
5030 | 5032 | ||
5031 | static void tcp_check_urg(struct sock *sk, struct tcphdr *th) | 5033 | static void tcp_check_urg(struct sock *sk, const struct tcphdr *th) |
5032 | { | 5034 | { |
5033 | struct tcp_sock *tp = tcp_sk(sk); | 5035 | struct tcp_sock *tp = tcp_sk(sk); |
5034 | u32 ptr = ntohs(th->urg_ptr); | 5036 | u32 ptr = ntohs(th->urg_ptr); |
@@ -5094,7 +5096,7 @@ static void tcp_check_urg(struct sock *sk, struct tcphdr *th) | |||
5094 | } | 5096 | } |
5095 | 5097 | ||
5096 | /* This is the 'fast' part of urgent handling. */ | 5098 | /* This is the 'fast' part of urgent handling. */ |
5097 | static void tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th) | 5099 | static void tcp_urg(struct sock *sk, struct sk_buff *skb, const struct tcphdr *th) |
5098 | { | 5100 | { |
5099 | struct tcp_sock *tp = tcp_sk(sk); | 5101 | struct tcp_sock *tp = tcp_sk(sk); |
5100 | 5102 | ||
@@ -5215,9 +5217,9 @@ out: | |||
5215 | * play significant role here. | 5217 | * play significant role here. |
5216 | */ | 5218 | */ |
5217 | static int tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, | 5219 | static int tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, |
5218 | struct tcphdr *th, int syn_inerr) | 5220 | const struct tcphdr *th, int syn_inerr) |
5219 | { | 5221 | { |
5220 | u8 *hash_location; | 5222 | const u8 *hash_location; |
5221 | struct tcp_sock *tp = tcp_sk(sk); | 5223 | struct tcp_sock *tp = tcp_sk(sk); |
5222 | 5224 | ||
5223 | /* RFC1323: H1. Apply PAWS check first. */ | 5225 | /* RFC1323: H1. Apply PAWS check first. */ |
@@ -5298,7 +5300,7 @@ discard: | |||
5298 | * tcp_data_queue when everything is OK. | 5300 | * tcp_data_queue when everything is OK. |
5299 | */ | 5301 | */ |
5300 | int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | 5302 | int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
5301 | struct tcphdr *th, unsigned len) | 5303 | const struct tcphdr *th, unsigned int len) |
5302 | { | 5304 | { |
5303 | struct tcp_sock *tp = tcp_sk(sk); | 5305 | struct tcp_sock *tp = tcp_sk(sk); |
5304 | int res; | 5306 | int res; |
@@ -5509,9 +5511,9 @@ discard: | |||
5509 | EXPORT_SYMBOL(tcp_rcv_established); | 5511 | EXPORT_SYMBOL(tcp_rcv_established); |
5510 | 5512 | ||
5511 | static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, | 5513 | static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, |
5512 | struct tcphdr *th, unsigned len) | 5514 | const struct tcphdr *th, unsigned int len) |
5513 | { | 5515 | { |
5514 | u8 *hash_location; | 5516 | const u8 *hash_location; |
5515 | struct inet_connection_sock *icsk = inet_csk(sk); | 5517 | struct inet_connection_sock *icsk = inet_csk(sk); |
5516 | struct tcp_sock *tp = tcp_sk(sk); | 5518 | struct tcp_sock *tp = tcp_sk(sk); |
5517 | struct tcp_cookie_values *cvp = tp->cookie_values; | 5519 | struct tcp_cookie_values *cvp = tp->cookie_values; |
@@ -5786,7 +5788,7 @@ reset_and_undo: | |||
5786 | */ | 5788 | */ |
5787 | 5789 | ||
5788 | int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | 5790 | int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, |
5789 | struct tcphdr *th, unsigned len) | 5791 | const struct tcphdr *th, unsigned int len) |
5790 | { | 5792 | { |
5791 | struct tcp_sock *tp = tcp_sk(sk); | 5793 | struct tcp_sock *tp = tcp_sk(sk); |
5792 | struct inet_connection_sock *icsk = inet_csk(sk); | 5794 | struct inet_connection_sock *icsk = inet_csk(sk); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 48da7cc41e23..955c9255cd98 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -104,7 +104,7 @@ struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr) | |||
104 | struct inet_hashinfo tcp_hashinfo; | 104 | struct inet_hashinfo tcp_hashinfo; |
105 | EXPORT_SYMBOL(tcp_hashinfo); | 105 | EXPORT_SYMBOL(tcp_hashinfo); |
106 | 106 | ||
107 | static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb) | 107 | static inline __u32 tcp_v4_init_sequence(const struct sk_buff *skb) |
108 | { | 108 | { |
109 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, | 109 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, |
110 | ip_hdr(skb)->saddr, | 110 | ip_hdr(skb)->saddr, |
@@ -552,7 +552,7 @@ static void __tcp_v4_send_check(struct sk_buff *skb, | |||
552 | /* This routine computes an IPv4 TCP checksum. */ | 552 | /* This routine computes an IPv4 TCP checksum. */ |
553 | void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb) | 553 | void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb) |
554 | { | 554 | { |
555 | struct inet_sock *inet = inet_sk(sk); | 555 | const struct inet_sock *inet = inet_sk(sk); |
556 | 556 | ||
557 | __tcp_v4_send_check(skb, inet->inet_saddr, inet->inet_daddr); | 557 | __tcp_v4_send_check(skb, inet->inet_saddr, inet->inet_daddr); |
558 | } | 558 | } |
@@ -590,7 +590,7 @@ int tcp_v4_gso_send_check(struct sk_buff *skb) | |||
590 | 590 | ||
591 | static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | 591 | static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) |
592 | { | 592 | { |
593 | struct tcphdr *th = tcp_hdr(skb); | 593 | const struct tcphdr *th = tcp_hdr(skb); |
594 | struct { | 594 | struct { |
595 | struct tcphdr th; | 595 | struct tcphdr th; |
596 | #ifdef CONFIG_TCP_MD5SIG | 596 | #ifdef CONFIG_TCP_MD5SIG |
@@ -668,7 +668,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, | |||
668 | struct tcp_md5sig_key *key, | 668 | struct tcp_md5sig_key *key, |
669 | int reply_flags) | 669 | int reply_flags) |
670 | { | 670 | { |
671 | struct tcphdr *th = tcp_hdr(skb); | 671 | const struct tcphdr *th = tcp_hdr(skb); |
672 | struct { | 672 | struct { |
673 | struct tcphdr th; | 673 | struct tcphdr th; |
674 | __be32 opt[(TCPOLEN_TSTAMP_ALIGNED >> 2) | 674 | __be32 opt[(TCPOLEN_TSTAMP_ALIGNED >> 2) |
@@ -1182,10 +1182,10 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) | |||
1182 | * o MD5 hash and we're not expecting one. | 1182 | * o MD5 hash and we're not expecting one. |
1183 | * o MD5 hash and its wrong. | 1183 | * o MD5 hash and its wrong. |
1184 | */ | 1184 | */ |
1185 | __u8 *hash_location = NULL; | 1185 | const __u8 *hash_location = NULL; |
1186 | struct tcp_md5sig_key *hash_expected; | 1186 | struct tcp_md5sig_key *hash_expected; |
1187 | const struct iphdr *iph = ip_hdr(skb); | 1187 | const struct iphdr *iph = ip_hdr(skb); |
1188 | struct tcphdr *th = tcp_hdr(skb); | 1188 | const struct tcphdr *th = tcp_hdr(skb); |
1189 | int genhash; | 1189 | int genhash; |
1190 | unsigned char newhash[16]; | 1190 | unsigned char newhash[16]; |
1191 | 1191 | ||
@@ -1248,7 +1248,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1248 | { | 1248 | { |
1249 | struct tcp_extend_values tmp_ext; | 1249 | struct tcp_extend_values tmp_ext; |
1250 | struct tcp_options_received tmp_opt; | 1250 | struct tcp_options_received tmp_opt; |
1251 | u8 *hash_location; | 1251 | const u8 *hash_location; |
1252 | struct request_sock *req; | 1252 | struct request_sock *req; |
1253 | struct inet_request_sock *ireq; | 1253 | struct inet_request_sock *ireq; |
1254 | struct tcp_sock *tp = tcp_sk(sk); | 1254 | struct tcp_sock *tp = tcp_sk(sk); |
@@ -1645,7 +1645,7 @@ EXPORT_SYMBOL(tcp_v4_do_rcv); | |||
1645 | int tcp_v4_rcv(struct sk_buff *skb) | 1645 | int tcp_v4_rcv(struct sk_buff *skb) |
1646 | { | 1646 | { |
1647 | const struct iphdr *iph; | 1647 | const struct iphdr *iph; |
1648 | struct tcphdr *th; | 1648 | const struct tcphdr *th; |
1649 | struct sock *sk; | 1649 | struct sock *sk; |
1650 | int ret; | 1650 | int ret; |
1651 | struct net *net = dev_net(skb->dev); | 1651 | struct net *net = dev_net(skb->dev); |
@@ -1809,7 +1809,7 @@ EXPORT_SYMBOL(tcp_v4_get_peer); | |||
1809 | 1809 | ||
1810 | void *tcp_v4_tw_get_peer(struct sock *sk) | 1810 | void *tcp_v4_tw_get_peer(struct sock *sk) |
1811 | { | 1811 | { |
1812 | struct inet_timewait_sock *tw = inet_twsk(sk); | 1812 | const struct inet_timewait_sock *tw = inet_twsk(sk); |
1813 | 1813 | ||
1814 | return inet_getpeer_v4(tw->tw_daddr, 1); | 1814 | return inet_getpeer_v4(tw->tw_daddr, 1); |
1815 | } | 1815 | } |
@@ -2381,7 +2381,7 @@ void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo) | |||
2381 | } | 2381 | } |
2382 | EXPORT_SYMBOL(tcp_proc_unregister); | 2382 | EXPORT_SYMBOL(tcp_proc_unregister); |
2383 | 2383 | ||
2384 | static void get_openreq4(struct sock *sk, struct request_sock *req, | 2384 | static void get_openreq4(const struct sock *sk, const struct request_sock *req, |
2385 | struct seq_file *f, int i, int uid, int *len) | 2385 | struct seq_file *f, int i, int uid, int *len) |
2386 | { | 2386 | { |
2387 | const struct inet_request_sock *ireq = inet_rsk(req); | 2387 | const struct inet_request_sock *ireq = inet_rsk(req); |
@@ -2411,9 +2411,9 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) | |||
2411 | { | 2411 | { |
2412 | int timer_active; | 2412 | int timer_active; |
2413 | unsigned long timer_expires; | 2413 | unsigned long timer_expires; |
2414 | struct tcp_sock *tp = tcp_sk(sk); | 2414 | const struct tcp_sock *tp = tcp_sk(sk); |
2415 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2415 | const struct inet_connection_sock *icsk = inet_csk(sk); |
2416 | struct inet_sock *inet = inet_sk(sk); | 2416 | const struct inet_sock *inet = inet_sk(sk); |
2417 | __be32 dest = inet->inet_daddr; | 2417 | __be32 dest = inet->inet_daddr; |
2418 | __be32 src = inet->inet_rcv_saddr; | 2418 | __be32 src = inet->inet_rcv_saddr; |
2419 | __u16 destp = ntohs(inet->inet_dport); | 2419 | __u16 destp = ntohs(inet->inet_dport); |
@@ -2462,7 +2462,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) | |||
2462 | len); | 2462 | len); |
2463 | } | 2463 | } |
2464 | 2464 | ||
2465 | static void get_timewait4_sock(struct inet_timewait_sock *tw, | 2465 | static void get_timewait4_sock(const struct inet_timewait_sock *tw, |
2466 | struct seq_file *f, int i, int *len) | 2466 | struct seq_file *f, int i, int *len) |
2467 | { | 2467 | { |
2468 | __be32 dest, src; | 2468 | __be32 dest, src; |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index d2fe4e06b472..b767a951d47c 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -141,7 +141,7 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb, | |||
141 | const struct tcphdr *th) | 141 | const struct tcphdr *th) |
142 | { | 142 | { |
143 | struct tcp_options_received tmp_opt; | 143 | struct tcp_options_received tmp_opt; |
144 | u8 *hash_location; | 144 | const u8 *hash_location; |
145 | struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); | 145 | struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); |
146 | int paws_reject = 0; | 146 | int paws_reject = 0; |
147 | 147 | ||
@@ -566,7 +566,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, | |||
566 | struct request_sock **prev) | 566 | struct request_sock **prev) |
567 | { | 567 | { |
568 | struct tcp_options_received tmp_opt; | 568 | struct tcp_options_received tmp_opt; |
569 | u8 *hash_location; | 569 | const u8 *hash_location; |
570 | struct sock *child; | 570 | struct sock *child; |
571 | const struct tcphdr *th = tcp_hdr(skb); | 571 | const struct tcphdr *th = tcp_hdr(skb); |
572 | __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); | 572 | __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index ed96c543f1cf..980b98f6288c 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -65,7 +65,7 @@ EXPORT_SYMBOL_GPL(sysctl_tcp_cookie_size); | |||
65 | 65 | ||
66 | 66 | ||
67 | /* Account for new data that has been sent to the network. */ | 67 | /* Account for new data that has been sent to the network. */ |
68 | static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb) | 68 | static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb) |
69 | { | 69 | { |
70 | struct tcp_sock *tp = tcp_sk(sk); | 70 | struct tcp_sock *tp = tcp_sk(sk); |
71 | unsigned int prior_packets = tp->packets_out; | 71 | unsigned int prior_packets = tp->packets_out; |
@@ -89,9 +89,9 @@ static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb) | |||
89 | * Anything in between SND.UNA...SND.UNA+SND.WND also can be already | 89 | * Anything in between SND.UNA...SND.UNA+SND.WND also can be already |
90 | * invalid. OK, let's make this for now: | 90 | * invalid. OK, let's make this for now: |
91 | */ | 91 | */ |
92 | static inline __u32 tcp_acceptable_seq(struct sock *sk) | 92 | static inline __u32 tcp_acceptable_seq(const struct sock *sk) |
93 | { | 93 | { |
94 | struct tcp_sock *tp = tcp_sk(sk); | 94 | const struct tcp_sock *tp = tcp_sk(sk); |
95 | 95 | ||
96 | if (!before(tcp_wnd_end(tp), tp->snd_nxt)) | 96 | if (!before(tcp_wnd_end(tp), tp->snd_nxt)) |
97 | return tp->snd_nxt; | 97 | return tp->snd_nxt; |
@@ -116,7 +116,7 @@ static inline __u32 tcp_acceptable_seq(struct sock *sk) | |||
116 | static __u16 tcp_advertise_mss(struct sock *sk) | 116 | static __u16 tcp_advertise_mss(struct sock *sk) |
117 | { | 117 | { |
118 | struct tcp_sock *tp = tcp_sk(sk); | 118 | struct tcp_sock *tp = tcp_sk(sk); |
119 | struct dst_entry *dst = __sk_dst_get(sk); | 119 | const struct dst_entry *dst = __sk_dst_get(sk); |
120 | int mss = tp->advmss; | 120 | int mss = tp->advmss; |
121 | 121 | ||
122 | if (dst) { | 122 | if (dst) { |
@@ -133,7 +133,7 @@ static __u16 tcp_advertise_mss(struct sock *sk) | |||
133 | 133 | ||
134 | /* RFC2861. Reset CWND after idle period longer RTO to "restart window". | 134 | /* RFC2861. Reset CWND after idle period longer RTO to "restart window". |
135 | * This is the first part of cwnd validation mechanism. */ | 135 | * This is the first part of cwnd validation mechanism. */ |
136 | static void tcp_cwnd_restart(struct sock *sk, struct dst_entry *dst) | 136 | static void tcp_cwnd_restart(struct sock *sk, const struct dst_entry *dst) |
137 | { | 137 | { |
138 | struct tcp_sock *tp = tcp_sk(sk); | 138 | struct tcp_sock *tp = tcp_sk(sk); |
139 | s32 delta = tcp_time_stamp - tp->lsndtime; | 139 | s32 delta = tcp_time_stamp - tp->lsndtime; |
@@ -154,7 +154,7 @@ static void tcp_cwnd_restart(struct sock *sk, struct dst_entry *dst) | |||
154 | 154 | ||
155 | /* Congestion state accounting after a packet has been sent. */ | 155 | /* Congestion state accounting after a packet has been sent. */ |
156 | static void tcp_event_data_sent(struct tcp_sock *tp, | 156 | static void tcp_event_data_sent(struct tcp_sock *tp, |
157 | struct sk_buff *skb, struct sock *sk) | 157 | struct sock *sk) |
158 | { | 158 | { |
159 | struct inet_connection_sock *icsk = inet_csk(sk); | 159 | struct inet_connection_sock *icsk = inet_csk(sk); |
160 | const u32 now = tcp_time_stamp; | 160 | const u32 now = tcp_time_stamp; |
@@ -295,7 +295,7 @@ static u16 tcp_select_window(struct sock *sk) | |||
295 | } | 295 | } |
296 | 296 | ||
297 | /* Packet ECN state for a SYN-ACK */ | 297 | /* Packet ECN state for a SYN-ACK */ |
298 | static inline void TCP_ECN_send_synack(struct tcp_sock *tp, struct sk_buff *skb) | 298 | static inline void TCP_ECN_send_synack(const struct tcp_sock *tp, struct sk_buff *skb) |
299 | { | 299 | { |
300 | TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_CWR; | 300 | TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_CWR; |
301 | if (!(tp->ecn_flags & TCP_ECN_OK)) | 301 | if (!(tp->ecn_flags & TCP_ECN_OK)) |
@@ -315,7 +315,7 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb) | |||
315 | } | 315 | } |
316 | 316 | ||
317 | static __inline__ void | 317 | static __inline__ void |
318 | TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th) | 318 | TCP_ECN_make_synack(const struct request_sock *req, struct tcphdr *th) |
319 | { | 319 | { |
320 | if (inet_rsk(req)->ecn_ok) | 320 | if (inet_rsk(req)->ecn_ok) |
321 | th->ece = 1; | 321 | th->ece = 1; |
@@ -565,7 +565,8 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, | |||
565 | */ | 565 | */ |
566 | static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, | 566 | static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, |
567 | struct tcp_out_options *opts, | 567 | struct tcp_out_options *opts, |
568 | struct tcp_md5sig_key **md5) { | 568 | struct tcp_md5sig_key **md5) |
569 | { | ||
569 | struct tcp_sock *tp = tcp_sk(sk); | 570 | struct tcp_sock *tp = tcp_sk(sk); |
570 | struct tcp_cookie_values *cvp = tp->cookie_values; | 571 | struct tcp_cookie_values *cvp = tp->cookie_values; |
571 | unsigned remaining = MAX_TCP_OPTION_SPACE; | 572 | unsigned remaining = MAX_TCP_OPTION_SPACE; |
@@ -743,7 +744,8 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
743 | */ | 744 | */ |
744 | static unsigned tcp_established_options(struct sock *sk, struct sk_buff *skb, | 745 | static unsigned tcp_established_options(struct sock *sk, struct sk_buff *skb, |
745 | struct tcp_out_options *opts, | 746 | struct tcp_out_options *opts, |
746 | struct tcp_md5sig_key **md5) { | 747 | struct tcp_md5sig_key **md5) |
748 | { | ||
747 | struct tcp_skb_cb *tcb = skb ? TCP_SKB_CB(skb) : NULL; | 749 | struct tcp_skb_cb *tcb = skb ? TCP_SKB_CB(skb) : NULL; |
748 | struct tcp_sock *tp = tcp_sk(sk); | 750 | struct tcp_sock *tp = tcp_sk(sk); |
749 | unsigned size = 0; | 751 | unsigned size = 0; |
@@ -893,7 +895,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
893 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); | 895 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); |
894 | 896 | ||
895 | if (skb->len != tcp_header_size) | 897 | if (skb->len != tcp_header_size) |
896 | tcp_event_data_sent(tp, skb, sk); | 898 | tcp_event_data_sent(tp, sk); |
897 | 899 | ||
898 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) | 900 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) |
899 | TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, | 901 | TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, |
@@ -926,7 +928,7 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb) | |||
926 | } | 928 | } |
927 | 929 | ||
928 | /* Initialize TSO segments for a packet. */ | 930 | /* Initialize TSO segments for a packet. */ |
929 | static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, | 931 | static void tcp_set_skb_tso_segs(const struct sock *sk, struct sk_buff *skb, |
930 | unsigned int mss_now) | 932 | unsigned int mss_now) |
931 | { | 933 | { |
932 | if (skb->len <= mss_now || !sk_can_gso(sk) || | 934 | if (skb->len <= mss_now || !sk_can_gso(sk) || |
@@ -947,7 +949,7 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, | |||
947 | /* When a modification to fackets out becomes necessary, we need to check | 949 | /* When a modification to fackets out becomes necessary, we need to check |
948 | * skb is counted to fackets_out or not. | 950 | * skb is counted to fackets_out or not. |
949 | */ | 951 | */ |
950 | static void tcp_adjust_fackets_out(struct sock *sk, struct sk_buff *skb, | 952 | static void tcp_adjust_fackets_out(struct sock *sk, const struct sk_buff *skb, |
951 | int decr) | 953 | int decr) |
952 | { | 954 | { |
953 | struct tcp_sock *tp = tcp_sk(sk); | 955 | struct tcp_sock *tp = tcp_sk(sk); |
@@ -962,7 +964,7 @@ static void tcp_adjust_fackets_out(struct sock *sk, struct sk_buff *skb, | |||
962 | /* Pcount in the middle of the write queue got changed, we need to do various | 964 | /* Pcount in the middle of the write queue got changed, we need to do various |
963 | * tweaks to fix counters | 965 | * tweaks to fix counters |
964 | */ | 966 | */ |
965 | static void tcp_adjust_pcount(struct sock *sk, struct sk_buff *skb, int decr) | 967 | static void tcp_adjust_pcount(struct sock *sk, const struct sk_buff *skb, int decr) |
966 | { | 968 | { |
967 | struct tcp_sock *tp = tcp_sk(sk); | 969 | struct tcp_sock *tp = tcp_sk(sk); |
968 | 970 | ||
@@ -1146,10 +1148,10 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | |||
1146 | } | 1148 | } |
1147 | 1149 | ||
1148 | /* Calculate MSS. Not accounting for SACKs here. */ | 1150 | /* Calculate MSS. Not accounting for SACKs here. */ |
1149 | int tcp_mtu_to_mss(struct sock *sk, int pmtu) | 1151 | int tcp_mtu_to_mss(const struct sock *sk, int pmtu) |
1150 | { | 1152 | { |
1151 | struct tcp_sock *tp = tcp_sk(sk); | 1153 | const struct tcp_sock *tp = tcp_sk(sk); |
1152 | struct inet_connection_sock *icsk = inet_csk(sk); | 1154 | const struct inet_connection_sock *icsk = inet_csk(sk); |
1153 | int mss_now; | 1155 | int mss_now; |
1154 | 1156 | ||
1155 | /* Calculate base mss without TCP options: | 1157 | /* Calculate base mss without TCP options: |
@@ -1175,10 +1177,10 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu) | |||
1175 | } | 1177 | } |
1176 | 1178 | ||
1177 | /* Inverse of above */ | 1179 | /* Inverse of above */ |
1178 | int tcp_mss_to_mtu(struct sock *sk, int mss) | 1180 | int tcp_mss_to_mtu(const struct sock *sk, int mss) |
1179 | { | 1181 | { |
1180 | struct tcp_sock *tp = tcp_sk(sk); | 1182 | const struct tcp_sock *tp = tcp_sk(sk); |
1181 | struct inet_connection_sock *icsk = inet_csk(sk); | 1183 | const struct inet_connection_sock *icsk = inet_csk(sk); |
1182 | int mtu; | 1184 | int mtu; |
1183 | 1185 | ||
1184 | mtu = mss + | 1186 | mtu = mss + |
@@ -1252,8 +1254,8 @@ EXPORT_SYMBOL(tcp_sync_mss); | |||
1252 | */ | 1254 | */ |
1253 | unsigned int tcp_current_mss(struct sock *sk) | 1255 | unsigned int tcp_current_mss(struct sock *sk) |
1254 | { | 1256 | { |
1255 | struct tcp_sock *tp = tcp_sk(sk); | 1257 | const struct tcp_sock *tp = tcp_sk(sk); |
1256 | struct dst_entry *dst = __sk_dst_get(sk); | 1258 | const struct dst_entry *dst = __sk_dst_get(sk); |
1257 | u32 mss_now; | 1259 | u32 mss_now; |
1258 | unsigned header_len; | 1260 | unsigned header_len; |
1259 | struct tcp_out_options opts; | 1261 | struct tcp_out_options opts; |
@@ -1313,10 +1315,10 @@ static void tcp_cwnd_validate(struct sock *sk) | |||
1313 | * modulo only when the receiver window alone is the limiting factor or | 1315 | * modulo only when the receiver window alone is the limiting factor or |
1314 | * when we would be allowed to send the split-due-to-Nagle skb fully. | 1316 | * when we would be allowed to send the split-due-to-Nagle skb fully. |
1315 | */ | 1317 | */ |
1316 | static unsigned int tcp_mss_split_point(struct sock *sk, struct sk_buff *skb, | 1318 | static unsigned int tcp_mss_split_point(const struct sock *sk, const struct sk_buff *skb, |
1317 | unsigned int mss_now, unsigned int cwnd) | 1319 | unsigned int mss_now, unsigned int cwnd) |
1318 | { | 1320 | { |
1319 | struct tcp_sock *tp = tcp_sk(sk); | 1321 | const struct tcp_sock *tp = tcp_sk(sk); |
1320 | u32 needed, window, cwnd_len; | 1322 | u32 needed, window, cwnd_len; |
1321 | 1323 | ||
1322 | window = tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq; | 1324 | window = tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq; |
@@ -1336,8 +1338,8 @@ static unsigned int tcp_mss_split_point(struct sock *sk, struct sk_buff *skb, | |||
1336 | /* Can at least one segment of SKB be sent right now, according to the | 1338 | /* Can at least one segment of SKB be sent right now, according to the |
1337 | * congestion window rules? If so, return how many segments are allowed. | 1339 | * congestion window rules? If so, return how many segments are allowed. |
1338 | */ | 1340 | */ |
1339 | static inline unsigned int tcp_cwnd_test(struct tcp_sock *tp, | 1341 | static inline unsigned int tcp_cwnd_test(const struct tcp_sock *tp, |
1340 | struct sk_buff *skb) | 1342 | const struct sk_buff *skb) |
1341 | { | 1343 | { |
1342 | u32 in_flight, cwnd; | 1344 | u32 in_flight, cwnd; |
1343 | 1345 | ||
@@ -1358,7 +1360,7 @@ static inline unsigned int tcp_cwnd_test(struct tcp_sock *tp, | |||
1358 | * This must be invoked the first time we consider transmitting | 1360 | * This must be invoked the first time we consider transmitting |
1359 | * SKB onto the wire. | 1361 | * SKB onto the wire. |
1360 | */ | 1362 | */ |
1361 | static int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, | 1363 | static int tcp_init_tso_segs(const struct sock *sk, struct sk_buff *skb, |
1362 | unsigned int mss_now) | 1364 | unsigned int mss_now) |
1363 | { | 1365 | { |
1364 | int tso_segs = tcp_skb_pcount(skb); | 1366 | int tso_segs = tcp_skb_pcount(skb); |
@@ -1396,7 +1398,7 @@ static inline int tcp_nagle_check(const struct tcp_sock *tp, | |||
1396 | /* Return non-zero if the Nagle test allows this packet to be | 1398 | /* Return non-zero if the Nagle test allows this packet to be |
1397 | * sent now. | 1399 | * sent now. |
1398 | */ | 1400 | */ |
1399 | static inline int tcp_nagle_test(struct tcp_sock *tp, struct sk_buff *skb, | 1401 | static inline int tcp_nagle_test(const struct tcp_sock *tp, const struct sk_buff *skb, |
1400 | unsigned int cur_mss, int nonagle) | 1402 | unsigned int cur_mss, int nonagle) |
1401 | { | 1403 | { |
1402 | /* Nagle rule does not apply to frames, which sit in the middle of the | 1404 | /* Nagle rule does not apply to frames, which sit in the middle of the |
@@ -1422,7 +1424,7 @@ static inline int tcp_nagle_test(struct tcp_sock *tp, struct sk_buff *skb, | |||
1422 | } | 1424 | } |
1423 | 1425 | ||
1424 | /* Does at least the first segment of SKB fit into the send window? */ | 1426 | /* Does at least the first segment of SKB fit into the send window? */ |
1425 | static inline int tcp_snd_wnd_test(struct tcp_sock *tp, struct sk_buff *skb, | 1427 | static inline int tcp_snd_wnd_test(const struct tcp_sock *tp, const struct sk_buff *skb, |
1426 | unsigned int cur_mss) | 1428 | unsigned int cur_mss) |
1427 | { | 1429 | { |
1428 | u32 end_seq = TCP_SKB_CB(skb)->end_seq; | 1430 | u32 end_seq = TCP_SKB_CB(skb)->end_seq; |
@@ -1437,10 +1439,10 @@ static inline int tcp_snd_wnd_test(struct tcp_sock *tp, struct sk_buff *skb, | |||
1437 | * should be put on the wire right now. If so, it returns the number of | 1439 | * should be put on the wire right now. If so, it returns the number of |
1438 | * packets allowed by the congestion window. | 1440 | * packets allowed by the congestion window. |
1439 | */ | 1441 | */ |
1440 | static unsigned int tcp_snd_test(struct sock *sk, struct sk_buff *skb, | 1442 | static unsigned int tcp_snd_test(const struct sock *sk, struct sk_buff *skb, |
1441 | unsigned int cur_mss, int nonagle) | 1443 | unsigned int cur_mss, int nonagle) |
1442 | { | 1444 | { |
1443 | struct tcp_sock *tp = tcp_sk(sk); | 1445 | const struct tcp_sock *tp = tcp_sk(sk); |
1444 | unsigned int cwnd_quota; | 1446 | unsigned int cwnd_quota; |
1445 | 1447 | ||
1446 | tcp_init_tso_segs(sk, skb, cur_mss); | 1448 | tcp_init_tso_segs(sk, skb, cur_mss); |
@@ -1458,7 +1460,7 @@ static unsigned int tcp_snd_test(struct sock *sk, struct sk_buff *skb, | |||
1458 | /* Test if sending is allowed right now. */ | 1460 | /* Test if sending is allowed right now. */ |
1459 | int tcp_may_send_now(struct sock *sk) | 1461 | int tcp_may_send_now(struct sock *sk) |
1460 | { | 1462 | { |
1461 | struct tcp_sock *tp = tcp_sk(sk); | 1463 | const struct tcp_sock *tp = tcp_sk(sk); |
1462 | struct sk_buff *skb = tcp_send_head(sk); | 1464 | struct sk_buff *skb = tcp_send_head(sk); |
1463 | 1465 | ||
1464 | return skb && | 1466 | return skb && |
@@ -2008,7 +2010,7 @@ static void tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb) | |||
2008 | } | 2010 | } |
2009 | 2011 | ||
2010 | /* Check if coalescing SKBs is legal. */ | 2012 | /* Check if coalescing SKBs is legal. */ |
2011 | static int tcp_can_collapse(struct sock *sk, struct sk_buff *skb) | 2013 | static int tcp_can_collapse(const struct sock *sk, const struct sk_buff *skb) |
2012 | { | 2014 | { |
2013 | if (tcp_skb_pcount(skb) > 1) | 2015 | if (tcp_skb_pcount(skb) > 1) |
2014 | return 0; | 2016 | return 0; |
@@ -2184,7 +2186,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
2184 | static int tcp_can_forward_retransmit(struct sock *sk) | 2186 | static int tcp_can_forward_retransmit(struct sock *sk) |
2185 | { | 2187 | { |
2186 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2188 | const struct inet_connection_sock *icsk = inet_csk(sk); |
2187 | struct tcp_sock *tp = tcp_sk(sk); | 2189 | const struct tcp_sock *tp = tcp_sk(sk); |
2188 | 2190 | ||
2189 | /* Forward retransmissions are possible only during Recovery. */ | 2191 | /* Forward retransmissions are possible only during Recovery. */ |
2190 | if (icsk->icsk_ca_state != TCP_CA_Recovery) | 2192 | if (icsk->icsk_ca_state != TCP_CA_Recovery) |
@@ -2550,7 +2552,7 @@ EXPORT_SYMBOL(tcp_make_synack); | |||
2550 | /* Do all connect socket setups that can be done AF independent. */ | 2552 | /* Do all connect socket setups that can be done AF independent. */ |
2551 | static void tcp_connect_init(struct sock *sk) | 2553 | static void tcp_connect_init(struct sock *sk) |
2552 | { | 2554 | { |
2553 | struct dst_entry *dst = __sk_dst_get(sk); | 2555 | const struct dst_entry *dst = __sk_dst_get(sk); |
2554 | struct tcp_sock *tp = tcp_sk(sk); | 2556 | struct tcp_sock *tp = tcp_sk(sk); |
2555 | __u8 rcv_wscale; | 2557 | __u8 rcv_wscale; |
2556 | 2558 | ||
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index ac838965ff34..5a0d6648bbbc 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -115,7 +115,7 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, const struct in6_addr *saddr, | |||
115 | & COOKIEMASK; | 115 | & COOKIEMASK; |
116 | } | 116 | } |
117 | 117 | ||
118 | __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | 118 | __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, __u16 *mssp) |
119 | { | 119 | { |
120 | const struct ipv6hdr *iph = ipv6_hdr(skb); | 120 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
121 | const struct tcphdr *th = tcp_hdr(skb); | 121 | const struct tcphdr *th = tcp_hdr(skb); |
@@ -137,7 +137,7 @@ __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | |||
137 | jiffies / (HZ * 60), mssind); | 137 | jiffies / (HZ * 60), mssind); |
138 | } | 138 | } |
139 | 139 | ||
140 | static inline int cookie_check(struct sk_buff *skb, __u32 cookie) | 140 | static inline int cookie_check(const struct sk_buff *skb, __u32 cookie) |
141 | { | 141 | { |
142 | const struct ipv6hdr *iph = ipv6_hdr(skb); | 142 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
143 | const struct tcphdr *th = tcp_hdr(skb); | 143 | const struct tcphdr *th = tcp_hdr(skb); |
@@ -152,7 +152,7 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie) | |||
152 | struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | 152 | struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) |
153 | { | 153 | { |
154 | struct tcp_options_received tcp_opt; | 154 | struct tcp_options_received tcp_opt; |
155 | u8 *hash_location; | 155 | const u8 *hash_location; |
156 | struct inet_request_sock *ireq; | 156 | struct inet_request_sock *ireq; |
157 | struct inet6_request_sock *ireq6; | 157 | struct inet6_request_sock *ireq6; |
158 | struct tcp_request_sock *treq; | 158 | struct tcp_request_sock *treq; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 5357902c7978..da2ada881cfa 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -114,7 +114,7 @@ static __inline__ __sum16 tcp_v6_check(int len, | |||
114 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); | 114 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); |
115 | } | 115 | } |
116 | 116 | ||
117 | static __u32 tcp_v6_init_sequence(struct sk_buff *skb) | 117 | static __u32 tcp_v6_init_sequence(const struct sk_buff *skb) |
118 | { | 118 | { |
119 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, | 119 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, |
120 | ipv6_hdr(skb)->saddr.s6_addr32, | 120 | ipv6_hdr(skb)->saddr.s6_addr32, |
@@ -844,7 +844,7 @@ clear_hash_noput: | |||
844 | 844 | ||
845 | static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | 845 | static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) |
846 | { | 846 | { |
847 | __u8 *hash_location = NULL; | 847 | const __u8 *hash_location = NULL; |
848 | struct tcp_md5sig_key *hash_expected; | 848 | struct tcp_md5sig_key *hash_expected; |
849 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 849 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
850 | struct tcphdr *th = tcp_hdr(skb); | 850 | struct tcphdr *th = tcp_hdr(skb); |
@@ -980,7 +980,8 @@ static int tcp6_gro_complete(struct sk_buff *skb) | |||
980 | static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | 980 | static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, |
981 | u32 ts, struct tcp_md5sig_key *key, int rst) | 981 | u32 ts, struct tcp_md5sig_key *key, int rst) |
982 | { | 982 | { |
983 | struct tcphdr *th = tcp_hdr(skb), *t1; | 983 | const struct tcphdr *th = tcp_hdr(skb); |
984 | struct tcphdr *t1; | ||
984 | struct sk_buff *buff; | 985 | struct sk_buff *buff; |
985 | struct flowi6 fl6; | 986 | struct flowi6 fl6; |
986 | struct net *net = dev_net(skb_dst(skb)->dev); | 987 | struct net *net = dev_net(skb_dst(skb)->dev); |
@@ -1070,7 +1071,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | |||
1070 | 1071 | ||
1071 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | 1072 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) |
1072 | { | 1073 | { |
1073 | struct tcphdr *th = tcp_hdr(skb); | 1074 | const struct tcphdr *th = tcp_hdr(skb); |
1074 | u32 seq = 0, ack_seq = 0; | 1075 | u32 seq = 0, ack_seq = 0; |
1075 | struct tcp_md5sig_key *key = NULL; | 1076 | struct tcp_md5sig_key *key = NULL; |
1076 | 1077 | ||
@@ -1160,7 +1161,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1160 | { | 1161 | { |
1161 | struct tcp_extend_values tmp_ext; | 1162 | struct tcp_extend_values tmp_ext; |
1162 | struct tcp_options_received tmp_opt; | 1163 | struct tcp_options_received tmp_opt; |
1163 | u8 *hash_location; | 1164 | const u8 *hash_location; |
1164 | struct request_sock *req; | 1165 | struct request_sock *req; |
1165 | struct inet6_request_sock *treq; | 1166 | struct inet6_request_sock *treq; |
1166 | struct ipv6_pinfo *np = inet6_sk(sk); | 1167 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -1688,7 +1689,7 @@ ipv6_pktoptions: | |||
1688 | 1689 | ||
1689 | static int tcp_v6_rcv(struct sk_buff *skb) | 1690 | static int tcp_v6_rcv(struct sk_buff *skb) |
1690 | { | 1691 | { |
1691 | struct tcphdr *th; | 1692 | const struct tcphdr *th; |
1692 | const struct ipv6hdr *hdr; | 1693 | const struct ipv6hdr *hdr; |
1693 | struct sock *sk; | 1694 | struct sock *sk; |
1694 | int ret; | 1695 | int ret; |
@@ -1856,8 +1857,8 @@ static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) | |||
1856 | 1857 | ||
1857 | static void *tcp_v6_tw_get_peer(struct sock *sk) | 1858 | static void *tcp_v6_tw_get_peer(struct sock *sk) |
1858 | { | 1859 | { |
1859 | struct inet6_timewait_sock *tw6 = inet6_twsk(sk); | 1860 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); |
1860 | struct inet_timewait_sock *tw = inet_twsk(sk); | 1861 | const struct inet_timewait_sock *tw = inet_twsk(sk); |
1861 | 1862 | ||
1862 | if (tw->tw_family == AF_INET) | 1863 | if (tw->tw_family == AF_INET) |
1863 | return tcp_v4_tw_get_peer(sk); | 1864 | return tcp_v4_tw_get_peer(sk); |
@@ -2012,7 +2013,7 @@ static void tcp_v6_destroy_sock(struct sock *sk) | |||
2012 | #ifdef CONFIG_PROC_FS | 2013 | #ifdef CONFIG_PROC_FS |
2013 | /* Proc filesystem TCPv6 sock list dumping. */ | 2014 | /* Proc filesystem TCPv6 sock list dumping. */ |
2014 | static void get_openreq6(struct seq_file *seq, | 2015 | static void get_openreq6(struct seq_file *seq, |
2015 | struct sock *sk, struct request_sock *req, int i, int uid) | 2016 | const struct sock *sk, struct request_sock *req, int i, int uid) |
2016 | { | 2017 | { |
2017 | int ttd = req->expires - jiffies; | 2018 | int ttd = req->expires - jiffies; |
2018 | const struct in6_addr *src = &inet6_rsk(req)->loc_addr; | 2019 | const struct in6_addr *src = &inet6_rsk(req)->loc_addr; |
@@ -2048,10 +2049,10 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
2048 | __u16 destp, srcp; | 2049 | __u16 destp, srcp; |
2049 | int timer_active; | 2050 | int timer_active; |
2050 | unsigned long timer_expires; | 2051 | unsigned long timer_expires; |
2051 | struct inet_sock *inet = inet_sk(sp); | 2052 | const struct inet_sock *inet = inet_sk(sp); |
2052 | struct tcp_sock *tp = tcp_sk(sp); | 2053 | const struct tcp_sock *tp = tcp_sk(sp); |
2053 | const struct inet_connection_sock *icsk = inet_csk(sp); | 2054 | const struct inet_connection_sock *icsk = inet_csk(sp); |
2054 | struct ipv6_pinfo *np = inet6_sk(sp); | 2055 | const struct ipv6_pinfo *np = inet6_sk(sp); |
2055 | 2056 | ||
2056 | dest = &np->daddr; | 2057 | dest = &np->daddr; |
2057 | src = &np->rcv_saddr; | 2058 | src = &np->rcv_saddr; |
@@ -2103,7 +2104,7 @@ static void get_timewait6_sock(struct seq_file *seq, | |||
2103 | { | 2104 | { |
2104 | const struct in6_addr *dest, *src; | 2105 | const struct in6_addr *dest, *src; |
2105 | __u16 destp, srcp; | 2106 | __u16 destp, srcp; |
2106 | struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); | 2107 | const struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); |
2107 | int ttd = tw->tw_ttd - jiffies; | 2108 | int ttd = tw->tw_ttd - jiffies; |
2108 | 2109 | ||
2109 | if (ttd < 0) | 2110 | if (ttd < 0) |