[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PPPoE patch for connection problems
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: PPPoE patch for connection problems
- From: Paul Galbraith <paul_(_at_)_paulgalbraith_(_dot_)_net>
- Date: Tue, 17 May 2005 12:29:20 -0400
I've been running this little patch for several weeks and it's been a
real life saver. My ppp connection kept cycling through a never-ending
connect-disconnect cycle, constantly reporting 'connection reset by
peer'. Some investigation showed that my DSL provider (or more likely,
Bell Canada) keeps sending PPPoE PADT tags immediately after a
connection is established.
This patch allows you to play along and keep your connection up by
ignoring the disconnect request...
? pppoe
? pppoe.cat8
Index: client.c
===================================================================
RCS file: /cvs/src/usr.sbin/pppoe/client.c,v
retrieving revision 1.20
diff -u -b -r1.20 client.c
--- client.c 3 Sep 2004 06:37:14 -0000 1.20
+++ client.c 1 May 2005 03:13:10 -0000
@@ -495,6 +495,9 @@
struct ether_header *eh, struct pppoe_header *ph,
u_long len, u_int8_t *pkt)
{
+ if (ignorepadt)
+ return (0);
+
if (bcmp(&eh->ether_shost[0], rmea, ETHER_ADDR_LEN))
return (0);
Index: debug.c
===================================================================
RCS file: /cvs/src/usr.sbin/pppoe/debug.c,v
retrieving revision 1.2
diff -u -b -r1.2 debug.c
Index: pppoe.8
===================================================================
RCS file: /cvs/src/usr.sbin/pppoe/pppoe.8,v
retrieving revision 1.18
diff -u -b -r1.18 pppoe.8
--- pppoe.8 18 Feb 2005 12:19:22 -0000 1.18
+++ pppoe.8 1 May 2005 03:13:10 -0000
@@ -33,7 +33,7 @@
.Nd PPP Over Ethernet translator
.Sh SYNOPSIS
.Nm pppoe
-.Op Fl sv
+.Op Fl stv
.Op Fl i Ar interface
.Op Fl n Ar service
.Op Fl p Ar system
@@ -74,6 +74,14 @@
Otherwise,
.Nm
runs as a client.
+.It Fl t
+Instruct
+.Nm
+to ignore PADT packets. If you observe numerous
+"connection reset by peer" error messages and constantly
+lose connection soon after establishing one, it may because
+of spurious PADT tags being sent from the peer. Ignoring them
+may alleviate the problem.
.It Fl v
For each use of the flag, the verbosity of
.Nm pppoe
Index: pppoe.c
===================================================================
RCS file: /cvs/src/usr.sbin/pppoe/pppoe.c,v
retrieving revision 1.15
diff -u -b -r1.15 pppoe.c
--- pppoe.c 20 Sep 2004 17:51:07 -0000 1.15
+++ pppoe.c 1 May 2005 03:13:10 -0000
@@ -53,6 +53,7 @@
#include "pppoe.h"
int option_verbose = 0;
+int ignorepadt = 0;
u_char etherbroadcastaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
int main(int, char **);
@@ -78,7 +79,7 @@
if ((pw = getpwnam("_ppp")) == NULL)
err(EX_CONFIG, "getpwnam(\"_ppp\")");
- while ((c = getopt(argc, argv, "svi:n:p:")) != -1) {
+ while ((c = getopt(argc, argv, "stvi:n:p:")) != -1) {
switch (c) {
case 'i':
if (ifname != NULL) {
@@ -108,6 +109,13 @@
}
smode = 1;
break;
+ case 't':
+ if (ignorepadt) {
+ usage();
+ return (EX_USAGE);
+ }
+ ignorepadt = 1;
+ break;
case 'v':
option_verbose++;
break;
@@ -463,7 +471,7 @@
{
extern char *__progname;
- fprintf(stderr,"%s [-sv] [-i interface] [-n service] [-p system]\n",
+ fprintf(stderr,"%s [-stv] [-i interface] [-n service] [-p system]\n",
__progname);
}
Index: pppoe.h
===================================================================
RCS file: /cvs/src/usr.sbin/pppoe/pppoe.h,v
retrieving revision 1.7
diff -u -b -r1.7 pppoe.h
--- pppoe.h 6 May 2004 20:29:04 -0000 1.7
+++ pppoe.h 1 May 2005 03:13:10 -0000
@@ -81,6 +81,7 @@
#define PPPOE_TAG_GENERIC_ERROR 0x0203 /* Generic Error */
extern int option_verbose;
+extern int ignorepadt;
extern u_char etherbroadcastaddr[];
void server_mode(int, u_int8_t *, u_int8_t *, struct ether_addr *);
Visit your host, monkey.org