ppp: noauth server option (import from sources)

This commit is contained in:
cinap_lenrek 2012-08-07 15:57:42 +02:00
parent 36adf27af8
commit 37a93ef857
2 changed files with 47 additions and 37 deletions

View file

@ -4,7 +4,7 @@ ppp, pppoe, pptp, pptpd \- point-to-point protocol
.SH SYNOPSIS .SH SYNOPSIS
.B ip/ppp .B ip/ppp
[ [
.B -CPScdfu .B -CPSacdfu
] [ ] [
.B -b .B -b
.I baud .I baud
@ -112,11 +112,21 @@ This is useful if a program wants to use
in a communications stream. However, the normal mode is to in a communications stream. However, the normal mode is to
specify a communications device, usually a serial line with a modem. specify a communications device, usually a serial line with a modem.
.PP .PP
PPP supports the following options: .I Ppp
supports the following options:
.TP 3
.B a
as server, don't request authentication from the client
.TP .TP
.B b .B b
set the baud rate on the communications device set the baud rate on the communications device
.TP .TP
.B c
disallow packet compression
.TP
.B C
disallow IP header compression
.TP
.B f .B f
make PPP add HDLC framing. This is necessary when using make PPP add HDLC framing. This is necessary when using
PPP over a serial line or a TCP connection PPP over a serial line or a TCP connection
@ -133,6 +143,11 @@ for authentication; the default key pattern is
.B m .B m
set the maximum transfer unit (default 1450) set the maximum transfer unit (default 1450)
.TP .TP
.B M
chat with the modem as specified in the chat file. Each line in
the chat file contains a string that is transmitted to the modem
and the response expected (e.g. 'AT' 'OK')
.TP
.B P .B P
use this as the primary IP interface; set the default use this as the primary IP interface; set the default
route through this interface and write its configuration route through this interface and write its configuration
@ -144,6 +159,14 @@ communicate over
.I dev .I dev
instead of standard I/O instead of standard I/O
.TP .TP
.B S
run as a server
.TP
.B t
before starting the PPP protocol, write
.I modemcmd
to the device
.TP
.B u .B u
before starting the PPP protocol with the remote end, shuttle before starting the PPP protocol with the remote end, shuttle
bytes between the device and standard I/O until an EOF on standard bytes between the device and standard I/O until an EOF on standard
@ -153,28 +176,9 @@ and then type commands at a modem before
.I ppp .I ppp
takes over takes over
.TP .TP
.B S
run as a server
.TP
.B t
before starting the PPP protocol, write
.I modemcmd
to the device
.TP
.B x .B x
use the IP stack mounted at use the IP stack mounted at
.I netmntpt .I netmntpt
.TP
.B M
chat with the modem as specified in the chat file. Each line in
the chat file contains a string that is transmitted to the modem
and the response expected (e.g. 'AT' 'OK')
.TP
.B c
disallow packet compression
.TP
.B C
disallow ip header compression
.PD .PD
.PP .PP
If both the If both the
@ -196,25 +200,25 @@ the ethernet device mounted at
(default (default
.BR /net/ether0 ). .BR /net/ether0 ).
The The
.I pppoe -specific .IR pppoe -specific
options are: options are:
.TP .TP 3
.B A .B A
insist on an access concentrator named insist on an access concentrator named
.I acname .I acname
during PPPoE discovery during PPPoE discovery
.TP .TP
.B S
insist on a service named
.I srvname
during PPPoE discovery
.TP
.B d .B d
write debugging output to standard error, write debugging output to standard error,
and pass and pass
.B -d .B -d
to to
.I ppp .I ppp
.TP
.B S
insist on a service named
.I srvname
during PPPoE discovery
.PD .PD
.PP .PP
The other options are relayed to The other options are relayed to
@ -245,10 +249,15 @@ The TCP connection is used to control the tunnel while
packets are sent back and forth using PPP inside of packets are sent back and forth using PPP inside of
GRE packets. GRE packets.
The options are: The options are:
.TP .TP 3
.B d .B d
write debugging output to standard error. write debugging output to standard error.
.TP .TP
.B D
drop
.I fraction
of the received packets. This is used for testing.
.TP
.B p .B p
use the IP stack mounted at use the IP stack mounted at
.I pppnetmtpt .I pppnetmtpt
@ -257,11 +266,6 @@ to terminate the PPP connection.
.B w .B w
set the receive window to set the receive window to
.IR window . .IR window .
.TP
.B D
drop
.I fraction
of the received packets. This is used for testing.
.PD .PD
.SH SOURCE .SH SOURCE
.B /sys/src/cmd/ip/ppp .B /sys/src/cmd/ip/ppp

View file

@ -17,6 +17,7 @@ static int nocompress;
static int pppframing = 1; static int pppframing = 1;
static int noipcompress; static int noipcompress;
static int server; static int server;
static int noauth;
static int nip; /* number of ip interfaces */ static int nip; /* number of ip interfaces */
static int dying; /* flag to signal to all threads its time to go */ static int dying; /* flag to signal to all threads its time to go */
static int primary; /* this is the primary IP interface */ static int primary; /* this is the primary IP interface */
@ -332,7 +333,7 @@ newstate(PPP *ppp, Pstate *p, int state)
if(p->proto == Plcp) { if(p->proto == Plcp) {
if(state == Sopened) if(state == Sopened)
setphase(ppp, Pauth); setphase(ppp, noauth? Pnet : Pauth);
else if(state == Sclosed) else if(state == Sclosed)
setphase(ppp, Pdead); setphase(ppp, Pdead);
else if(p->state == Sopened) else if(p->state == Sopened)
@ -355,7 +356,7 @@ newstate(PPP *ppp, Pstate *p, int state)
} }
if(p->proto == Pipcp && state == Sopened) { if(p->proto == Pipcp && state == Sopened) {
if(server && ppp->chap->state != Cauthok) if(server && !noauth && ppp->chap->state != Cauthok)
abort(); abort();
err = ipopen(ppp); err = ipopen(ppp);
@ -2658,7 +2659,9 @@ int interactive;
void void
usage(void) usage(void)
{ {
fprint(2, "usage: ppp [-cCdfPSu] [-b baud] [-k keyspec] [-m mtu] [-p dev] [-s username] [-x netmntpt] [-t modemcmd] [local-addr [remote-addr]]\n"); fprint(2, "usage: ppp [-CPSacdfu] [-b baud] [-k keyspec] [-m mtu] "
"[-M chatfile] [-p dev] [-x netmntpt] [-t modemcmd] "
"[local-addr [remote-addr]]\n");
exits("usage"); exits("usage");
} }
@ -2691,6 +2694,9 @@ main(int argc, char **argv)
modemcmd = nil; modemcmd = nil;
ARGBEGIN{ ARGBEGIN{
case 'a':
noauth = 1;
break;
case 'b': case 'b':
baud = atoi(EARGF(usage())); baud = atoi(EARGF(usage()));
if(baud < 0) if(baud < 0)