deal with change in setting of slip params

This commit is contained in:
cgd 1993-12-10 13:19:12 +00:00
parent 6401f7c13a
commit 9fa00062f5
4 changed files with 11 additions and 81 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)slattach.8 6.4 (Berkeley) 3/16/91
.\" $Id: slattach.8,v 1.6 1993/12/02 05:44:26 mycroft Exp $
.\" $Id: slattach.8,v 1.7 1993/12/10 13:19:49 cgd Exp $
.\"
.Dd April 4, 1993
.Dt SLATTACH 8
@ -40,11 +40,8 @@
.Nd attach serial lines as network interfaces
.Sh SYOPNSIS
.Nm Slattach
.Op \-a
.Op \-c
.Op \-h
.Op \-m
.Op \-n
.Op \-s baudrate
.Ar ttyname
.Sh DESCRIPTION
@ -54,13 +51,6 @@ and to define the network source and destination addresses.
The following operands are supported by
.Nm slattach :
.Bl -tag -width Ar
.It Ar \-a
Autoenable the VJ header compression option, if the other end of the link
is capable of VJ header compression then it will be used otherwise normal
headers will be used.
.It Ar \-c
Enables the VJ header compression option. Note that both ends of the link
must be able to use VJ header compression for this to work.
.It Ar \-h
Turn on CTS/RTS style flow control on the slip port, by default no flow
control is done.
@ -68,9 +58,6 @@ control is done.
Maintain modem control signals after closing the tty. If not specified,
HUPCL is set, causing DTR to be dropped on the last close of the tty
device.
.It Ar \-n
Throw away ICMP packets. The slip interface will ignore ICMP packets
to prevent slow lines being saturated by ICMP responses.
.It Ar \-s baudrate
Specifies the speed of the connection. If not specified, the
default of 9600 is used.

View File

@ -35,20 +35,11 @@
*/
/*
** Hacks to support "-a|c|n" flags on the command line which enalbe VJ
** header compresion and disable ICMP. I use getopt to deal witht that
** stuff because I'm a lazy sob, I can't spell, and that's OK.
**
** If this is good all rights go to B & L Jolitz, otherwise send your
** comments to Reagan (/dev/null).
**
** nerd@percival.rain.com (Michael Galassi) 92.09.03
**
** Hacked to change from sgtty to POSIX termio style serial line control
** and added flag to enable cts/rts style flow control.
**
** blymn@awadi.com.au (Brett Lymn) 93.04.04
*/
* Hacked to change from sgtty to POSIX termio style serial line control
* and added flag to enable cts/rts style flow control.
*
* blymn@awadi.com.au (Brett Lymn) 93.04.04
*/
#ifndef lint
char copyright[] =
@ -58,7 +49,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)slattach.c 4.6 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: slattach.c,v 1.8 1993/12/02 05:44:30 mycroft Exp $";
static char rcsid[] = "$Id: slattach.c,v 1.9 1993/12/10 13:20:12 cgd Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -76,12 +67,9 @@ static char rcsid[] = "$Id: slattach.c,v 1.8 1993/12/02 05:44:30 mycroft Exp $";
#define DEFAULT_BAUD 9600
static char usage_str[] = "\
usage: %s [-a] [-c] [-h] [-m] [-n] [-s <speed>] <device>\n\
-a -- autoenable VJ compression\n\
-c -- enable VJ compression\n\
usage: %s [-h] [-m] [-s <speed>] <device>\n\
-h -- turn on CTS/RTS style flow control\n\
-m -- maintain DTR after last close (no HUPCL)\n\
-n -- throw out ICMP packets\n\
-s -- baud rate (default 9600)\n";
int main(int argc, char **argv)
@ -93,7 +81,6 @@ int main(int argc, char **argv)
char *dev = (char *)0;
int slipdisc = SLIPDISC;
int speed = DEFAULT_BAUD;
int slflags = 0;
int cflags = HUPCL;
extern char *optarg;
@ -101,23 +88,12 @@ int main(int argc, char **argv)
while ((option = getopt(argc, argv, "achmns:")) != EOF) {
switch (option) {
case 'a':
slflags |= SC_AUTOCOMP;
slflags &= ~SC_COMPRESS;
break;
case 'c':
slflags |= SC_COMPRESS;
slflags &= ~SC_AUTOCOMP;
break;
case 'h':
cflags |= CRTSCTS;
break;
case 'm':
cflags &= ~HUPCL;
break;
case 'n':
slflags |= SC_NOICMP;
break;
case 's':
speed = atoi(optarg);
break;
@ -131,7 +107,6 @@ int main(int argc, char **argv)
if (optind == argc - 1)
dev = argv[optind];
if (dev == (char *)0) {
fprintf(stderr, usage_str, argv[0]);
exit(2);
@ -180,12 +155,6 @@ int main(int argc, char **argv)
exit(1);
}
if (ioctl(fd, SLIOCSFLAGS, &slflags) < 0) {
perror("ioctl(SLIOCSFLAGS)");
close(fd);
exit(1);
}
if (fork() > 0)
exit(0);

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# @(#)slip.login 8.1 (Berkeley) 6/6/93
# @(#)slip.login 5.1 (Berkeley) 7/1/90
#
# generic login file for a slip line. sliplogin invokes this with
@ -8,5 +8,5 @@
# 1 2 3 4 5 6 7-n
# slipunit ttyspeed loginname local-addr remote-addr mask opt-args
#
/sbin/ifconfig sl$1 inet $4 $5 netmask $6
/sbin/ifconfig sl$1 inet $4 $5 netmask $6 $7 $8 $9 $10 $11
exit

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)sliplogin.c 5.6 (Berkeley) 3/2/91";*/
static char rcsid[] = "$Id: sliplogin.c,v 1.5 1993/12/07 23:05:26 mycroft Exp $";
static char rcsid[] = "$Id: sliplogin.c,v 1.6 1993/12/10 13:19:20 cgd Exp $";
#endif /* not lint */
/*
@ -97,23 +97,12 @@ static char rcsid[] = "$Id: sliplogin.c,v 1.5 1993/12/07 23:05:26 mycroft Exp $"
#include "pathnames.h"
int unit;
int slip_mode;
int speed;
int uid;
char loginargs[BUFSIZ];
char loginfile[MAXPATHLEN];
char loginname[BUFSIZ];
struct slip_modes {
char *sm_name;
int sm_value;
} modes[] = {
"normal", 0,
"compress", SC_COMPRESS,
"noicmp", SC_NOICMP,
"autocomp", SC_AUTOCOMP
};
void
findid(name)
char *name;
@ -144,17 +133,6 @@ findid(name)
if (strcmp(user, name) != 0)
continue;
slip_mode = 0;
for (i = 0; i < n - 4; i++) {
for (j = 0; j < sizeof(modes)/sizeof(struct slip_modes);
j++) {
if (strcmp(modes[j].sm_name, slopt[i]) == 0) {
slip_mode |= modes[j].sm_value;
break;
}
}
}
/*
* we've found the guy we're looking for -- see if
* there's a login file we can use. First check for
@ -366,10 +344,6 @@ main(argc, argv)
(void) ioctl(0, TIOCSETD, (caddr_t)&odisc);
exit(6);
}
if (ioctl(0, SLIOCSFLAGS, (caddr_t)&slip_mode) < 0) {
syslog(LOG_ERR, "ioctl (SLIOCSFLAGS): %m");
exit(1);
}
/* twiddle thumbs until we get a signal */
while (1)