diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 7b8fc5794352..c8683fcc487a 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, |
@@ -761,7 +761,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | |||
761 | 761 | ||
762 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | 762 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, |
763 | const struct in6_addr *daddr, struct in6_addr *saddr, | 763 | const struct in6_addr *daddr, struct in6_addr *saddr, |
764 | struct tcphdr *th) | 764 | const struct tcphdr *th) |
765 | { | 765 | { |
766 | struct tcp_md5sig_pool *hp; | 766 | struct tcp_md5sig_pool *hp; |
767 | struct hash_desc *desc; | 767 | struct hash_desc *desc; |
@@ -793,13 +793,14 @@ clear_hash_noput: | |||
793 | } | 793 | } |
794 | 794 | ||
795 | static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 795 | static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, |
796 | struct sock *sk, struct request_sock *req, | 796 | const struct sock *sk, |
797 | struct sk_buff *skb) | 797 | const struct request_sock *req, |
798 | const struct sk_buff *skb) | ||
798 | { | 799 | { |
799 | const struct in6_addr *saddr, *daddr; | 800 | const struct in6_addr *saddr, *daddr; |
800 | struct tcp_md5sig_pool *hp; | 801 | struct tcp_md5sig_pool *hp; |
801 | struct hash_desc *desc; | 802 | struct hash_desc *desc; |
802 | struct tcphdr *th = tcp_hdr(skb); | 803 | const struct tcphdr *th = tcp_hdr(skb); |
803 | 804 | ||
804 | if (sk) { | 805 | if (sk) { |
805 | saddr = &inet6_sk(sk)->saddr; | 806 | saddr = &inet6_sk(sk)->saddr; |
@@ -842,12 +843,12 @@ clear_hash_noput: | |||
842 | return 1; | 843 | return 1; |
843 | } | 844 | } |
844 | 845 | ||
845 | static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | 846 | static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) |
846 | { | 847 | { |
847 | __u8 *hash_location = NULL; | 848 | const __u8 *hash_location = NULL; |
848 | struct tcp_md5sig_key *hash_expected; | 849 | struct tcp_md5sig_key *hash_expected; |
849 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 850 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
850 | struct tcphdr *th = tcp_hdr(skb); | 851 | const struct tcphdr *th = tcp_hdr(skb); |
851 | int genhash; | 852 | int genhash; |
852 | u8 newhash[16]; | 853 | u8 newhash[16]; |
853 | 854 | ||
@@ -980,7 +981,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, | 981 | 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) | 982 | u32 ts, struct tcp_md5sig_key *key, int rst) |
982 | { | 983 | { |
983 | struct tcphdr *th = tcp_hdr(skb), *t1; | 984 | const struct tcphdr *th = tcp_hdr(skb); |
985 | struct tcphdr *t1; | ||
984 | struct sk_buff *buff; | 986 | struct sk_buff *buff; |
985 | struct flowi6 fl6; | 987 | struct flowi6 fl6; |
986 | struct net *net = dev_net(skb_dst(skb)->dev); | 988 | struct net *net = dev_net(skb_dst(skb)->dev); |
@@ -1070,7 +1072,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | |||
1070 | 1072 | ||
1071 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | 1073 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) |
1072 | { | 1074 | { |
1073 | struct tcphdr *th = tcp_hdr(skb); | 1075 | const struct tcphdr *th = tcp_hdr(skb); |
1074 | u32 seq = 0, ack_seq = 0; | 1076 | u32 seq = 0, ack_seq = 0; |
1075 | struct tcp_md5sig_key *key = NULL; | 1077 | struct tcp_md5sig_key *key = NULL; |
1076 | 1078 | ||
@@ -1160,7 +1162,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1160 | { | 1162 | { |
1161 | struct tcp_extend_values tmp_ext; | 1163 | struct tcp_extend_values tmp_ext; |
1162 | struct tcp_options_received tmp_opt; | 1164 | struct tcp_options_received tmp_opt; |
1163 | u8 *hash_location; | 1165 | const u8 *hash_location; |
1164 | struct request_sock *req; | 1166 | struct request_sock *req; |
1165 | struct inet6_request_sock *treq; | 1167 | struct inet6_request_sock *treq; |
1166 | struct ipv6_pinfo *np = inet6_sk(sk); | 1168 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -1608,7 +1610,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1608 | opt_skb = skb_clone(skb, GFP_ATOMIC); | 1610 | opt_skb = skb_clone(skb, GFP_ATOMIC); |
1609 | 1611 | ||
1610 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ | 1612 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ |
1611 | sock_rps_save_rxhash(sk, skb->rxhash); | 1613 | sock_rps_save_rxhash(sk, skb); |
1612 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) | 1614 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) |
1613 | goto reset; | 1615 | goto reset; |
1614 | if (opt_skb) | 1616 | if (opt_skb) |
@@ -1630,7 +1632,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1630 | * the new socket.. | 1632 | * the new socket.. |
1631 | */ | 1633 | */ |
1632 | if(nsk != sk) { | 1634 | if(nsk != sk) { |
1633 | sock_rps_save_rxhash(nsk, skb->rxhash); | 1635 | sock_rps_save_rxhash(nsk, skb); |
1634 | if (tcp_child_process(sk, nsk, skb)) | 1636 | if (tcp_child_process(sk, nsk, skb)) |
1635 | goto reset; | 1637 | goto reset; |
1636 | if (opt_skb) | 1638 | if (opt_skb) |
@@ -1638,7 +1640,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1638 | return 0; | 1640 | return 0; |
1639 | } | 1641 | } |
1640 | } else | 1642 | } else |
1641 | sock_rps_save_rxhash(sk, skb->rxhash); | 1643 | sock_rps_save_rxhash(sk, skb); |
1642 | 1644 | ||
1643 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) | 1645 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) |
1644 | goto reset; | 1646 | goto reset; |
@@ -1688,7 +1690,7 @@ ipv6_pktoptions: | |||
1688 | 1690 | ||
1689 | static int tcp_v6_rcv(struct sk_buff *skb) | 1691 | static int tcp_v6_rcv(struct sk_buff *skb) |
1690 | { | 1692 | { |
1691 | struct tcphdr *th; | 1693 | const struct tcphdr *th; |
1692 | const struct ipv6hdr *hdr; | 1694 | const struct ipv6hdr *hdr; |
1693 | struct sock *sk; | 1695 | struct sock *sk; |
1694 | int ret; | 1696 | int ret; |
@@ -1722,7 +1724,7 @@ static int tcp_v6_rcv(struct sk_buff *skb) | |||
1722 | skb->len - th->doff*4); | 1724 | skb->len - th->doff*4); |
1723 | TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); | 1725 | TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); |
1724 | TCP_SKB_CB(skb)->when = 0; | 1726 | TCP_SKB_CB(skb)->when = 0; |
1725 | TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(hdr); | 1727 | TCP_SKB_CB(skb)->ip_dsfield = ipv6_get_dsfield(hdr); |
1726 | TCP_SKB_CB(skb)->sacked = 0; | 1728 | TCP_SKB_CB(skb)->sacked = 0; |
1727 | 1729 | ||
1728 | sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest); | 1730 | sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest); |
@@ -1856,8 +1858,8 @@ static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) | |||
1856 | 1858 | ||
1857 | static void *tcp_v6_tw_get_peer(struct sock *sk) | 1859 | static void *tcp_v6_tw_get_peer(struct sock *sk) |
1858 | { | 1860 | { |
1859 | struct inet6_timewait_sock *tw6 = inet6_twsk(sk); | 1861 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); |
1860 | struct inet_timewait_sock *tw = inet_twsk(sk); | 1862 | const struct inet_timewait_sock *tw = inet_twsk(sk); |
1861 | 1863 | ||
1862 | if (tw->tw_family == AF_INET) | 1864 | if (tw->tw_family == AF_INET) |
1863 | return tcp_v4_tw_get_peer(sk); | 1865 | return tcp_v4_tw_get_peer(sk); |
@@ -2012,7 +2014,7 @@ static void tcp_v6_destroy_sock(struct sock *sk) | |||
2012 | #ifdef CONFIG_PROC_FS | 2014 | #ifdef CONFIG_PROC_FS |
2013 | /* Proc filesystem TCPv6 sock list dumping. */ | 2015 | /* Proc filesystem TCPv6 sock list dumping. */ |
2014 | static void get_openreq6(struct seq_file *seq, | 2016 | static void get_openreq6(struct seq_file *seq, |
2015 | struct sock *sk, struct request_sock *req, int i, int uid) | 2017 | const struct sock *sk, struct request_sock *req, int i, int uid) |
2016 | { | 2018 | { |
2017 | int ttd = req->expires - jiffies; | 2019 | int ttd = req->expires - jiffies; |
2018 | const struct in6_addr *src = &inet6_rsk(req)->loc_addr; | 2020 | const struct in6_addr *src = &inet6_rsk(req)->loc_addr; |
@@ -2048,10 +2050,10 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
2048 | __u16 destp, srcp; | 2050 | __u16 destp, srcp; |
2049 | int timer_active; | 2051 | int timer_active; |
2050 | unsigned long timer_expires; | 2052 | unsigned long timer_expires; |
2051 | struct inet_sock *inet = inet_sk(sp); | 2053 | const struct inet_sock *inet = inet_sk(sp); |
2052 | struct tcp_sock *tp = tcp_sk(sp); | 2054 | const struct tcp_sock *tp = tcp_sk(sp); |
2053 | const struct inet_connection_sock *icsk = inet_csk(sp); | 2055 | const struct inet_connection_sock *icsk = inet_csk(sp); |
2054 | struct ipv6_pinfo *np = inet6_sk(sp); | 2056 | const struct ipv6_pinfo *np = inet6_sk(sp); |
2055 | 2057 | ||
2056 | dest = &np->daddr; | 2058 | dest = &np->daddr; |
2057 | src = &np->rcv_saddr; | 2059 | src = &np->rcv_saddr; |
@@ -2103,7 +2105,7 @@ static void get_timewait6_sock(struct seq_file *seq, | |||
2103 | { | 2105 | { |
2104 | const struct in6_addr *dest, *src; | 2106 | const struct in6_addr *dest, *src; |
2105 | __u16 destp, srcp; | 2107 | __u16 destp, srcp; |
2106 | struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); | 2108 | const struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); |
2107 | int ttd = tw->tw_ttd - jiffies; | 2109 | int ttd = tw->tw_ttd - jiffies; |
2108 | 2110 | ||
2109 | if (ttd < 0) | 2111 | if (ttd < 0) |