Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix to set mtu even if it is bigger than mru notifie...



details:   https://anonhg.NetBSD.org/src/rev/c50dea6fe844
branches:  trunk
changeset: 961853:c50dea6fe844
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Fri Apr 23 03:31:33 2021 +0000

description:
Fix to set mtu even if it is bigger than mru notified at LCP

diffstat:

 sys/net/if_spppsubr.c |  25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r 7c4d3a9f8198 -r c50dea6fe844 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Fri Apr 23 03:07:19 2021 +0000
+++ b/sys/net/if_spppsubr.c     Fri Apr 23 03:31:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.218 2021/04/23 01:13:25 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.219 2021/04/23 03:31:33 yamaguchi Exp $       */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.218 2021/04/23 01:13:25 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.219 2021/04/23 03:31:33 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1212,11 +1212,28 @@
 
        case SIOCSIFMTU:
                if (ifr->ifr_mtu < PPP_MINMRU ||
-                   ifr->ifr_mtu > sp->lcp.their_mru) {
+                   ifr->ifr_mtu > PP_MTU) {
                        error = EINVAL;
                        break;
                }
-               /*FALLTHROUGH*/
+
+               error = ifioctl_common(ifp, cmd, data);
+               if (error == ENETRESET)
+                       error = 0;
+
+               if (sp->lcp.their_mru > 0 &&
+                   ifp->if_mtu > sp->lcp.their_mru) {
+                       sp->pp_saved_mtu = ifp->if_mtu;
+                       ifp->if_mtu = sp->lcp.their_mru;
+                       if (ifp->if_flags & IFF_DEBUG) {
+                               log(LOG_DEBUG,
+                                   "%s: setting MTU to "
+                                   "%"PRIu64" bytes\n",
+                                   ifp->if_xname, ifp->if_mtu);
+                       }
+               }
+               break;
+
        case SIOCGIFMTU:
                if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET)
                        error = 0;



Home | Main Index | Thread Index | Old Index