diff --git a/sbin/slattach/slattach.8 b/sbin/slattach/slattach.8 index 2642320b81bb..ef0d52a98d56 100644 --- a/sbin/slattach/slattach.8 +++ b/sbin/slattach/slattach.8 @@ -31,7 +31,7 @@ .\" .\" @(#)slattach.8 6.4 (Berkeley) 3/16/91 .\" -.\" $Header: /home/ncvs/src/sbin/slattach/slattach.8,v 1.9 1996/01/29 23:52:39 mpp Exp $ +.\" $Header: /home/ncvs/src/sbin/slattach/slattach.8,v 1.10 1996/02/17 19:21:40 ache Exp $ .\" .Dd April 4, 1993 .Dt SLATTACH 8 @@ -99,7 +99,13 @@ to prevent slow lines being saturated by ICMP responses. .It Fl r Ar redial-command Specifies a command to be invoked within a shell .Ql sh \-c Ar redial-command -whenever carrier is lost on the line. +whenever carrier is lost on the modem line. +Empty +.Ar redial-command +i.e. +.Fl r Qq "" +cause connection reestablishing on leased line +without any external command invoked. .It Fl s Ar baudrate Specifies the speed of the connection. If not specified, the default of 9600 is used. diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c index 05b235414342..be4bf1ae7591 100644 --- a/sbin/slattach/slattach.c +++ b/sbin/slattach/slattach.c @@ -239,8 +239,7 @@ int main(int argc, char **argv) kill (getpid(), SIGHUP); } else configure_network(); - } - else + } else configure_network(); /* configure the network if needed. */ for (;;) { @@ -450,14 +449,18 @@ void configure_network() void sighup_handler() { if(exiting) return; -again: - acquire_line(); /* reopen dead line */ + if (redial_cmd == NULL) { + syslog(LOG_NOTICE,"SIGHUP on %s (sl%d); exiting", dev, unit); + exit_handler(1); + } +again: /* invoke a shell for redial_cmd or punt. */ - if (redial_cmd) { + if (*redial_cmd) { + syslog(LOG_NOTICE,"SIGHUP on %s (sl%d); running '%s'", + dev, unit, redial_cmd); + acquire_line(); /* reopen dead line */ setup_line(CLOCAL); - syslog(LOG_NOTICE,"SIGHUP on %s (sl%d); running %s", - dev,unit,redial_cmd); if (locked) { if (uucp_lock) uu_unlock(dvname); /* for redial */ @@ -487,12 +490,16 @@ again: } } else setup_line(0); - } else { + } else { /* Empty redial command */ + syslog(LOG_NOTICE,"SIGHUP on %s (sl%d); reestablish connection", + dev, unit); + acquire_line(); /* reopen dead line */ setup_line(0); /* restore ospeed from hangup (B0) */ /* If modem control, just wait for carrier before attaching. If no modem control, just fall through immediately. */ if (!(modem_control & CLOCAL)) { int carrier = 0; + syslog(LOG_NOTICE, "Waiting for carrier on %s (sl%d)", dev, unit); /* Now wait for carrier before attaching line. */