diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-11-16 00:54:04 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-11-16 00:54:04 +0100 |
commit | 78d2a52577c39f5f580b925931aa1ffbdc3d16be (patch) | |
tree | 80775e6010b31b8aa68693d21a8b9518b2ad50d0 /sys/src/9/ip | |
parent | 323d625864651cb5cec7ba5be42ec8e0b633266e (diff) |
ip/tcp: never raise the mss over the link mtu < 1280 for v6
v6 mandates minimum mtu of 1280, tho someone *could* setup
an interface with a lower mtu or set it lower for testing.
Diffstat (limited to 'sys/src/9/ip')
-rw-r--r-- | sys/src/9/ip/tcp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/src/9/ip/tcp.c b/sys/src/9/ip/tcp.c index 050a24a0b..b612bbd5a 100644 --- a/sys/src/9/ip/tcp.c +++ b/sys/src/9/ip/tcp.c @@ -864,13 +864,14 @@ tcpmtu(Route *r, int version, uint *scale) * otherwise, we use the default MSS which assumes a * safe minimum MTU of 1280 bytes for V6. */ - if(r != nil && (version == V4 || (r->type & (Rifc|Runi)) != 0)){ + if(r != nil){ ifc = r->ifc; mtu = ifc->maxtu - ifc->m->hsize; - if(version == V6) - return mtu - (TCP6_PKT + TCP6_HDRSIZE); - else + if(version == V4) return mtu - (TCP4_PKT + TCP4_HDRSIZE); + mtu -= TCP6_PKT + TCP6_HDRSIZE; + if((r->type & (Rifc|Runi)) != 0 || mtu <= DEF_MSS6) + return mtu; } if(version == V6) return DEF_MSS6; |