Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Oct 1995 09:09:50 +0100 (MET)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        bugs@freebsd.org, nnd@itfs.nsk.su
Subject:   Re: SLIP problem(s) in STABLE
Message-ID:  <199510150809.JAA17931@uriah.heep.sax.de>
In-Reply-To: <199510142342.JAA29837@godzilla.zeta.org.au> from "Bruce Evans" at Oct 15, 95 09:42:25 am

next in thread | previous in thread | raw e-mail | index | archive | help
As Bruce Evans wrote:

> >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.

> Urk.  The !TS_CONNECTED state is now sticky, as is required by POSIX and
> for security (*).  Once carrier drops, further carrier rises are ignored
> until after the line is completely (+) closed and then reopened.

I'm suffering from the same.  Lousy modem, lousy lines: the modem
drops carrier for less than a second sometimes, and then finds out
that the line went back, and rises DCD again.  I can see it at the
front LEDs.  Security issues aside, people with cheap modems won't
like us. :-(

Interestingly, iijppp doesn't seem to give up immediately with the
same modem and the same lines.  (I have the option to use both
protocols.)

> But why doesn't forking and exiting work?  Perhaps you started slattach
> from inside a terminal program and didn't exit from the terminal program.
> The terminal program then holds the line open so there is no way for
> slattach to close it.  Terminal programs should be called from inside
> slattach, not the other way round.

In my case: i don't do it this way.  I use the following script:

...
# redirect stdin first, so the tty remains open with the new tty settings
open(STDIN,  "<$dev");

$debug && print(LOG "sttying $dev for $speed\n");
system "stty", "-f", $dev, $speed, "crtscts";

# now that stty is done, we can redirect stdout, too
# (stty doesn't like redirected stdout)
open(STDOUT, ">$dev");

...
    $status = system("chat", "-v", "", "ATE1Q0M1", "OK", "$phone",
                     "gin:-\\r-gin:", "$sluser",
                     "ord:", "$slpass", "");
...

if($status) {
    kill 'TERM', $lockdpid;
    die "Chat failed\n";
}

# route(8) wants to have a _real_ uid of 0, grant this...
$< = $>;

...
system("slattach", "-h",
       "-c",
       "-e", "/etc/sliphome/goodbye $dev $lockdpid $defaultroute",
       "-s", "$speed",
       "-u", 
       "/etc/sliphome/conf $myname $remote $netmask $defaultroute",
       $dev);

sleep(1);                       # let things settle before we exit
exit(0);


That is, the Perl script first opens the line, calls chat(1) to dial
the phone number, and finally transfers the line to slattach(8).
Since the script itself exits then, slattach is the only process
holding the line open.


> TIOCSETD only requires an open line.  It's unnecessary to reset the
> discipline because reopening resets it.

Are you absolutely sure?

Oct  9 03:01:25 uriah mgetty[3279]: tcsetattr failed: Inappropriate ioctl for device
Oct  9 03:01:25 uriah mgetty[3279]: tcgetattr failed: Inappropriate ioctl for device
Oct  9 03:01:25 uriah mgetty[3279]: tcsetattr failed: Inappropriate ioctl for device
Oct  9 03:01:29 uriah mgetty[3279]: do_chat: error in read(): Input/output error

I once had a hard time (endlessly respawning mgetty) until i found
that "stty tty" would do the trick.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



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