From: Christoph Paasch <cpaasch at apple.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH 05/18] tcp6: Prepare for maximum TCP option-space
Date: Tue, 03 Oct 2017 09:21:51 -0700 [thread overview]
Message-ID: <20171003162204.17945-6-cpaasch@apple.com> (raw)
In-Reply-To: 20171003162204.17945-1-cpaasch@apple.com
[-- Attachment #1: Type: text/plain, Size: 1926 bytes --]
With a generic TCP-option framework we don't know in advance how much
space will be used. So, estimate the worst and allocate the maximum.
Later on, we pull skb->tail back in again.
Signed-off-by: Christoph Paasch <cpaasch(a)apple.com>
---
net/ipv6/tcp_ipv6.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 64d94afa427f..17f7e0cd8755 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -784,17 +784,11 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
struct flowi6 fl6;
struct net *net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev);
struct sock *ctl_sk = net->ipv6.tcp_sk;
- unsigned int tot_len = sizeof(struct tcphdr);
+ unsigned int tot_len = sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE;
+ unsigned int reduce = 0; /* By how much to pull skb->tail back in? */
struct dst_entry *dst;
__be32 *topt;
- if (tsecr)
- tot_len += TCPOLEN_TSTAMP_ALIGNED;
-#ifdef CONFIG_TCP_MD5SIG
- if (key)
- tot_len += TCPOLEN_MD5SIG_ALIGNED;
-#endif
-
buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
GFP_ATOMIC);
if (!buff)
@@ -823,6 +817,8 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
(TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
*topt++ = htonl(tsval);
*topt++ = htonl(tsecr);
+
+ reduce += TCPOLEN_TSTAMP_ALIGNED;
}
#ifdef CONFIG_TCP_MD5SIG
@@ -832,9 +828,13 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
tcp_v6_md5_hash_hdr((__u8 *)topt, key,
&ipv6_hdr(skb)->saddr,
&ipv6_hdr(skb)->daddr, t1);
+
+ reduce += TCPOLEN_MD5SIG_ALIGNED;
}
#endif
+ buff->tail -= reduce;
+
memset(&fl6, 0, sizeof(fl6));
fl6.daddr = ipv6_hdr(skb)->saddr;
fl6.saddr = ipv6_hdr(skb)->daddr;
--
2.14.1
next reply other threads:[~2017-10-03 16:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 16:21 Christoph Paasch [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-10-04 22:33 [MPTCP] [PATCH 05/18] tcp6: Prepare for maximum TCP option-space Mat Martineau
2017-10-05 7:41 Christoph Paasch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171003162204.17945-6-cpaasch@apple.com \
--to=unknown@example.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.