Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Oct 1995 18:01:09 GMT
From:      nnd@itfs.nsk.su (Nickolay N. Dudorov)
To:        bugs@freebsd.org
Subject:   SLIP problem(s) in STABLE 
Message-ID:  <DGGA1y.Dpr@itfs.nsk.su>

next in thread | raw e-mail | index | archive | help

	It was already discovered that SLIP have some problems
in -current. I found some (same ?) problems in -stable.

1) After succesfully establishing a SLIP connection by
'slattach' on a line with modem and loosing/reestablishing carrier
I can't  use that 'slX' interface due to permanent
'No route to host' messages.

	Reading the sources of /sys/net/if_sl.c and /sys/kern/tty.c
shows that this message must  results from:
/* /sys/net/if_sl.c - lines from 446 */
	if ((sc->sc_ttyp->t_state & TS_CONNECTED) == 0) {
		m_freem(m);
		return (EHOSTUNREACH);
	}

which in turn is a result of (!)-marked lines in
/* /sys/kern/tty.c - function ttymodem, lines from 1319 */
	} else if (flag == 0) {
		/*
		 * Lost carrier.
		 */
		CLR(tp->t_state, TS_CARR_ON);
		if (ISSET(tp->t_state, TS_ISOPEN) &&
!                   !ISSET(tp->t_cflag, CLOCAL)) {
!                       SET(tp->t_state, TS_ZOMBIE);
!                       CLR(tp->t_state, TS_CONNECTED);
			if (tp->t_session && tp->t_session->s_leader)
				psignal(tp->t_session->s_leader, SIGHUP);
			ttyflush(tp, FREAD | FWRITE);
			return (0);
		}
	} else {
		/*
		 * Carrier now on.
		 */
		SET(tp->t_state, TS_CARR_ON);
!               if (!ISSET(tp->t_state, TS_ZOMBIE))
!                       SET(tp->t_state, TS_CONNECTED);
		wakeup(TSA_CARR_ON(tp));
		ttwakeup(tp);
		ttwwakeup(tp);
	}


   As a temporary "solution" ;-( of this problem I make the
next change to /usr/src/sbin/slattach:

--- slattach.c.STABLE	Sat Oct 14 22:16:12 1995
+++ slattach.c	Sat Oct 14 22:55:55 1995
@@ -419,6 +419,18 @@
 			}
 			syslog(LOG_NOTICE, "Carrier now present on %s (sl%d)",
 			       dev, unit);
+			/* This HACK clears TS_ZOMBIE flag and set */
+                       /* TS_CONNECTED, which otherwise remains unset. */
+			tty.c_cflag |= CLOCAL;
+			if (tcsetattr(fd, TCSANOW, &tty) < 0) {
+				syslog(LOG_ERR, "tcsetattr(TCSAFLUSH): %m");
+				exit_handler(1);
+			}
+			tty.c_cflag &= ~CLOCAL;
+			if (tcsetattr(fd, TCSANOW, &tty) < 0) {
+				syslog(LOG_ERR, "tcsetattr(TCSAFLUSH): %m");
+				exit_handler(1);
+			}
 		}
 	}
 	setup_line(0);


 After that I can use my SLIP connection (and this is a kind of
"correctness proof" of my problem analysis :-)

2) There are some "strangenesses(?)" in slattach behaviour

 - 'slX' interface marked as 'UP' even before carrier is
   established on a line;

 - is it really necessary to 'fork' (in 'acquire_line()') every time
   to run 'redial_cmd' (if there is any) ?

 - it seens to me than "resetting to tty discipline" in this
   'acquire_line' can't be done when redialing because there is
   no carrier and switching to CLOCAL is done after that ?

 Unfortunely I have not enough time (and/or knowledges) to find
answers to this questions (even in form of a HACKs) :-(

	N.Dudorov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DGGA1y.Dpr>