From owner-freebsd-bugs Mon Feb 10 9:30: 7 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D837A37B401; Mon, 10 Feb 2003 09:30:04 -0800 (PST) Received: from cell.sick.ru (cell.sick.ru [195.91.162.238]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F80D43F93; Mon, 10 Feb 2003 09:30:02 -0800 (PST) (envelope-from glebius@cell.sick.ru) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.6/8.12.6) with ESMTP id h1AHTxd5010443 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 10 Feb 2003 20:30:00 +0300 (MSK) (envelope-from glebius@cell.sick.ru) Received: (from glebius@localhost) by cell.sick.ru (8.12.6/8.12.6/Submit) id h1AHTxRA010442; Mon, 10 Feb 2003 20:29:59 +0300 (MSK) Date: Mon, 10 Feb 2003 20:29:59 +0300 From: Gleb Smirnoff To: freebsd-bugs@FreeBSD.ORG, FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: kern/47920: if ng_pppoe switches to nonstandard mode it stays in it forever Message-ID: <20030210172959.GA10333@cell.sick.ru> Mail-Followup-To: Gleb Smirnoff , freebsd-bugs@FreeBSD.ORG, FreeBSD-gnats-submit@FreeBSD.ORG References: <200302101320.h1ADK2mE024400@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200302101320.h1ADK2mE024400@freefall.freebsd.org> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Sorry. This one is better. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE --- ng_pppoe.c.orig Mon Feb 10 15:16:04 2003 +++ ng_pppoe.c Mon Feb 10 20:27:34 2003 @@ -166,6 +166,9 @@ ETHERTYPE_PPPOE_DISC}; static int nonstandard; +#define PPPOE_STANDARD 0 /* try standard */ +#define PPPOE_NONSTANDARD 1 /* be nonstandard */ +#define PPPOE_KEEPSTANDARD -1 /* never switch to nonstandard mode */ static int ngpppoe_set_ethertype(SYSCTL_HANDLER_ARGS) { @@ -176,12 +179,19 @@ error = sysctl_handle_int(oidp, &val, sizeof(int), req); if (error != 0 || req->newptr == NULL) return (error); - if (val == 1) { - nonstandard = 1; + switch (val) { + case PPPOE_NONSTANDARD: + nonstandard = PPPOE_NONSTANDARD; eh_prototype.ether_type = ETHERTYPE_PPPOE_STUPID_DISC; - } else { - nonstandard = 0; + break; + case PPPOE_STANDARD: + nonstandard = PPPOE_STANDARD; eh_prototype.ether_type = ETHERTYPE_PPPOE_DISC; + break; + case PPPOE_KEEPSTANDARD: + nonstandard = PPPOE_KEEPSTANDARD; + eh_prototype.ether_type = ETHERTYPE_PPPOE_DISC; + break; } return (0); } @@ -913,8 +923,12 @@ code = wh->ph.code; switch(wh->eh.ether_type) { case ETHERTYPE_PPPOE_STUPID_DISC: - nonstandard = 1; - eh_prototype.ether_type = ETHERTYPE_PPPOE_STUPID_DISC; + if (nonstandard > PPPOE_KEEPSTANDARD) { + nonstandard = PPPOE_NONSTANDARD; + eh_prototype.ether_type = ETHERTYPE_PPPOE_STUPID_DISC; + printf("Switched to nonstandard PPPoE"); + } else + printf("Ignored nonstandard PPPoE"); /* fall through */ case ETHERTYPE_PPPOE_DISC: /* @@ -1098,7 +1112,7 @@ * from NEWCONNECTED to CONNECTED */ sp->pkt_hdr = neg->pkt->pkt_header; - if (nonstandard) + if (nonstandard == PPPOE_NONSTANDARD) sp->pkt_hdr.eh.ether_type = ETHERTYPE_PPPOE_STUPID_SESS; else @@ -1150,7 +1164,7 @@ * Keep a copy of the header we will be using. */ sp->pkt_hdr = neg->pkt->pkt_header; - if (nonstandard) + if (nonstandard == PPPOE_NONSTANDARD) sp->pkt_hdr.eh.ether_type = ETHERTYPE_PPPOE_STUPID_SESS; else @@ -1434,7 +1448,7 @@ /* revert the stored header to DISC/PADT mode */ wh = &sp->pkt_hdr; wh->ph.code = PADT_CODE; - if (nonstandard) + if (nonstandard == PPPOE_NONSTANDARD) wh->eh.ether_type = ETHERTYPE_PPPOE_STUPID_DISC; else wh->eh.ether_type = ETHERTYPE_PPPOE_DISC; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message