[En-Nut-Discussion] PPP/AHDLC logic problems...

Brett Abbott Brett.Abbott at digital-telemetry.com
Sat Apr 16 23:53:41 CEST 2005


Vesa, Harald

I think this is the same problem already resolved by Eduardo Serantes 
but not released formally into NutOS.  He published his patch on 14th 
Jan 2005 to this discussion group for review.  Have a look at this, it 
is quite thorough.

Ernst Stippl, Eduardo and I have tested this and in the words of Ernst (Jan 27), "In my opinion, it should be released".

I suspect there is still a minor memory leak associated with closing PPP (which was there since ppp was first release) surrounding routes not being removed - only an issue if you open and close it alot.

Im working (slowly) on a small mod to allow you to suspend PPP to issue short AT commands without disconnecting the PPP session but this isnt related to your issue.

It may pay for one of the three of us (Eduardo, Ernst or Me) to revise the PPPC.c demo code to show how to close and subsequently reconnect from PPP.

Hope this helps.
Brett



Vesa Jääskeläinen wrote:

> Hi,
>
> I have been trying to solve problem with closing PPP connection and 
> then issuing hangup sequence and continuing using it for normal AT 
> commands and perhaps create another PPP connection.
>
> First problem I see here is to close PPP-connection. I am using 
> following to close it:
>
> _ioctl(pppcom, LCP_CLOSE, 0);
> //_ioctl(pppcom, LCP_LOWERDOWN, 0);
> if (pppcom != -1)
> {
>     _close(pppcom);
>     pppcom = -1;
> }
>
> // Reopen device
> // _open()...
> // hangup sequence here
>
> Now problem with _close() is that it only closes IPCP and not LCP. So 
> I need to shutdown LCP either by LCP_CLOSE/LCP_LOWERDOWN.
>
> After this ahdlc thread is still handling all characters from USART. 
> There is bug in this routine as it never allows leaving the loop. So 
> if I add following patch to ahdlcavr.c, ...
>
> -----
> diff -u -r1.8 ahdlcavr.c
> --- ahdlcavr.c  5 Apr 2005 17:44:56 -0000       1.8
> +++ ahdlcavr.c  16 Apr 2005 18:52:02 -0000
> @@ -438,6 +438,9 @@
>                  }
>              }
>
> +            if (dev->dev_icb == 0)
> +                break;
> +
>              ch = dcb->dcb_rx_buf[dcb->dcb_rd_idx++];
>
>              if (inframe) {
> -----
>
> ... there is even possibility that it gets out of that loop. After a 
> timeout or received character it would exit that loop, this waiting 
> could also be triggered in _ioctl HDLC_SETIFNET, but the problem is 
> that no-one is calling it...
>
> Is there someone with more knowledge where would be correct place to 
> fix this? I will continue to evaluate this myself, but if someone has 
> more information about it's internals I would be pleased to hear about 
> them. If I just call this ioctl myself, I get reboots and that ain't 
> nice.
>
> In my opinion there is at least a bug in PPP as it doesn't lower LCP 
> on closing and I need to manually to do that. There is one _ioctl(fd, 
> HDLC_SETIFNET, 0) in PPP's state machine, but that state is never 
> reached in my tests.
>
> Thanks,
> Vesa Jääskeläinen
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>

-- 
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860  Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------






More information about the En-Nut-Discussion mailing list