diff options
author | ache <ache@FreeBSD.org> | 1996-03-12 23:14:45 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-03-12 23:14:45 +0000 |
commit | 788abb32883136336db17e5fa31912675c701682 (patch) | |
tree | 91238b486548912918f0a1e747567a7c073241d8 /sbin | |
parent | 523d221c7fef5f818ba48108b0d22b909b32bf23 (diff) | |
download | FreeBSD-src-788abb32883136336db17e5fa31912675c701682.zip FreeBSD-src-788abb32883136336db17e5fa31912675c701682.tar.gz |
Properly distinguish 3 different cases:
No redial command. Empty redial command. Non-empty redial command.
Pointed-by: bde
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/slattach/slattach.8 | 10 | ||||
-rw-r--r-- | sbin/slattach/slattach.c | 23 |
2 files changed, 23 insertions, 10 deletions
diff --git a/sbin/slattach/slattach.8 b/sbin/slattach/slattach.8 index 2642320..ef0d52a 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 05b2354..be4bf1a 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. */ |