Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix stall on PPPOE_STATE_PADR_SENT, suggested by mar...



details:   https://anonhg.NetBSD.org/src/rev/63e2162c38ac
branches:  trunk
changeset: 368976:63e2162c38ac
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Mon Aug 15 08:28:41 2022 +0000

description:
Fix stall on PPPOE_STATE_PADR_SENT, suggested by martin@n.o, thanks.

Just drop such large PADO frames, ok'ed by yamaguchi@n.o.

I left if_pppoe.c:r1.182 code because that fixes other issues such as
pppoe(4) stall in PPPOE_STATE_PADR_SENT when the PADO sender never
replys.

diffstat:

 sys/net/if_pppoe.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 6f26e065752e -r 63e2162c38ac sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Mon Aug 15 04:58:52 2022 +0000
+++ b/sys/net/if_pppoe.c        Mon Aug 15 08:28:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.182 2022/08/12 06:24:03 knakahara Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.183 2022/08/15 08:28:41 knakahara Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.182 2022/08/12 06:24:03 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.183 2022/08/15 08:28:41 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -988,6 +988,19 @@
                sc->sc_padr_retried = 0;
                sc->sc_state = PPPOE_STATE_PADR_SENT;
                if ((err = pppoe_send_padr(sc)) != 0) {
+                       if (err == ENOBUFS) {
+                               pppoe_printf(sc, "PADO is too large, drop it\n");
+                               /*
+                                * Cannot send PADR generated by received PADO,
+                                * so restart from sending PAD*I*.
+                                */
+                               sc->sc_state = PPPOE_STATE_PADI_SENT;
+                               callout_schedule(&sc->sc_timeout,
+                                   PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried));
+                               PPPOE_UNLOCK(sc);
+                               goto done;
+                       }
+
                        pppoe_printf(sc,
                            "failed to send PADR, error=%d\n", err);
                }



Home | Main Index | Thread Index | Old Index