Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Cleanup/KNF tcp6_mtudisc



details:   https://anonhg.NetBSD.org/src/rev/08b64f16f02e
branches:  trunk
changeset: 818949:08b64f16f02e
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Nov 09 03:33:30 2016 +0000

description:
Cleanup/KNF tcp6_mtudisc

No functional change.

diffstat:

 sys/netinet/tcp_subr.c |  59 ++++++++++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 28 deletions(-)

diffs (87 lines):

diff -r 9b707552f29c -r 08b64f16f02e sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Wed Nov 09 00:30:17 2016 +0000
+++ b/sys/netinet/tcp_subr.c    Wed Nov 09 03:33:30 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.266 2016/06/10 13:27:16 ozaki-r Exp $   */
+/*     $NetBSD: tcp_subr.c,v 1.267 2016/11/09 03:33:30 ozaki-r Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.266 2016/06/10 13:27:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.267 2016/11/09 03:33:30 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1822,39 +1822,42 @@
 tcp6_mtudisc(struct in6pcb *in6p, int errno)
 {
        struct tcpcb *tp = in6totcpcb(in6p);
-       struct rtentry *rt = in6_pcbrtentry(in6p);
+       struct rtentry *rt;
 
-       if (tp != 0) {
-               if (rt != 0) {
-                       /*
-                        * If this was not a host route, remove and realloc.
-                        */
-                       if ((rt->rt_flags & RTF_HOST) == 0) {
-                               in6_rtchange(in6p, errno);
-                               if ((rt = in6_pcbrtentry(in6p)) == 0)
-                                       return;
-                       }
+       if (tp == NULL)
+               return;
 
-                       /*
-                        * Slow start out of the error condition.  We
-                        * use the MTU because we know it's smaller
-                        * than the previously transmitted segment.
-                        *
-                        * Note: This is more conservative than the
-                        * suggestion in draft-floyd-incr-init-win-03.
-                        */
-                       if (rt->rt_rmx.rmx_mtu != 0)
-                               tp->snd_cwnd =
-                                   TCP_INITIAL_WINDOW(tcp_init_win,
-                                   rt->rt_rmx.rmx_mtu);
+       rt = in6_pcbrtentry(in6p);
+       if (rt != NULL) {
+               /*
+                * If this was not a host route, remove and realloc.
+                */
+               if ((rt->rt_flags & RTF_HOST) == 0) {
+                       in6_rtchange(in6p, errno);
+                       rt = in6_pcbrtentry(in6p);
+                       if (rt == NULL)
+                               return;
                }
 
                /*
-                * Resend unacknowledged packets.
+                * Slow start out of the error condition.  We
+                * use the MTU because we know it's smaller
+                * than the previously transmitted segment.
+                *
+                * Note: This is more conservative than the
+                * suggestion in draft-floyd-incr-init-win-03.
                 */
-               tp->snd_nxt = tp->sack_newdata = tp->snd_una;
-               tcp_output(tp);
+               if (rt->rt_rmx.rmx_mtu != 0) {
+                       tp->snd_cwnd = TCP_INITIAL_WINDOW(tcp_init_win,
+                           rt->rt_rmx.rmx_mtu);
+               }
        }
+
+       /*
+        * Resend unacknowledged packets.
+        */
+       tp->snd_nxt = tp->sack_newdata = tp->snd_una;
+       tcp_output(tp);
 }
 #endif /* INET6 */
 



Home | Main Index | Thread Index | Old Index