lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Detail usage of ppp (address@hidden)


From: Paul Archer
Subject: Re: [lwip-users] Detail usage of ppp (address@hidden)
Date: Fri, 2 Sep 2011 11:45:01 +1000

On Fri, Sep 2, 2011 at 6:24 AM, address@hidden <address@hidden> wrote:
> I'm not too sure about multithreading, regarding thread-safety: functions
> like pppOverSerialOpen and pppClose are *not* designed to be thread-safe and
> should thus only be called from tcpip_thread. I know that examples have been
> around which use the functions like that, but they access common structures
> without locking, which could lead to concurrency problems.
Hmmm. This I did not know, I tried looking deep into the
pppOverSerialOpen(). But from
what I could see trying to follow the state machine was that it hands
it off to the PPP thread.
Now its not particular thread safe as both PPP and the main thread
would be working on the ppp FSM
when a call to pppClose() is done. But I can't see any particular
problems with pppOverSerialOpen().

If we do decidie that pppOverSerialOpen() & pppClose() are problems, I
think that we should add some functions
to the netapi to start ppp (or something similiar to the netapi). The
reason that I don't think it should be in the
tcpip_init() is that the modem state must be initialised first (which
can take a couple of minutes on a GPRS link)

> Aside from that, what's the 'done' variable (in the loop after
> pppOverSerialOpen())? Did you mean "while(!connected)"? Because that's what
> you pass to pppOverSerialOpen, too?
Just a copy and paste error (it should have been connected), its now fixed.

> Now that would really be a nice thing to have: I can comment on code and how
> ppp interacts with lwIP, but unfortunately, I don't have too much knowledge
> about ppp internals. This might be handy for me, too!
I wasn't planning on adding an explanation of PAP/CHAP authentication
or LCP netgoiation. I just think that google and the code will
probably be better at explaining it than me.
In terms of debugging PPP, its pretty simple to get the output. Just
add to your <include/lwipopts.h>

#define PPP_THREAD_NAME             "ppp"
#define PPP_THREAD_STACKSIZE    200
#define PPP_THREAD_PRIO               2

#define LWIP_DEBUG              1
#define PPP_DEBUG               LWIP_DBG_ON

I also found it handy to place a hexdump() of the output and input
received on the serial link in the sio_write() & sio_read() functions.


>
> David Empson also already wrote some helpful hints on lwip-users around two
> months ago, we could add a link to this mail (or some parts of it) to the
> wiki: http://lists.nongnu.org/archive/html/lwip-users/2011-06/msg00036.html
I remember reading this post, and it seems that David Empson must have
spent a lot
of time with the PPP internals. I was amazed at how helpful he in
trouble shooting giving it is a
voluntary mailing list.

Maybe I'll copy the first part of the post into the wiki, and add a
link for the mailing list, citing it as
a good example of having to debug PPP.

-- 
----
Regards
Paul Archer
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]