Subject: bin/3586: SLIP over non-full modem cable does not work
To: None <gnats-bugs@gnats.netbsd.org>
From: None <he@runit.sintef.no>
List: netbsd-bugs
Date: 05/08/1997 12:54:07
>Number:         3586
>Category:       bin
>Synopsis:       SLIP over non-full modem cable does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu May  8 04:05:01 1997
>Last-Modified:
>Originator:     Havard Eidnes
>Organization:
	SINTEF RUNIT
>Release:        NetBSD-current May 1 1997
>Environment:
System: NetBSD snylteveps.runit.sintef.no 1.2D NetBSD 1.2D (XPI) #5: Thu May 8 12:27:08 MEST 1997 root@snylteveps.runit.sintef.no:/usr/src/sys/arch/i386/compile/XPI i386


>Description:
	slattach forces a clear of the CLOCAL flag in cflags
	when it is run, thus invalidating other efforts to set the
	CLOCAL flag (e.g. via tip and/or stty).  This makes it impossible
	to run SLIP over a cable which only has the bare minimum of
	signals available, e.g. where the carrier detect signal is missing.

	Also, it's a little hard to distinguish between genuine routing
	problems and problems caused by this, since the slip output routine
	in if_sl.c returns EHOSTUNREACH whenever carrier is missing.
>How-To-Repeat:
	See above plus code in slattach.c and if_sl.c.
>Fix:
	The enhancements below fix this, by first adding a -l option
	to slattach (for "local"), plus makes if_sl.c a little more
	verbose in the case of "lost carrier and CLOCAL not set".

*** /usr/src/usr.sbin/slattach/slattach.c.dist	Mon May 20 13:44:07 1996
--- /usr/src/usr.sbin/slattach/slattach.c	Thu May  8 12:37:04 1997
***************
*** 92,100 ****
  	sigset_t sigset;
  
! 	while ((ch = getopt(argc, argv, "hms:t:")) != -1) {
  		switch (ch) {
  		case 'h':
  			cflag |= CRTSCTS;
  			break;
  		case 'm':
  			cflag &= ~HUPCL;
--- 92,103 ----
  	sigset_t sigset;
  
! 	while ((ch = getopt(argc, argv, "hlms:t:")) != -1) {
  		switch (ch) {
  		case 'h':
  			cflag |= CRTSCTS;
  			break;
+ 		case 'l':
+ 			cflag |= CLOCAL;
+ 			break;
  		case 'm':
  			cflag &= ~HUPCL;
***************
*** 167,171 ****
  
  	(void)fprintf(stderr,
! 		      "usage: slattach [-t ldisc] [-hm] [-s baudrate] ttyname\n");
  	exit(1);
  }
--- 170,174 ----
  
  	(void)fprintf(stderr,
! 		      "usage: slattach [-t ldisc] [-hlm] [-s baudrate] ttyname\n");
  	exit(1);
  }
*** /usr/src/usr.sbin/slattach/slattach.8.dist	Thu May  8 12:45:09 1997
--- /usr/src/usr.sbin/slattach/slattach.8	Thu May  8 12:44:27 1997
***************
*** 54,57 ****
--- 54,60 ----
  .It Fl h
  Turn on RTS/CTS flow control.  By default, no flow control is done.
+ .lt Fl l
+ Turn on the CLOCAL flag, thus making it possible to run SLIP with a
+ cable which doesn't have all the modem control signals.
  .It Fl m
  Maintain modem control signals after closing the line.  Specifically,
*** /sys/net/if_sl.c.dist	Fri Mar 28 13:21:49 1997
--- /sys/net/if_sl.c	Thu May  8 12:17:41 1997
***************
*** 402,405 ****
--- 402,406 ----
  	    (sc->sc_ttyp->t_cflag & CLOCAL) == 0) {
  		m_freem(m);
+ 		printf("slip: no carrier and not local\n");
  		return (EHOSTUNREACH);
  	}
>Audit-Trail:
>Unformatted: