Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/sys/net Pull up revision 1.45 (requested by martin in t...
details: https://anonhg.NetBSD.org/src/rev/d6c8fb44c091
branches: netbsd-1-6
changeset: 530618:d6c8fb44c091
user: tron <tron%NetBSD.org@localhost>
date: Tue Aug 26 14:41:37 2003 +0000
description:
Pull up revision 1.45 (requested by martin in ticket #1438):
When trying to (re-)establish a session cope with intermediate output
failures of the underlying ethernet interface - just keep trying.
diffstat:
sys/net/if_pppoe.c | 87 ++++++++++++++++++++++++++++-------------------------
1 files changed, 46 insertions(+), 41 deletions(-)
diffs (146 lines):
diff -r 984693401ae7 -r d6c8fb44c091 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c Tue Aug 26 14:38:01 2003 +0000
+++ b/sys/net/if_pppoe.c Tue Aug 26 14:41:37 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.24.4.15 2003/03/04 05:49:44 jmc Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.24.4.16 2003/08/26 14:41:37 tron Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.24.4.15 2003/03/04 05:49:44 jmc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.24.4.16 2003/08/26 14:41:37 tron Exp $");
#include "pppoe.h"
#include "bpfilter.h"
@@ -393,7 +393,7 @@
struct pppoehdr *ph;
struct pppoetag *pt;
struct mbuf *n;
- int noff;
+ int noff, err;
struct ether_header *eh;
if (m->m_len < sizeof(*eh)) {
@@ -535,12 +535,15 @@
callout_stop(&sc->sc_timeout);
sc->sc_padr_retried = 0;
sc->sc_state = PPPOE_STATE_PADR_SENT;
- if (pppoe_send_padr(sc) == 0)
- callout_reset(&sc->sc_timeout,
- PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried),
- pppoe_timeout, sc);
- else
- pppoe_abort_connect(sc);
+ if ((err = pppoe_send_padr(sc)) != 0) {
+ if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
+ printf("%s: failed to send PADR, "
+ "error=%d\n", sc->sc_sppp.pp_if.if_xname,
+ err);
+ }
+ callout_reset(&sc->sc_timeout,
+ PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried),
+ pppoe_timeout, sc);
break;
case PPPOE_CODE_PADS:
if (sc == NULL)
@@ -895,7 +898,7 @@
static void
pppoe_timeout(void *arg)
{
- int x, retry_wait;
+ int x, retry_wait, err;
struct pppoe_softc *sc = (struct pppoe_softc*)arg;
#ifdef PPPOE_DEBUG
@@ -929,11 +932,15 @@
return;
}
}
- if (pppoe_send_padi(sc) == 0)
- callout_reset(&sc->sc_timeout, retry_wait,
- pppoe_timeout, sc);
- else
- pppoe_abort_connect(sc);
+ if ((err = pppoe_send_padi(sc)) != 0) {
+ sc->sc_padi_retried--;
+ if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
+ printf("%s: failed to transmit PADI, "
+ "error=%d\n",
+ sc->sc_sppp.pp_if.if_xname, err);
+ }
+ callout_reset(&sc->sc_timeout, retry_wait,
+ pppoe_timeout, sc);
splx(x);
break;
@@ -945,21 +952,29 @@
sizeof(sc->sc_dest));
sc->sc_state = PPPOE_STATE_PADI_SENT;
sc->sc_padr_retried = 0;
- if (pppoe_send_padi(sc) == 0)
- callout_reset(&sc->sc_timeout,
- PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried),
- pppoe_timeout, sc);
- else
- pppoe_abort_connect(sc);
+ if ((err = pppoe_send_padi(sc)) != 0) {
+ if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
+ printf("%s: failed to send PADI"
+ ", error=%d\n",
+ sc->sc_sppp.pp_if.if_xname,
+ err);
+ }
+ callout_reset(&sc->sc_timeout,
+ PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried),
+ pppoe_timeout, sc);
splx(x);
return;
}
- if (pppoe_send_padr(sc) == 0)
- callout_reset(&sc->sc_timeout,
- PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried),
- pppoe_timeout, sc);
- else
- pppoe_abort_connect(sc);
+ if ((err = pppoe_send_padr(sc)) != 0) {
+ sc->sc_padr_retried--;
+ if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
+ printf("%s: failed to send PADR, "
+ "error=%d\n", sc->sc_sppp.pp_if.if_xname,
+ err);
+ }
+ callout_reset(&sc->sc_timeout,
+ PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried),
+ pppoe_timeout, sc);
splx(x);
break;
case PPPOE_STATE_CLOSING:
@@ -985,20 +1000,10 @@
sc->sc_state = PPPOE_STATE_PADI_SENT;
sc->sc_padr_retried = 0;
err = pppoe_send_padi(sc);
- if (err != 0) {
- /*
- * We failed to send a single PADI packet.
- * This is unfortunate, because we have no good way to recover
- * from here.
- */
-
- /* recover state and return the error */
- sc->sc_state = PPPOE_STATE_INITIAL;
- sc->sc_padr_retried = retry;
- } else {
- callout_reset(&sc->sc_timeout, PPPOE_DISC_TIMEOUT,
- pppoe_timeout, sc);
- }
+ if (err != 0 && sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
+ printf("%s: failed to send PADI, error=%d\n",
+ sc->sc_sppp.pp_if.if_xname, err);
+ callout_reset(&sc->sc_timeout, PPPOE_DISC_TIMEOUT, pppoe_timeout, sc);
splx(x);
return err;
}
Home |
Main Index |
Thread Index |
Old Index