]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Fix an unnecessarily aggressive behavior where mtu clamping begins on first
authorhiren <hiren@FreeBSD.org>
Wed, 14 Oct 2015 06:57:28 +0000 (06:57 +0000)
committerhiren <hiren@FreeBSD.org>
Wed, 14 Oct 2015 06:57:28 +0000 (06:57 +0000)
retransmission timeout (rto) when blackhole detection is enabled.  Make
sure it only happens when the second attempt to send the same segment also fails
with rto.

Also make sure that each mtu probing stage (usually 1448 -> 1188 -> 524) follows
the same pattern and gets 2 chances (rto) before further clamping down.

Note: RFC4821 doesn't specify implementation details on how this situation
should be handled.

Differential Revision: https://reviews.freebsd.org/D3434
Reviewed by: sbruno, gnn (previous version)
MFC after: 2 weeks
Sponsored by: Limelight Networks

sys/netinet/tcp_timer.c

index 60b882f869f7ad1c9f45c84846a960e7ead7c9d9..d39339674970df856f179f281ffa9fe7df2d9ac5 100644 (file)
@@ -664,9 +664,15 @@ tcp_timer_rexmt(void * xtp)
                int isipv6;
 #endif
 
+               /*
+                * Idea here is that at each stage of mtu probe (usually, 1448
+                * -> 1188 -> 524) should be given 2 chances to recover before
+                *  further clamping down. 'tp->t_rxtshift % 2 == 0' should
+                *  take care of that.
+                */
                if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) ==
                    (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) &&
-                   (tp->t_rxtshift <= 2)) {
+                   (tp->t_rxtshift >= 2 && tp->t_rxtshift % 2 == 0)) {
                        /*
                         * Enter Path MTU Black-hole Detection mechanism:
                         * - Disable Path MTU Discovery (IP "DF" bit).
@@ -734,9 +740,11 @@ tcp_timer_rexmt(void * xtp)
                         * with a lowered MTU, maybe this isn't a blackhole and
                         * we restore the previous MSS and blackhole detection
                         * flags.
+                        * The limit '6' is determined by giving each probe
+                        * stage (1448, 1188, 524) 2 chances to recover.
                         */
                        if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) &&
-                           (tp->t_rxtshift > 4)) {
+                           (tp->t_rxtshift > 6)) {
                                tp->t_flags2 |= TF2_PLPMTU_PMTUD;
                                tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
                                optlen = tp->t_maxopd - tp->t_maxseg;