New option: -S #: set SLIP unit number

This commit is contained in:
ache 1995-09-18 14:01:11 +00:00
parent 403d6f6b4d
commit a23d159531
2 changed files with 18 additions and 5 deletions

View File

@ -55,6 +55,7 @@
.Op Fl w Ar retry_pause
.Op Fl K Ar keepalive
.Op Fl O Ar outfill
.Op Fl S Ar unit
.Ar device user passwd
.Sh DESCRIPTION
.Pp
@ -172,6 +173,10 @@ Set SLIP "out fill" timeout in seconds. It cause at least one FRAME_END
will be sended during this timeout.
Needed for "keep alive" timeout on other side.
Default value is no timeout.
.It Fl S Ar unit
Set SLIP unit number directly. Use with caution, no check for two
interfaces with same number made.
Default is dynamic assignment.
.El
.Sh FILES
.Bl -tag -width /var/run/startslip.<device>.pid -compact

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: startslip.c,v 1.13 1995/09/16 05:18:20 ache Exp $
* $Id: startslip.c,v 1.14 1995/09/17 21:47:24 ache Exp $
*/
#ifndef lint
@ -69,6 +69,7 @@ int speed = DEFAULT_BAUD;
#define FC_HW 1 /* flow control: hardware (RTS/CTS) */
int flowcontrol = FC_NONE;
int modem_control = 1; /* !CLOCAL+HUPCL iff we watch carrier. */
int sl_unit = -1;
char *annex;
int hup;
int terminate;
@ -120,7 +121,7 @@ main(argc, argv)
pid_t pid;
struct termios t;
while ((ch = getopt(argc, argv, "dhlb:s:t:w:A:U:D:W:K:O:")) != EOF)
while ((ch = getopt(argc, argv, "dhlb:s:t:w:A:U:D:W:K:O:S:")) != EOF)
switch (ch) {
case 'd':
debug = 1;
@ -166,6 +167,9 @@ main(argc, argv)
case 'O':
outfill = atoi(optarg);
break;
case 'S':
sl_unit = atoi(optarg);
break;
case '?':
default:
usage();
@ -422,6 +426,10 @@ main(argc, argv)
devicename);
down(2);
}
if (sl_unit >= 0 && ioctl(fd, SLIOCSUNIT, &sl_unit) < 0) {
syslog(LOG_ERR, "ioctl(SLIOCSUNIT): %m");
down(2);
}
if (ioctl(fd, SLIOCGUNIT, (caddr_t)&unitnum) < 0) {
syslog(LOG_ERR, "ioctl(SLIOCGUNIT): %m");
down(2);
@ -572,9 +580,9 @@ down(code)
usage()
{
(void)fprintf(stderr, "\
usage: startslip [-d] [-b speed] [-s string1 [-s string2 [...]]] [-A annexname]\n\
[-h] [-l] [-U upscript] [-D downscript] [-t script_timeout]\n\
[-w retry_pause] [-W maxtries] [-K keepalive] [-O outfill]\n\
usage: startslip [-d] [-b speed] [-s string1 [-s string2 [...]]] [-A annexname] \\\n\
[-h] [-l] [-U upscript] [-D downscript] [-t script_timeout] \\\n\
[-w retry_pause] [-W maxtries] [-K keepalive] [-O outfill] [-S unit] \\\n\
device user passwd\n");
exit(1);
}