Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT

This patch is following the commit b903d324bee262 (ipv6: tcp: fix TCLASS
value in ACK messages sent from TIME_WAIT).

For the same reason than tclass, we have to store the flow label in the
inet_timewait_sock to provide consistency of flow label on the last ACK.

Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florent Fourcot and committed by
David S. Miller
1d13a96c d037c4d7

+15 -9
+3 -3
include/net/inet_timewait_sock.h
··· 133 133 /* And these are ours. */ 134 134 unsigned int tw_ipv6only : 1, 135 135 tw_transparent : 1, 136 - tw_pad : 6, /* 6 bits hole */ 137 - tw_tos : 8, 138 - tw_pad2 : 16; /* 16 bits hole */ 136 + tw_flowlabel : 20, 137 + tw_pad : 2, /* 2 bits hole */ 138 + tw_tos : 8; 139 139 kmemcheck_bitfield_end(flags); 140 140 u32 tw_ttd; 141 141 struct inet_bind_bucket *tw_tb;
+1
net/ipv4/tcp_minisocks.c
··· 297 297 tw->tw_v6_daddr = sk->sk_v6_daddr; 298 298 tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr; 299 299 tw->tw_tclass = np->tclass; 300 + tw->tw_flowlabel = np->flow_label >> 12; 300 301 tw->tw_ipv6only = np->ipv6only; 301 302 } 302 303 #endif
+11 -6
net/ipv6/tcp_ipv6.c
··· 724 724 725 725 static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, 726 726 u32 tsval, u32 tsecr, 727 - struct tcp_md5sig_key *key, int rst, u8 tclass) 727 + struct tcp_md5sig_key *key, int rst, u8 tclass, 728 + u32 label) 728 729 { 729 730 const struct tcphdr *th = tcp_hdr(skb); 730 731 struct tcphdr *t1; ··· 787 786 memset(&fl6, 0, sizeof(fl6)); 788 787 fl6.daddr = ipv6_hdr(skb)->saddr; 789 788 fl6.saddr = ipv6_hdr(skb)->daddr; 789 + fl6.flowlabel = label; 790 790 791 791 buff->ip_summed = CHECKSUM_PARTIAL; 792 792 buff->csum = 0; ··· 873 871 ack_seq = ntohl(th->seq) + th->syn + th->fin + skb->len - 874 872 (th->doff << 2); 875 873 876 - tcp_v6_send_response(skb, seq, ack_seq, 0, 0, 0, key, 1, 0); 874 + tcp_v6_send_response(skb, seq, ack_seq, 0, 0, 0, key, 1, 0, 0); 877 875 878 876 #ifdef CONFIG_TCP_MD5SIG 879 877 release_sk1: ··· 886 884 887 885 static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, 888 886 u32 win, u32 tsval, u32 tsecr, 889 - struct tcp_md5sig_key *key, u8 tclass) 887 + struct tcp_md5sig_key *key, u8 tclass, 888 + u32 label) 890 889 { 891 - tcp_v6_send_response(skb, seq, ack, win, tsval, tsecr, key, 0, tclass); 890 + tcp_v6_send_response(skb, seq, ack, win, tsval, tsecr, key, 0, tclass, 891 + label); 892 892 } 893 893 894 894 static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) ··· 902 898 tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, 903 899 tcp_time_stamp + tcptw->tw_ts_offset, 904 900 tcptw->tw_ts_recent, tcp_twsk_md5_key(tcptw), 905 - tw->tw_tclass); 901 + tw->tw_tclass, (tw->tw_flowlabel << 12)); 906 902 907 903 inet_twsk_put(tw); 908 904 } ··· 912 908 { 913 909 tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, 914 910 req->rcv_wnd, tcp_time_stamp, req->ts_recent, 915 - tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), 0); 911 + tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), 912 + 0, 0); 916 913 } 917 914 918 915