summaryrefslogtreecommitdiff
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorJason Baron <jbaron@akamai.com>2020-08-10 20:38:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-19 09:16:23 +0300
commite07d0ccd7fdefa4c7ff16148c4fd213f95558581 (patch)
tree2eb265a6a099f2cb73f46d549b80f5dcc04fbed1 /include/net/tcp.h
parent49a5b473bc66d6f561d68a062c0708d4a0789400 (diff)
downloadlinux-e07d0ccd7fdefa4c7ff16148c4fd213f95558581.tar.xz
tcp: correct read of TFO keys on big endian systems
[ Upstream commit f19008e676366c44e9241af57f331b6c6edf9552 ] When TFO keys are read back on big endian systems either via the global sysctl interface or via getsockopt() using TCP_FASTOPEN_KEY, the values don't match what was written. For example, on s390x: # echo "1-2-3-4" > /proc/sys/net/ipv4/tcp_fastopen_key # cat /proc/sys/net/ipv4/tcp_fastopen_key 02000000-01000000-04000000-03000000 Instead of: # cat /proc/sys/net/ipv4/tcp_fastopen_key 00000001-00000002-00000003-00000004 Fix this by converting to the correct endianness on read. This was reported by Colin Ian King when running the 'tcp_fastopen_backup_key' net selftest on s390x, which depends on the read value matching what was written. I've confirmed that the test now passes on big and little endian systems. Signed-off-by: Jason Baron <jbaron@akamai.com> Fixes: 438ac88009bc ("net: fastopen: robustness and endianness fixes for SipHash") Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Eric Dumazet <edumazet@google.com> Reported-and-tested-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7cf1b4972c66..377179283c46 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1650,6 +1650,8 @@ void tcp_fastopen_destroy_cipher(struct sock *sk);
void tcp_fastopen_ctx_destroy(struct net *net);
int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk,
void *primary_key, void *backup_key);
+int tcp_fastopen_get_cipher(struct net *net, struct inet_connection_sock *icsk,
+ u64 *key);
void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb);
struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
struct request_sock *req,