* [Qemu-devel] [PATCH 1/1] Fix wrong mss bug.
@ 2017-04-20 19:36 Tao Wu
2017-04-21 4:21 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Tao Wu @ 2017-04-20 19:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Tao Wu
This bug was introduced by https://github.com/qemu/qemu/commit/98c6305
Signed-off-by: Tao Wu <lepton@google.com>
---
slirp/tcp_input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index edb98f06f3..07bcbdb2dd 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -1587,11 +1587,11 @@ tcp_mss(struct tcpcb *tp, u_int offer)
switch (so->so_ffamily) {
case AF_INET:
mss = MIN(IF_MTU, IF_MRU) - sizeof(struct tcphdr)
- + sizeof(struct ip);
+ - sizeof(struct ip);
break;
case AF_INET6:
mss = MIN(IF_MTU, IF_MRU) - sizeof(struct tcphdr)
- + sizeof(struct ip6);
+ - sizeof(struct ip6);
break;
default:
g_assert_not_reached();
--
2.12.2.816.g2cccc81164-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] Fix wrong mss bug.
2017-04-20 19:36 [Qemu-devel] [PATCH 1/1] Fix wrong mss bug Tao Wu
@ 2017-04-21 4:21 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-21 4:21 UTC (permalink / raw)
To: Tao Wu, qemu-devel, Samuel Thibault; +Cc: Tao Wu
Hi Tao,
On 04/20/2017 04:36 PM, Tao Wu wrote:
> This bug was introduced by https://github.com/qemu/qemu/commit/98c6305
Nice catch...
In 98c6305 Guillaume probably missed parentheses :S
- mss = min(IF_MTU, IF_MRU) - sizeof(struct tcpiphdr);
+ mss = min(IF_MTU, IF_MRU) - sizeof(struct tcphdr) + sizeof(struct ip);
This would have been ok:
mss = min(IF_MTU, IF_MRU) - (sizeof(struct tcphdr) + sizeof(struct ip));
"The MSS value to be sent in an MSS option should be equal to the
effective MTU minus the fixed IP and TCP headers." (RFC6691)
> Signed-off-by: Tao Wu <lepton@google.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> slirp/tcp_input.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
> index edb98f06f3..07bcbdb2dd 100644
> --- a/slirp/tcp_input.c
> +++ b/slirp/tcp_input.c
> @@ -1587,11 +1587,11 @@ tcp_mss(struct tcpcb *tp, u_int offer)
> switch (so->so_ffamily) {
> case AF_INET:
> mss = MIN(IF_MTU, IF_MRU) - sizeof(struct tcphdr)
> - + sizeof(struct ip);
> + - sizeof(struct ip);
> break;
> case AF_INET6:
> mss = MIN(IF_MTU, IF_MRU) - sizeof(struct tcphdr)
> - + sizeof(struct ip6);
> + - sizeof(struct ip6);
> break;
> default:
> g_assert_not_reached();
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-21 4:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20 19:36 [Qemu-devel] [PATCH 1/1] Fix wrong mss bug Tao Wu
2017-04-21 4:21 ` Philippe Mathieu-Daudé
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).