Source-Changes-HG archive

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

[src/trunk]: src/sys/net Use MRU negotiated with remote system as MTU. This f...



details:   https://anonhg.NetBSD.org/src/rev/6203c7abcfea
branches:  trunk
changeset: 542424:6203c7abcfea
user:      tron <tron%NetBSD.org@localhost>
date:      Tue Jan 28 15:36:38 2003 +0000

description:
Use MRU negotiated with remote system as MTU. This fixes PR kern/18850
by Curt Sampson.

diffstat:

 sys/net/if_spppsubr.c |  28 ++++++++++++++++++++++++++--
 sys/net/if_spppvar.h  |   3 ++-
 2 files changed, 28 insertions(+), 3 deletions(-)

diffs (93 lines):

diff -r c4e2259fc010 -r 6203c7abcfea sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Tue Jan 28 14:43:18 2003 +0000
+++ b/sys/net/if_spppsubr.c     Tue Jan 28 15:36:38 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.62 2003/01/19 23:45:33 simonb Exp $   */
+/*     $NetBSD: if_spppsubr.c,v 1.63 2003/01/28 15:36:38 tron Exp $     */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.62 2003/01/19 23:45:33 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.63 2003/01/28 15:36:38 tron Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipx.h"
@@ -59,6 +59,7 @@
 #include <sys/mbuf.h>
 #include <sys/callout.h>
 #include <sys/md5.h>
+#include <sys/inttypes.h>
 
 #include <net/if.h>
 #include <net/netisr.h>
@@ -2791,12 +2792,23 @@
 static void
 sppp_ipcp_close(struct sppp *sp)
 {
+       STDDCL;
+
        sppp_close_event(&ipcp, sp);
        if (sp->ipcp.flags & (IPCP_MYADDR_DYN|IPCP_HISADDR_DYN))
                /*
                 * Some address was dynamic, clear it again.
                 */
                sppp_clear_ip_addrs(sp);
+
+       if (sp->pp_saved_mtu > 0) {
+               ifp->if_mtu = sp->pp_saved_mtu;
+               sp->pp_saved_mtu = 0;
+               if (debug)
+                       log(LOG_DEBUG,
+                           SPP_FMT "resetting MTU to %" PRIu64 " bytes\n",
+                           SPP_ARGS(ifp), ifp->if_mtu);
+       }
 }
 
 static void
@@ -3103,13 +3115,25 @@
 sppp_ipcp_tlu(struct sppp *sp)
 {
        /* we are up. Set addresses and notify anyone interested */
+       STDDCL;
        u_int32_t myaddr, hisaddr;
+
        sppp_get_ip_addrs(sp, &myaddr, &hisaddr, 0);
        if ((sp->ipcp.flags & IPCP_MYADDR_DYN) && (sp->ipcp.flags & IPCP_MYADDR_SEEN))
                myaddr = sp->ipcp.req_myaddr;
        if ((sp->ipcp.flags & IPCP_HISADDR_DYN) && (sp->ipcp.flags & IPCP_HISADDR_SEEN))
                hisaddr = sp->ipcp.req_hisaddr;
        sppp_set_ip_addrs(sp, myaddr, hisaddr);
+
+       if (ifp->if_mtu > sp->lcp.their_mru) {
+               sp->pp_saved_mtu = ifp->if_mtu;
+               ifp->if_mtu = sp->lcp.their_mru;
+               if (debug)
+                       log(LOG_DEBUG,
+                           SPP_FMT "setting MTU to %" PRIu64 " bytes\n",
+                           SPP_ARGS(ifp), ifp->if_mtu);
+       }
+
        if (sp->pp_con)
                sp->pp_con(sp);
 }
diff -r c4e2259fc010 -r 6203c7abcfea sys/net/if_spppvar.h
--- a/sys/net/if_spppvar.h      Tue Jan 28 14:43:18 2003 +0000
+++ b/sys/net/if_spppvar.h      Tue Jan 28 15:36:38 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppvar.h,v 1.6 2003/01/22 11:47:05 jmmv Exp $      */
+/*     $NetBSD: if_spppvar.h,v 1.7 2003/01/28 15:36:40 tron Exp $      */
 
 /*
  * Defines for synchronous PPP/Cisco link level subroutines.
@@ -85,6 +85,7 @@
        u_short pp_loopcnt;     /* loopback detection counter */
        u_long  pp_seq[IDX_COUNT];      /* local sequence number */
        u_long  pp_rseq[IDX_COUNT];     /* remote sequence number */
+       u_quad_t        pp_saved_mtu;   /* saved MTU value */
        time_t  pp_last_activity;       /* second of last payload data s/r */
        time_t  pp_idle_timeout;        /* idle seconds before auto-disconnect,
                                         * 0 = disabled */



Home | Main Index | Thread Index | Old Index