change tcp notification of transmission problems so that ip
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Thu, 21 Nov 1985 07:47:33 +0000 (23:47 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Thu, 21 Nov 1985 07:47:33 +0000 (23:47 -0800)
can delete routes created by redirect that have gone bad

SCCS-vsn: sys/netinet/in_pcb.c 6.10
SCCS-vsn: sys/netinet/tcp_timer.c 6.9

usr/src/sys/netinet/in_pcb.c
usr/src/sys/netinet/tcp_timer.c

index 86c987b..fd325b1 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)in_pcb.c    6.9 (Berkeley) %G%
+ *     @(#)in_pcb.c    6.10 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -13,6 +13,7 @@
 #include "mbuf.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "mbuf.h"
 #include "socket.h"
 #include "socketvar.h"
+#include "ioctl.h"
 #include "in.h"
 #include "in_systm.h"
 #include "../net/if.h"
 #include "in.h"
 #include "in_systm.h"
 #include "../net/if.h"
@@ -273,12 +274,35 @@ in_pcbnotify(head, dst, errno, notify)
        splx(s);
 }
 
        splx(s);
 }
 
+/*
+ * Check for alternatives when higher level complains
+ * about service problems.  For now, invalidate cached
+ * routing information.  If the route was created dynamically
+ * (by a redirect), time to try a default gateway again.
+ */
+in_losing(inp)
+       struct inpcb *inp;
+{
+       register struct rtentry *rt;
+
+       if ((rt = inp->inp_route.ro_rt)) {
+               if (rt->rt_flags & RTF_DYNAMIC)
+                       rtrequest(SIOCDELRT, rt);
+               rtfree(rt);
+               inp->inp_route.ro_rt = 0;
+               /*
+                * A new route can be allocated
+                * the next time output is attempted.
+                */
+       }
+}
+
 /*
  * After a routing change, flush old routing
  * and allocate a (hopefully) better one.
  */
 in_rtchange(inp)
 /*
  * After a routing change, flush old routing
  * and allocate a (hopefully) better one.
  */
 in_rtchange(inp)
-       struct inpcb *inp;
+       register struct inpcb *inp;
 {
        if (inp->inp_route.ro_rt) {
                rtfree(inp->inp_route.ro_rt);
 {
        if (inp->inp_route.ro_rt) {
                rtfree(inp->inp_route.ro_rt);
index aa2e62a..a734a52 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_timer.c 6.8 (Berkeley) %G%
+ *     @(#)tcp_timer.c 6.9 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -151,7 +151,7 @@ tcp_timers(tp, timer)
                 * and try for a better route.
                 */
                if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 3)
                 * and try for a better route.
                 */
                if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 3)
-                       in_rtchange(tp->t_inpcb);
+                       in_losing(tp->t_inpcb);
                TCPT_RANGESET(tp->t_timer[TCPT_REXMT],
                    (int)tp->t_srtt, TCPTV_MIN, TCPTV_MAX);
                if (tcpexprexmtbackoff) {
                TCPT_RANGESET(tp->t_timer[TCPT_REXMT],
                    (int)tp->t_srtt, TCPTV_MIN, TCPTV_MAX);
                if (tcpexprexmtbackoff) {