shithub: riscv

Download patch

ref: bd0f48b3579968c011e17a4c6acce3826e4395f6
parent: 74d4d8a26e876e54f5070d993478adde86cef34f
author: cinap_lenrek <[email protected]>
date: Tue Mar 15 18:18:05 EDT 2016

ppp: md5 and mschap inside chap, do not request encryption with -c or -C (thanks k0ga)

p2.patch: Do not request encriptation with -c or -C in ppp
(it was a bit annoying request compression, and when the ACK
from the server was received then send a NAK).

p3.patch: Add support for md5 and mschap in in chap
(without this patch ppp was passing to the net stage
without worring about chap).

--- a/sys/src/cmd/ip/ppp/ppp.c
+++ b/sys/src/cmd/ip/ppp/ppp.c
@@ -243,12 +243,21 @@
 		}
 		break;
 	case Pauth:
-		if(server)
+		if(server) {
 			chapinit(ppp);
-		else if(ppp->chap->proto == APpasswd)
-			papinit(ppp);
-		else
-			setphase(ppp, Pnet);
+		} else {
+			switch (ppp->chap->proto) {
+			case APpasswd:
+				papinit(ppp);
+				break;
+			case APmd5:
+			case APmschap:
+				break;
+			default:
+				setphase(ppp, Pnet);
+				break;
+			}
+		}
 		break;
 	case Pnet:
 		pinit(ppp, ppp->ccp);
@@ -276,7 +285,14 @@
 		ppp->rctlmap = 0;
 		ppp->ipcp->state = Sclosed;
 		ppp->ipcp->optmask = 0xffffffff;
-
+		if(noipcompress) {
+			p->optmask &= ~Fac;
+			ppp->ipcp->optmask &= ~Fipaddrs;
+		}
+		if(nocompress) {
+			p->optmask &= ~Fpc;
+			ppp->ipcp->optmask &= ~Fipcompress;
+		}
 		p->echotimeout = 0;
 
 		/* quality goo */