From a0cbd833f36a8874a2770e45e3ecfa9f0eb700e1 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Mon, 16 Mar 1998 22:53:15 +0000 Subject: [PATCH] Move `CleaningUp' into struct bundle. --- usr.sbin/ppp/bundle.c | 9 +++++---- usr.sbin/ppp/bundle.h | 5 +++-- usr.sbin/ppp/chap_ms.c | 6 +++--- usr.sbin/ppp/main.c | 9 ++++----- usr.sbin/ppp/main.h | 4 +--- usr.sbin/ppp/prompt.c | 4 ++-- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 0eb859090c24..4d8b22a5b65b 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bundle.c,v 1.1.2.25 1998/03/13 21:07:27 brian Exp $ + * $Id: bundle.c,v 1.1.2.26 1998/03/16 22:51:45 brian Exp $ */ #include @@ -391,7 +391,8 @@ bundle_Create(const char *prefix) LogPrintf(LogPHASE, "Using interface: %s\n", bundle.ifname); bundle.routing_seq = 0; - bundle.phase = 0; + bundle.phase = PHASE_DEAD; + bundle.CleaningUp = 0; bundle.fsm.LayerStart = bundle_LayerStart; bundle.fsm.LayerUp = bundle_LayerUp; @@ -607,7 +608,7 @@ bundle_LinkLost(struct bundle *bundle, struct link *link, int staydown) * and MAY cause a program exit. */ - if ((mode & MODE_DIRECT) || CleaningUp) + if ((mode & MODE_DIRECT) || bundle->CleaningUp) staydown = 1; datalink_Down(bundle->links, staydown); } @@ -622,7 +623,7 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl) */ if (mode & (MODE_BACKGROUND|MODE_DIRECT)) - CleaningUp = 1; + bundle->CleaningUp = 1; if (!(mode & MODE_AUTO)) bundle_DownInterface(bundle); diff --git a/usr.sbin/ppp/bundle.h b/usr.sbin/ppp/bundle.h index f38c4405737b..04f212ebf0e7 100644 --- a/usr.sbin/ppp/bundle.h +++ b/usr.sbin/ppp/bundle.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bundle.h,v 1.1.2.16 1998/03/13 21:07:27 brian Exp $ + * $Id: bundle.h,v 1.1.2.17 1998/03/16 22:51:47 brian Exp $ */ #define PHASE_DEAD 0 /* Link is dead */ @@ -46,6 +46,8 @@ struct bundle { int routing_seq; /* The current routing sequence number */ u_int phase; /* Curent phase */ + unsigned CleaningUp : 1; /* Going to exit.... */ + struct fsm_parent fsm; /* Our callback functions */ struct datalink *links; /* Our data links */ @@ -64,7 +66,6 @@ struct bundle { struct filter alive; /* keep-alive packet filter */ } filter; - struct pppTimer IdleTimer; /* timeout after cfg.idle_timeout */ }; diff --git a/usr.sbin/ppp/chap_ms.c b/usr.sbin/ppp/chap_ms.c index 5ae1d2942c74..d0767d05fd8d 100644 --- a/usr.sbin/ppp/chap_ms.c +++ b/usr.sbin/ppp/chap_ms.c @@ -19,7 +19,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap_ms.c,v 1.4 1997/12/24 09:28:53 brian Exp $ + * $Id: chap_ms.c,v 1.5 1998/01/21 02:15:10 brian Exp $ * */ @@ -36,11 +36,11 @@ /* unused, for documentation only */ /* only NTResp is filled in for FreeBSD */ -typedef struct { +struct MS_ChapResponse { u_char LANManResp[24]; u_char NTResp[24]; u_char UseNT; /* If 1, ignore the LANMan response field */ -} MS_ChapResponse; +}; static void DesEncrypt(u_char *, u_char *, u_char *); static void MakeKey(u_char *, u_char *); diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 5ae8613e3fac..6a616e77d1b7 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.121.2.32 1998/03/13 21:07:39 brian Exp $ + * $Id: main.c,v 1.121.2.33 1998/03/16 22:52:28 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -98,12 +98,11 @@ static void TerminalStop(int); static const char *ex_desc(int); static struct bundle *SignalBundle; -int CleaningUp; void Cleanup(int excode) { - CleaningUp = 1; + SignalBundle->CleaningUp = 1; if (bundle_Phase(SignalBundle) != PHASE_DEAD) bundle_Close(SignalBundle, NULL, 0); } @@ -511,7 +510,7 @@ DoLoop(struct bundle *bundle) if (mode & (MODE_DIRECT|MODE_DEDICATED|MODE_BACKGROUND)) bundle_Open(bundle, NULL); - while (!CleaningUp || bundle_Phase(SignalBundle) != PHASE_DEAD) { + while (!bundle->CleaningUp || bundle_Phase(SignalBundle) != PHASE_DEAD) { nfds = 0; FD_ZERO(&rfds); FD_ZERO(&wfds); @@ -533,7 +532,7 @@ DoLoop(struct bundle *bundle) descriptor_UpdateSet(&prompt.desc, &rfds, &wfds, &efds, &nfds); - if (CleaningUp && bundle_Phase(SignalBundle) == PHASE_DEAD) + if (bundle->CleaningUp && bundle_Phase(bundle) == PHASE_DEAD) /* Don't select - we'll be here forever */ break; diff --git a/usr.sbin/ppp/main.h b/usr.sbin/ppp/main.h index 767ed6abd10c..f998a6662d99 100644 --- a/usr.sbin/ppp/main.h +++ b/usr.sbin/ppp/main.h @@ -17,12 +17,10 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.h,v 1.9.2.6 1998/02/16 00:00:36 brian Exp $ + * $Id: main.h,v 1.9.2.7 1998/02/17 19:28:31 brian Exp $ * */ -extern int CleaningUp; - extern void Cleanup(int); extern void AbortProgram(int); extern void TtyTermMode(void); diff --git a/usr.sbin/ppp/prompt.c b/usr.sbin/ppp/prompt.c index ddd5465583b7..7f4fcf007d82 100644 --- a/usr.sbin/ppp/prompt.c +++ b/usr.sbin/ppp/prompt.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: prompt.c,v 1.1.2.12 1998/03/13 21:07:43 brian Exp $ + * $Id: prompt.c,v 1.1.2.13 1998/03/16 22:52:48 brian Exp $ */ #include @@ -267,7 +267,7 @@ prompt_Display(struct prompt *p, struct bundle *bundle) { const char *pconnect, *pauth; - if (!p->Term || p->TermMode != NULL || CleaningUp) + if (!p->Term || p->TermMode != NULL || bundle->CleaningUp) return; if (prompt_nonewline)