Source-Changes-HG archive

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

[src/trunk]: src/sys/net Tweak the slow-but-persistent connection reestablish...



details:   https://anonhg.NetBSD.org/src/rev/c619b31ee6fb
branches:  trunk
changeset: 521534:c619b31ee6fb
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Feb 01 13:40:16 2002 +0000

description:
Tweak the slow-but-persistent connection reestablishment timeout, retrying
is not realy expensive - do it once every minute.

Prevent the MTU from being set bigger than what we can handle.

diffstat:

 sys/net/if_pppoe.c |  21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (64 lines):

diff -r 4a184f0b0f7c -r c619b31ee6fb sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Fri Feb 01 13:35:41 2002 +0000
+++ b/sys/net/if_pppoe.c        Fri Feb 01 13:40:16 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.18 2002/01/14 16:10:33 kleink Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.19 2002/02/01 13:40:16 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Martin Husemann. All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.18 2002/01/14 16:10:33 kleink Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.19 2002/02/01 13:40:16 martin Exp $");
 
 #include "pppoe.h"
 #include "bpfilter.h"
@@ -77,6 +77,9 @@
 #define        PPPOE_CODE_PADS         0x65            /* Active Discovery Session confirmation */
 #define        PPPOE_CODE_PADT         0xA7            /* Active Discovery Terminate */
 
+/* two byte PPP protocol discriminator, then IP data */
+#define        PPPOE_MAXMTU    (ETHERMTU-PPPOE_HEADERLEN-2)
+
 /* Read a 16 bit unsigned value from a buffer */
 #define PPPOE_READ_16(PTR, VAL)                                \
                (VAL) = ((PTR)[0] << 8) | (PTR)[1];     \
@@ -95,7 +98,7 @@
                PPPOE_ADD_16(PTR, LEN)
 
 #define        PPPOE_DISC_TIMEOUT      (hz*5)  /* base for quick timeout calculation */
-#define        PPPOE_SLOW_RETRY        (hz*240)        /* persistent retry interval */
+#define        PPPOE_SLOW_RETRY        (hz*60) /* persistent retry interval */
 #define PPPOE_DISC_MAXPADI     4       /* retry PADI four times (quickly) */
 #define        PPPOE_DISC_MAXPADR      2       /* retry PADR twice */
 
@@ -198,7 +201,7 @@
 
        sprintf(sc->sc_sppp.pp_if.if_xname, "pppoe%d", unit);
        sc->sc_sppp.pp_if.if_softc = sc;
-       sc->sc_sppp.pp_if.if_mtu = ETHERMTU - PPPOE_HEADERLEN - 2; /* two byte PPP protocol discriminator, then IP data */
+       sc->sc_sppp.pp_if.if_mtu = PPPOE_MAXMTU;
        sc->sc_sppp.pp_if.if_flags = IFF_SIMPLEX|IFF_POINTOPOINT|IFF_MULTICAST;
        sc->sc_sppp.pp_if.if_type = IFT_PPP;
        sc->sc_sppp.pp_if.if_hdrlen = sizeof(struct ether_header)+PPPOE_HEADERLEN;
@@ -684,8 +687,16 @@
                        sc->sc_padr_retried = 0;
                        memcpy(&sc->sc_dest, etherbroadcastaddr, sizeof(sc->sc_dest));
                }
+               return sppp_ioctl(ifp, cmd, data);
        }
-       /* FALLTHROUGH */
+       case SIOCSIFMTU:
+       {
+               struct ifreq *ifr = (struct ifreq*) data;
+
+               if (ifr->ifr_mtu > PPPOE_MAXMTU)
+                       return EINVAL;
+               return sppp_ioctl(ifp, cmd, data);
+       }
        default:
                return sppp_ioctl(ifp, cmd, data);
        }



Home | Main Index | Thread Index | Old Index