From owner-freebsd-current Sat Dec 12 19:00:50 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA01631 for freebsd-current-outgoing; Sat, 12 Dec 1998 19:00:50 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from awfulhak.org (awfulhak.force9.co.uk [195.166.136.63]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA01616; Sat, 12 Dec 1998 19:00:43 -0800 (PST) (envelope-from brian@Awfulhak.org) Received: from keep.lan.Awfulhak.org (keep.lan.Awfulhak.org [172.16.0.8]) by awfulhak.org (8.8.8/8.8.8) with ESMTP id BAA02248; Sun, 13 Dec 1998 01:48:23 GMT (envelope-from brian@Awfulhak.org) Received: from keep.lan.Awfulhak.org (localhost [127.0.0.1]) by keep.lan.Awfulhak.org (8.9.1/8.9.1) with ESMTP id BAA00784; Sun, 13 Dec 1998 01:49:37 GMT (envelope-from brian@keep.lan.Awfulhak.org) Message-Id: <199812130149.BAA00784@keep.lan.Awfulhak.org> X-Mailer: exmh version 2.0.2 2/24/98 To: Poul-Henning Kamp cc: current@FreeBSD.ORG, isdn@FreeBSD.ORG Subject: Re: if_sppp is BROKEN!!! In-reply-to: Your message of "Sun, 13 Dec 1998 00:20:42 +0100." <8711.913504842@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 13 Dec 1998 01:49:37 +0000 From: Brian Somers Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > I think I have finally found out what the problem is with the state > machine in the if_sppp implementation. Whoever wrote the implementation > didn't carefully consider the inter-layer calls tls and tlf. > > If one applies a lot of patches like this one: > > case STATE_OPENED: > - (cp->tld)(sp); > sp->rst_counter[cp->protoidx] = 0; > sppp_cp_change_state(cp, sp, STATE_STOPPING); > + (cp->tld)(sp); > goto sta; > break; > > Then things actually start to make sense... > > The problem is that the tld and tlf functions often just call the > pp_up and pp_down routines directly, and therefore most if not all > of the expected up and down events happen in the previous state > as opposed to the next state. > > Flipping it around like I have done above, on the other hand, may > not be a good idea either, since it means we can nest another layer > on the stack and get somewhat confused on the way down. > > It is quite obvious that this will need some more work to sort out, > anybody interested in participating ? I haven't got much time before Christmas, but if you're still looking for volunteers in the new year I'll be interested. I had similar problems with user-ppp, and ended up having the state machine call the TLU/TLS/TLD/TLF, then tweak the state before calling the same function for the parent.... case ST_OPENED: (*fp->fn->LayerDown)(fp); FsmInitRestartCounter(fp); FsmSendTerminateReq(fp); NewState(fp, ST_CLOSING); (*fp->parent->LayerDown)(fp->parent->object, fp); break; A given layer never calls another layer, it just gets called from the state machine. Things aren't as important on the way up, although the TLU has to tell the FSM if it should proceed and call the parent TLU.... if ((*fp->fn->LayerUp)(fp)) (*fp->parent->LayerUp)(fp->parent->object, fp); else { (*fp->fn->LayerDown)(fp); FsmInitRestartCounter(fp); FsmSendTerminateReq(fp); NewState(fp, ST_CLOSING); } Doing it this way certainly confused me less :-) > -- > Poul-Henning Kamp FreeBSD coreteam member > phk@FreeBSD.ORG "Real hackers run -current on their laptop." > "ttyv0" -- What UNIX calls a $20K state-of-the-art, 3D, hi-res color terminal -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message