diff options
Diffstat (limited to 'net/ipv4/tcp_fastopen.c')
-rw-r--r-- | net/ipv4/tcp_fastopen.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 8f7ef0ad80e5..ab7bd35bb312 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -58,23 +58,22 @@ error: kfree(ctx); | |||
58 | return err; | 58 | return err; |
59 | } | 59 | } |
60 | 60 | ||
61 | /* Computes the fastopen cookie for the peer. | 61 | /* Computes the fastopen cookie for the IP path. |
62 | * The peer address is a 128 bits long (pad with zeros for IPv4). | 62 | * The path is a 128 bits long (pad with zeros for IPv4). |
63 | * | 63 | * |
64 | * The caller must check foc->len to determine if a valid cookie | 64 | * The caller must check foc->len to determine if a valid cookie |
65 | * has been generated successfully. | 65 | * has been generated successfully. |
66 | */ | 66 | */ |
67 | void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc) | 67 | void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, |
68 | struct tcp_fastopen_cookie *foc) | ||
68 | { | 69 | { |
69 | __be32 peer_addr[4] = { addr, 0, 0, 0 }; | 70 | __be32 path[4] = { src, dst, 0, 0 }; |
70 | struct tcp_fastopen_context *ctx; | 71 | struct tcp_fastopen_context *ctx; |
71 | 72 | ||
72 | rcu_read_lock(); | 73 | rcu_read_lock(); |
73 | ctx = rcu_dereference(tcp_fastopen_ctx); | 74 | ctx = rcu_dereference(tcp_fastopen_ctx); |
74 | if (ctx) { | 75 | if (ctx) { |
75 | crypto_cipher_encrypt_one(ctx->tfm, | 76 | crypto_cipher_encrypt_one(ctx->tfm, foc->val, (__u8 *)path); |
76 | foc->val, | ||
77 | (__u8 *)peer_addr); | ||
78 | foc->len = TCP_FASTOPEN_COOKIE_SIZE; | 77 | foc->len = TCP_FASTOPEN_COOKIE_SIZE; |
79 | } | 78 | } |
80 | rcu_read_unlock(); | 79 | rcu_read_unlock(); |