diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
| -rw-r--r-- | net/ipv6/tcp_ipv6.c | 51 | 
1 files changed, 25 insertions, 26 deletions
| diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 49fa2e8c3fa9..4f4310a36a04 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -101,12 +101,18 @@ static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)  	}  } -static u32 tcp_v6_init_sequence(const struct sk_buff *skb, u32 *tsoff) +static u32 tcp_v6_init_seq(const struct sk_buff *skb)  { -	return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, -					    ipv6_hdr(skb)->saddr.s6_addr32, -					    tcp_hdr(skb)->dest, -					    tcp_hdr(skb)->source, tsoff); +	return secure_tcpv6_seq(ipv6_hdr(skb)->daddr.s6_addr32, +				ipv6_hdr(skb)->saddr.s6_addr32, +				tcp_hdr(skb)->dest, +				tcp_hdr(skb)->source); +} + +static u32 tcp_v6_init_ts_off(const struct sk_buff *skb) +{ +	return secure_tcpv6_ts_off(ipv6_hdr(skb)->daddr.s6_addr32, +				   ipv6_hdr(skb)->saddr.s6_addr32);  }  static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, @@ -122,7 +128,6 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,  	struct flowi6 fl6;  	struct dst_entry *dst;  	int addr_type; -	u32 seq;  	int err;  	struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row; @@ -265,11 +270,6 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,  	sk->sk_gso_type = SKB_GSO_TCPV6;  	ip6_dst_store(sk, dst, NULL, NULL); -	if (tcp_death_row->sysctl_tw_recycle && -	    !tp->rx_opt.ts_recent_stamp && -	    ipv6_addr_equal(&fl6.daddr, &sk->sk_v6_daddr)) -		tcp_fetch_timewait_stamp(sk, dst); -  	icsk->icsk_ext_hdr_len = 0;  	if (opt)  		icsk->icsk_ext_hdr_len = opt->opt_flen + @@ -287,13 +287,13 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,  	sk_set_txhash(sk);  	if (likely(!tp->repair)) { -		seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, -						   sk->sk_v6_daddr.s6_addr32, -						   inet->inet_sport, -						   inet->inet_dport, -						   &tp->tsoffset);  		if (!tp->write_seq) -			tp->write_seq = seq; +			tp->write_seq = secure_tcpv6_seq(np->saddr.s6_addr32, +							 sk->sk_v6_daddr.s6_addr32, +							 inet->inet_sport, +							 inet->inet_dport); +		tp->tsoffset = secure_tcpv6_ts_off(np->saddr.s6_addr32, +						   sk->sk_v6_daddr.s6_addr32);  	}  	if (tcp_fastopen_defer_connect(sk, &err)) @@ -727,11 +727,8 @@ static void tcp_v6_init_req(struct request_sock *req,  static struct dst_entry *tcp_v6_route_req(const struct sock *sk,  					  struct flowi *fl, -					  const struct request_sock *req, -					  bool *strict) +					  const struct request_sock *req)  { -	if (strict) -		*strict = true;  	return inet6_csk_route_req(sk, &fl->u.ip6, req, IPPROTO_TCP);  } @@ -757,7 +754,8 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {  	.cookie_init_seq =	cookie_v6_init_sequence,  #endif  	.route_req	=	tcp_v6_route_req, -	.init_seq	=	tcp_v6_init_sequence, +	.init_seq	=	tcp_v6_init_seq, +	.init_ts_off	=	tcp_v6_init_ts_off,  	.send_synack	=	tcp_v6_send_synack,  }; @@ -1064,6 +1062,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *  		newtp->af_specific = &tcp_sock_ipv6_mapped_specific;  #endif +		newnp->ipv6_mc_list = NULL;  		newnp->ipv6_ac_list = NULL;  		newnp->ipv6_fl_list = NULL;  		newnp->pktoptions  = NULL; @@ -1133,6 +1132,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *  	   First: no IPv4 options.  	 */  	newinet->inet_opt = NULL; +	newnp->ipv6_mc_list = NULL;  	newnp->ipv6_ac_list = NULL;  	newnp->ipv6_fl_list = NULL; @@ -1301,8 +1301,6 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)  			goto discard;  		if (nsk != sk) { -			sock_rps_save_rxhash(nsk, skb); -			sk_mark_napi_id(nsk, skb);  			if (tcp_child_process(sk, nsk, skb))  				goto reset;  			if (opt_skb) @@ -1921,7 +1919,7 @@ struct proto tcpv6_prot = {  	.sysctl_rmem		= sysctl_tcp_rmem,  	.max_header		= MAX_TCP_HEADER,  	.obj_size		= sizeof(struct tcp6_sock), -	.slab_flags		= SLAB_DESTROY_BY_RCU, +	.slab_flags		= SLAB_TYPESAFE_BY_RCU,  	.twsk_prot		= &tcp6_timewait_sock_ops,  	.rsk_prot		= &tcp6_request_sock_ops,  	.h.hashinfo		= &tcp_hashinfo, @@ -1933,8 +1931,9 @@ struct proto tcpv6_prot = {  	.diag_destroy		= tcp_abort,  }; -static const struct inet6_protocol tcpv6_protocol = { +static struct inet6_protocol tcpv6_protocol = {  	.early_demux	=	tcp_v6_early_demux, +	.early_demux_handler =  tcp_v6_early_demux,  	.handler	=	tcp_v6_rcv,  	.err_handler	=	tcp_v6_err,  	.flags		=	INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |