From: Patrick McHardy <kaber@trash.net>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kernel Netdev Mailing List <netdev@vger.kernel.org>
Subject: Re: [XFRM]: Improve MTU estimation
Date: Fri, 04 Aug 2006 12:09:18 +0200 [thread overview]
Message-ID: <44D31CCE.7020301@trash.net> (raw)
In-Reply-To: <20060804100121.GA17239@gondor.apana.org.au>
Herbert Xu wrote:
> On Fri, Aug 04, 2006 at 11:27:11AM +0200, Patrick McHardy wrote:
>
>>-static u32 esp4_get_max_size(struct xfrm_state *x, int mtu)
>>+static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
>> {
>> struct esp_data *esp = x->data;
>>- u32 blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4);
>>+ u32 align = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4);
>>
>>- if (x->props.mode) {
>>- mtu = ALIGN(mtu + 2, blksize);
>>- } else {
>>- /* The worst case. */
>>- mtu = ALIGN(mtu + 2, 4) + blksize - 4;
>>- }
>>- if (esp->conf.padlen)
>>- mtu = ALIGN(mtu, esp->conf.padlen);
>>+ if (esp->conf.padlen > align)
>>+ align = esp->conf.padlen;
>>
>>- return mtu + x->props.header_len + esp->auth.icv_trunc_len;
>>+ mtu -= x->props.header_len + esp->auth.icv_trunc_len;
>>+ mtu &= ~(align - 1);
>>+ mtu -= 2;
>>+
>>+ return mtu;
>
>
> I haven't actually done the math, but I don't think this can be right
> from a quick look. The reason is that transport mode is fundamentally
> different from tunnel mode in that the IP options are not encrypted and
> therefore do not contribute to the encryption block padding.
>
> So as the code doesn't distinguish between transport mode and tunnel
> mode, you might be producing an overestimate for transport mode.
I was wondering why the old code distinguished between transport mode
and tunnel mode, I couldn't spot anything that would be affected. I'll
look into the transport mode case again.
next prev parent reply other threads:[~2006-08-04 10:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-04 8:50 [XFRM]: Improve MTU estimation Patrick McHardy
2006-08-04 9:27 ` Patrick McHardy
2006-08-04 10:01 ` Herbert Xu
2006-08-04 10:09 ` Patrick McHardy [this message]
2006-08-04 10:13 ` Herbert Xu
2006-08-04 11:11 ` Patrick McHardy
2006-08-04 11:16 ` Herbert Xu
2006-08-04 11:21 ` Patrick McHardy
2006-08-04 11:25 ` Herbert Xu
2006-08-04 11:50 ` Patrick McHardy
2006-08-04 11:51 ` Patrick McHardy
2006-08-04 11:55 ` Herbert Xu
2006-08-04 11:54 ` Herbert Xu
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=44D31CCE.7020301@trash.net \
--to=kaber@trash.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).